static void sha512_transform(uint64_t *state, const uint8_t buffer[128])

{

    uint64_t a, b, c, d, e, f, g, h;

    uint64_t block[80];

    uint64_t T1;

    int i;



    a = state[0];

    b = state[1];

    c = state[2];

    d = state[3];

    e = state[4];

    f = state[5];

    g = state[6];

    h = state[7];

#if CONFIG_SMALL

    for (i = 0; i < 80; i++) {

        uint64_t T2;

        if (i < 16)

            T1 = blk0(i);

        else

            T1 = blk(i);

        T1 += h + Sigma1_512(e) + Ch(e, f, g) + K512[i];

        T2 = Sigma0_512(a) + Maj(a, b, c);

        h = g;

        g = f;

        f = e;

        e = d + T1;

        d = c;

        c = b;

        b = a;

        a = T1 + T2;

    }

#else

    for (i = 0; i < 16 - 7;) {

        ROUND512_0_TO_15(a, b, c, d, e, f, g, h);

        ROUND512_0_TO_15(h, a, b, c, d, e, f, g);

        ROUND512_0_TO_15(g, h, a, b, c, d, e, f);

        ROUND512_0_TO_15(f, g, h, a, b, c, d, e);

        ROUND512_0_TO_15(e, f, g, h, a, b, c, d);

        ROUND512_0_TO_15(d, e, f, g, h, a, b, c);

        ROUND512_0_TO_15(c, d, e, f, g, h, a, b);

        ROUND512_0_TO_15(b, c, d, e, f, g, h, a);

    }



    for (; i < 80 - 7;) {

        ROUND512_16_TO_80(a, b, c, d, e, f, g, h);

        ROUND512_16_TO_80(h, a, b, c, d, e, f, g);

        ROUND512_16_TO_80(g, h, a, b, c, d, e, f);

        ROUND512_16_TO_80(f, g, h, a, b, c, d, e);

        ROUND512_16_TO_80(e, f, g, h, a, b, c, d);

        ROUND512_16_TO_80(d, e, f, g, h, a, b, c);

        ROUND512_16_TO_80(c, d, e, f, g, h, a, b);

        ROUND512_16_TO_80(b, c, d, e, f, g, h, a);

    }

#endif

    state[0] += a;

    state[1] += b;

    state[2] += c;

    state[3] += d;

    state[4] += e;

    state[5] += f;

    state[6] += g;

    state[7] += h;

}

static void sha512_transform(uint64_t *state, const uint8_t buffer[128])

{

    uint64_t a, b, c, d, e, f, g, h;

    uint64_t block[80];

    uint64_t T1;

    int i;



    a = state[0];

    b = state[1];

    c = state[2];

    d = state[3];

    e = state[4];

    f = state[5];

    g = state[6];

    h = state[7];

#if CONFIG_SMALL

    for (i = 0; i < 80; i++) {

        uint64_t T2;

        if (i < 16)

            T1 = blk0(i);

        else

            T1 = blk(i);

        T1 += h + Sigma1_512(e) + Ch(e, f, g) + K512[i];

        T2 = Sigma0_512(a) + Maj(a, b, c);

        h = g;

        g = f;

        f = e;

        e = d + T1;

        d = c;

        c = b;

        b = a;

        a = T1 + T2;

    }

#else

    for (i = 0; i < 16 - 7;) {

        ROUND512_0_TO_15(a, b, c, d, e, f, g, h);

        ROUND512_0_TO_15(h, a, b, c, d, e, f, g);

        ROUND512_0_TO_15(g, h, a, b, c, d, e, f);

        ROUND512_0_TO_15(f, g, h, a, b, c, d, e);

        ROUND512_0_TO_15(e, f, g, h, a, b, c, d);

        ROUND512_0_TO_15(d, e, f, g, h, a, b, c);

        ROUND512_0_TO_15(c, d, e, f, g, h, a, b);

        ROUND512_0_TO_15(b, c, d, e, f, g, h, a);

    }



    for (; i < 80 - 7;) {

        ROUND512_16_TO_80(a, b, c, d, e, f, g, h);

        ROUND512_16_TO_80(h, a, b, c, d, e, f, g);

        ROUND512_16_TO_80(g, h, a, b, c, d, e, f);

        ROUND512_16_TO_80(f, g, h, a, b, c, d, e);

        ROUND512_16_TO_80(e, f, g, h, a, b, c, d);

        ROUND512_16_TO_80(d, e, f, g, h, a, b, c);

        ROUND512_16_TO_80(c, d, e, f, g, h, a, b);

        ROUND512_16_TO_80(b, c, d, e, f, g, h, a);

    }

#endif

    state[0] += a;

    state[1] += b;

    state[2] += c;

    state[3] += d;

    state[4] += e;

    state[5] += f;

    state[6] += g;

    state[7] += h;

}

static void FUNC_0(uint64_t *VAR_0, const uint8_t VAR_1[128])

{

    uint64_t a, b, c, d, e, f, g, h;

    uint64_t block[80];

    uint64_t T1;

    int VAR_2;



    a = VAR_0[0];

    b = VAR_0[1];

    c = VAR_0[2];

    d = VAR_0[3];

    e = VAR_0[4];

    f = VAR_0[5];

    g = VAR_0[6];

    h = VAR_0[7];

#if CONFIG_SMALL

    for (VAR_2 = 0; VAR_2 < 80; VAR_2++) {

        uint64_t T2;

        if (VAR_2 < 16)

            T1 = blk0(VAR_2);

        else

            T1 = blk(VAR_2);

        T1 += h + Sigma1_512(e) + Ch(e, f, g) + K512[VAR_2];

        T2 = Sigma0_512(a) + Maj(a, b, c);

        h = g;

        g = f;

        f = e;

        e = d + T1;

        d = c;

        c = b;

        b = a;

        a = T1 + T2;

    }

#else

    for (VAR_2 = 0; VAR_2 < 16 - 7;) {

        ROUND512_0_TO_15(a, b, c, d, e, f, g, h);

        ROUND512_0_TO_15(h, a, b, c, d, e, f, g);

        ROUND512_0_TO_15(g, h, a, b, c, d, e, f);

        ROUND512_0_TO_15(f, g, h, a, b, c, d, e);

        ROUND512_0_TO_15(e, f, g, h, a, b, c, d);

        ROUND512_0_TO_15(d, e, f, g, h, a, b, c);

        ROUND512_0_TO_15(c, d, e, f, g, h, a, b);

        ROUND512_0_TO_15(b, c, d, e, f, g, h, a);

    }



    for (; VAR_2 < 80 - 7;) {

        ROUND512_16_TO_80(a, b, c, d, e, f, g, h);

        ROUND512_16_TO_80(h, a, b, c, d, e, f, g);

        ROUND512_16_TO_80(g, h, a, b, c, d, e, f);

        ROUND512_16_TO_80(f, g, h, a, b, c, d, e);

        ROUND512_16_TO_80(e, f, g, h, a, b, c, d);

        ROUND512_16_TO_80(d, e, f, g, h, a, b, c);

        ROUND512_16_TO_80(c, d, e, f, g, h, a, b);

        ROUND512_16_TO_80(b, c, d, e, f, g, h, a);

    }

#endif

    VAR_0[0] += a;

    VAR_0[1] += b;

    VAR_0[2] += c;

    VAR_0[3] += d;

    VAR_0[4] += e;

    VAR_0[5] += f;

    VAR_0[6] += g;

    VAR_0[7] += h;

}

static void FUNC_0(uint64_t *VAR_0, const uint8_t VAR_1[128])
{ uint64_t a, b, c, d, e, f, g, h; uint64_t block[80]; uint64_t T1; int VAR_2; a = VAR_0[0]; b = VAR_0[1]; c = VAR_0[2]; d = VAR_0[3]; e = VAR_0[4]; f = VAR_0[5]; g = VAR_0[6]; h = VAR_0[7]; #if CONFIG_SMALL
for (VAR_2 = 0; VAR_2 < 80; VAR_2++) { uint64_t T2; if (VAR_2 < 16)
T1 = blk0(VAR_2); else
T1 = blk(VAR_2); T1 += h + Sigma1_512(e) + Ch(e, f, g) + K512[VAR_2]; T2 = Sigma0_512(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } #else
for (VAR_2 = 0; VAR_2 < 16 - 7;) { ROUND512_0_TO_15(a, b, c, d, e, f, g, h); ROUND512_0_TO_15(h, a, b, c, d, e, f, g); ROUND512_0_TO_15(g, h, a, b, c, d, e, f); ROUND512_0_TO_15(f, g, h, a, b, c, d, e); ROUND512_0_TO_15(e, f, g, h, a, b, c, d); ROUND512_0_TO_15(d, e, f, g, h, a, b, c); ROUND512_0_TO_15(c, d, e, f, g, h, a, b); ROUND512_0_TO_15(b, c, d, e, f, g, h, a); } for (; VAR_2 < 80 - 7;) { ROUND512_16_TO_80(a, b, c, d, e, f, g, h); ROUND512_16_TO_80(h, a, b, c, d, e, f, g); ROUND512_16_TO_80(g, h, a, b, c, d, e, f); ROUND512_16_TO_80(f, g, h, a, b, c, d, e); ROUND512_16_TO_80(e, f, g, h, a, b, c, d); ROUND512_16_TO_80(d, e, f, g, h, a, b, c); ROUND512_16_TO_80(c, d, e, f, g, h, a, b); ROUND512_16_TO_80(b, c, d, e, f, g, h, a); } #endif
VAR_0[0] += a; VAR_0[1] += b; VAR_0[2] += c; VAR_0[3] += d; VAR_0[4] += e; VAR_0[5] += f; VAR_0[6] += g; VAR_0[7] += h; }