// File: /workspace/github_c_makefile_star2_O2/dubeyalok7[P]crypto-algo/sha/sha256.c
// Function: sha256Process
static void sha256Process(SHA256Context *ctx)
{
    /* Constants defined in FIPS 180-3, section 4.2.2 */
    static const uint32_t k[64] = {
        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
        0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
        0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
        0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
        0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
        0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
        0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
        0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
        0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
        0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
        0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
        0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
        0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
    };

    int t, t4;
    uint32_t tmp1, tmp2;
    uint32_t w[64];
    uint32_t a,b,c,d,e,f,g,h;

    /* Initialize the first 16 words in the array */
    for(t = t4 = 0; t< 16; t++, t4+=4)
    {
        w[t] = (((uint32_t)ctx->msg_block[t4]) << 24) |
            (((uint32_t)ctx->msg_block[t4 + 1]) << 16) |
            (((uint32_t)ctx->msg_block[t4 + 2]) << 8) |
            (((uint32_t)ctx->msg_block[t4 + 3]));
    }

    for(t = 16; t<64; ++t)
        w[t] = SSIG1(w[t-2]) + w[t-7] + SSIG0(w[t-15]) + w[t-16];

    a = ctx->h[0];
    b = ctx->h[1];
    c = ctx->h[2];
    d = ctx->h[3];
    e = ctx->h[4];
    f = ctx->h[5];
    g = ctx->h[6];
    h = ctx->h[7];

    for(int t = 0; t< 64; ++t) {
        tmp1 = h + SSIG1(e) + SHA256_CH(e, f, g) + k[t] + w[t];
        tmp2 = SSIG0(a) + SHA256_MAJ(a, b, c);
        h = g;
        g = f;
        f = e;
        e = d + tmp1;
        d = c;
        c = b;
        b = a;
        a = tmp1 + tmp2;
    }

    ctx->h[0] += a;
    ctx->h[1] += b;
    ctx->h[2] += c;
    ctx->h[3] += d;
    ctx->h[4] += e;
    ctx->h[5] += f;
    ctx->h[6] += g;
    ctx->h[7] += h;

    ctx->msg_block_idx = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movabsq $0x2d, %rax
cmpq $0x6d, %rax
je 0x12d3
movl -0x3(%rdi,%rax), %ecx
bswapl %ecx
movl %ecx, -0x8d(%rsp,%rax)
addq $0x4, %rax
jmp 0x12ba
movabsq $0x10, %rax
cmpq $0x40, %rax
je 0x132a
movl -0x68(%rsp,%rax,4), %ecx
movl %ecx, %edx
roll $0xf, %edx
movl %ecx, %esi
roll $0xd, %esi
roll $0x16, %ecx
xorl %edx, %esi
xorl %esi, %ecx
addl -0x7c(%rsp,%rax,4), %ecx
movl -0x9c(%rsp,%rax,4), %edx
movl %edx, %esi
roll $0x19, %esi
movl %edx, %r8d
roll $0xe, %r8d
xorl %esi, %r8d
roll $0x1d, %edx
addl -0xa0(%rsp,%rax,4), %ecx
xorl %r8d, %edx
addl %edx, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
jmp 0x12dd
movl (%rdi), %r11d
movl 0x4(%rdi), %ecx
movl 0x8(%rdi), %esi
movl 0xc(%rdi), %r8d
movl 0x10(%rdi), %r14d
movl 0x14(%rdi), %edx
movl 0x18(%rdi), %r10d
movl 0x1c(%rdi), %r15d
xorl %r12d, %r12d
leaq 0xcf0(%rip), %rax       # 0x2040
movl %r11d, %r13d
movl %ecx, -0x7c(%rsp)
movl %esi, -0x78(%rsp)
movl %r8d, -0x74(%rsp)
movl %r14d, -0x70(%rsp)
movl %edx, -0x6c(%rsp)
movl %r10d, -0x68(%rsp)
movl %r15d, -0x64(%rsp)
movl %r10d, %ebp
movl %edx, %r10d
movl %r14d, %edx
movl %esi, %r9d
movl %ecx, %esi
movl %r13d, %ecx
cmpq $0x100, %r12            # imm = 0x100
je 0x1405
movl %edx, %r14d
roll $0xf, %r14d
movl %edx, %r13d
roll $0xd, %r13d
movl %edx, %ebx
roll $0x16, %ebx
xorl %r14d, %r13d
xorl %r13d, %ebx
movl %r10d, %r14d
xorl %ebp, %r14d
andl %edx, %r14d
xorl %ebp, %r14d
addl %r14d, %r15d
addl %ebx, %r15d
addl (%r12,%rax), %r15d
addl -0x60(%rsp,%r12), %r15d
movl %ecx, %ebx
roll $0x19, %ebx
movl %ecx, %r14d
roll $0xe, %r14d
xorl %ebx, %r14d
movl %ecx, %ebx
roll $0x1d, %ebx
xorl %r14d, %ebx
movl %r9d, %r14d
xorl %ecx, %r14d
andl %esi, %r14d
movl %r9d, %r13d
andl %ecx, %r13d
xorl %r14d, %r13d
addl %ebx, %r13d
movl %r8d, %r14d
addl %r15d, %r14d
addl %r15d, %r13d
addq $0x4, %r12
movl %r9d, %r8d
movl %ebp, %r15d
jmp 0x1373
addl %r11d, %ecx
movl %ecx, (%rdi)
addl -0x7c(%rsp), %esi
movl %esi, 0x4(%rdi)
addl -0x78(%rsp), %r9d
movl %r9d, 0x8(%rdi)
addl -0x74(%rsp), %r8d
movl %r8d, 0xc(%rdi)
addl -0x70(%rsp), %edx
movl %edx, 0x10(%rdi)
addl -0x6c(%rsp), %r10d
movl %r10d, 0x14(%rdi)
addl -0x68(%rsp), %ebp
movl %ebp, 0x18(%rdi)
addl -0x64(%rsp), %r15d
movl %r15d, 0x1c(%rdi)
andw $0x0, 0x28(%rdi)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq