// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movl $0x2d, %eax
movl -0x3(%rdi,%rax), %ecx
bswapl %ecx
movl %ecx, -0x7d(%rsp,%rax)
addq $0x4, %rax
cmpq $0x6d, %rax
jne 0x12b8
movl $0x10, %eax
movl -0x8c(%rsp,%rax,4), %ecx
movl -0x58(%rsp,%rax,4), %edx
movl %edx, %esi
roll $0xf, %esi
movl %edx, %r8d
roll $0xd, %r8d
roll $0x16, %edx
xorl %esi, %r8d
xorl %r8d, %edx
addl -0x6c(%rsp,%rax,4), %edx
movl %ecx, %esi
roll $0x19, %esi
movl %ecx, %r8d
roll $0xe, %r8d
roll $0x1d, %ecx
xorl %esi, %r8d
xorl %r8d, %ecx
addl -0x90(%rsp,%rax,4), %edx
addl %ecx, %edx
movl %edx, -0x50(%rsp,%rax,4)
incq %rax
cmpq $0x40, %rax
jne 0x12d1
movl (%rdi), %r11d
movl 0x4(%rdi), %r10d
movl 0x8(%rdi), %r8d
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %r13d
movl 0x14(%rdi), %ebx
movl 0x18(%rdi), %ebp
movq %rdi, -0x58(%rsp)
movl 0x1c(%rdi), %r12d
xorl %r14d, %r14d
movl %r12d, -0x5c(%rsp)
movl %ebp, -0x60(%rsp)
movl %ebx, -0x64(%rsp)
movl %r13d, -0x68(%rsp)
movl %eax, -0x6c(%rsp)
movl %eax, %edi
movl %r8d, -0x70(%rsp)
movl %r10d, -0x74(%rsp)
movl %r11d, -0x78(%rsp)
movl %r13d, %eax
movl %r13d, %ecx
roll $0xf, %ecx
movl %ebx, %r15d
movl %r13d, %esi
roll $0xd, %esi
movl %ebp, %edx
movl %r13d, %r9d
roll $0x16, %r9d
xorl %ecx, %esi
xorl %esi, %r9d
movl %ebx, %ebp
xorl %edx, %ebp
andl %r13d, %ebp
xorl %edx, %ebp
addl %r12d, %ebp
addl %r9d, %ebp
leaq 0xc9f(%rip), %rcx       # 0x2040
addl (%r14,%rcx), %ebp
addl -0x50(%rsp,%r14), %ebp
movl %r11d, %esi
roll $0x19, %r11d
movl %r10d, %r9d
movl %esi, %r10d
roll $0xe, %r10d
movl %r8d, %ecx
movl %esi, %r8d
roll $0x1d, %r8d
xorl %r11d, %r10d
xorl %r10d, %r8d
movl %ecx, %r10d
xorl %esi, %r10d
andl %r9d, %r10d
movl %ecx, %r11d
andl %esi, %r11d
xorl %r10d, %r11d
addl %r8d, %r11d
movl %edi, %r13d
addl %ebp, %r13d
addl %ebp, %r11d
addq $0x4, %r14
movl %edx, %r12d
movl %ebx, %ebp
movl %eax, %ebx
movl %ecx, %edi
movl %r9d, %r8d
movl %esi, %r10d
cmpq $0x100, %r14            # imm = 0x100
jne 0x136b
addl -0x78(%rsp), %r11d
movq -0x58(%rsp), %rdi
movl %r11d, (%rdi)
addl -0x74(%rsp), %esi
movl %esi, 0x4(%rdi)
addl -0x70(%rsp), %r9d
movl %r9d, 0x8(%rdi)
addl -0x6c(%rsp), %ecx
movl %ecx, 0xc(%rdi)
addl -0x68(%rsp), %r13d
movl %r13d, 0x10(%rdi)
addl -0x64(%rsp), %eax
movl %eax, 0x14(%rdi)
addl -0x60(%rsp), %r15d
movl %r15d, 0x18(%rdi)
addl -0x5c(%rsp), %edx
movl %edx, 0x1c(%rdi)
movw $0x0, 0x28(%rdi)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq