// File: /workspace/github_cpp_makefile_star2_O2/simap[P]ecctools/lib/SHA256.cpp
// Function: SHA256::processChunk()
void SHA256::processChunk()
{
    // Round constants for SHA-256.
    static uint32_t const k[64] PROGMEM = {
        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
    };

    // Convert the first 16 words from big endian to host byte order.
    uint8_t index;
    for (index = 0; index < 16; ++index)
        state.w[index] = be32toh(state.w[index]);

    // Initialise working variables to the current hash value.
    uint32_t a = state.h[0];
    uint32_t b = state.h[1];
    uint32_t c = state.h[2];
    uint32_t d = state.h[3];
    uint32_t e = state.h[4];
    uint32_t f = state.h[5];
    uint32_t g = state.h[6];
    uint32_t h = state.h[7];

    // Perform the first 16 rounds of the compression function main loop.
    uint32_t temp1, temp2;
    for (index = 0; index < 16; ++index) {
        temp1 = h + pgm_read_dword(k + index) + state.w[index] +
                (rightRotate6(e) ^ rightRotate11(e) ^ rightRotate25(e)) +
                ((e & f) ^ ((~e) & g));
        temp2 = (rightRotate2(a) ^ rightRotate13(a) ^ rightRotate22(a)) +
                ((a & b) ^ (a & c) ^ (b & c));
        h = g;
        g = f;
        f = e;
        e = d + temp1;
        d = c;
        c = b;
        b = a;
        a = temp1 + temp2;
    }

    // Perform the 48 remaining rounds.  We expand the first 16 words to
    // 64 in-place in the "w" array.  This saves 192 bytes of memory
    // that would have otherwise need to be allocated to the "w" array.
    for (; index < 64; ++index) {
        // Expand the next word.
        temp1 = state.w[(index - 15) & 0x0F];
        temp2 = state.w[(index - 2) & 0x0F];
        temp1 = state.w[index & 0x0F] =
            state.w[(index - 16) & 0x0F] + state.w[(index - 7) & 0x0F] +
                (rightRotate7(temp1) ^ rightRotate18(temp1) ^ (temp1 >> 3)) +
                (rightRotate17(temp2) ^ rightRotate19(temp2) ^ (temp2 >> 10));

        // Perform the round.
        temp1 = h + pgm_read_dword(k + index) + temp1 +
                (rightRotate6(e) ^ rightRotate11(e) ^ rightRotate25(e)) +
                ((e & f) ^ ((~e) & g));
        temp2 = (rightRotate2(a) ^ rightRotate13(a) ^ rightRotate22(a)) +
                ((a & b) ^ (a & c) ^ (b & c));
        h = g;
        g = f;
        f = e;
        e = d + temp1;
        d = c;
        c = b;
        b = a;
        a = temp1 + temp2;
    }

    // Add the compressed chunk to the current hash value.
    state.h[0] += a;
    state.h[1] += b;
    state.h[2] += c;
    state.h[3] += d;
    state.h[4] += e;
    state.h[5] += f;
    state.h[6] += g;
    state.h[7] += h;

    // Attempt to clean up the stack.
    a = b = c = d = e = f = g = h = temp1 = temp2 = 0;
}

// Assembly:
xorl %eax, %eax
cmpq $0x10, %rax
je 0x48e3
movl 0x28(%rdi,%rax,4), %ecx
bswapl %ecx
movl %ecx, 0x28(%rdi,%rax,4)
incq %rax
jmp 0x48ce
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x8(%rdi), %r15d
movl 0xc(%rdi), %r8d
movl 0x10(%rdi), %r12d
movl 0x14(%rdi), %ecx
movl 0x18(%rdi), %r11d
movl 0x1c(%rdi), %ebx
movl 0x20(%rdi), %r10d
movl 0x24(%rdi), %eax
xorl %esi, %esi
movl %eax, -0x4(%rsp)
movl %eax, -0x24(%rsp)
movl %r10d, -0x8(%rsp)
movl %ebx, -0xc(%rsp)
movl %r11d, -0x10(%rsp)
movl %ecx, -0x14(%rsp)
movl %ecx, %eax
movl %r12d, -0x18(%rsp)
movl %r8d, -0x1c(%rsp)
movl %r15d, -0x20(%rsp)
cmpq $0x40, %rsi
je 0x49cf
movl %r11d, %ebp
movl %r11d, %ecx
movl %ebx, %edx
xorl %r10d, %edx
andl %r11d, %edx
movl %r11d, %r9d
roll $0x1a, %r9d
roll $0x15, %ebp
xorl %r10d, %edx
addl -0x24(%rsp), %edx
movl %r10d, -0x24(%rsp)
movl %ebx, %r10d
movl %r11d, %ebx
xorl %r9d, %ebp
roll $0x7, %ecx
xorl %ebp, %ecx
addl %ecx, %edx
leaq 0x844(%rip), %rcx       # 0x51c0
addl (%rsi,%rcx), %edx
addl 0x28(%rdi,%rsi), %edx
movl %r15d, %ecx
movl %r15d, %r9d
movl %r8d, %ebp
xorl %r12d, %ebp
andl %r15d, %ebp
movl %r15d, %r13d
roll $0x1e, %r13d
movl %r8d, %r14d
andl %r12d, %r14d
addl %edx, %eax
movl %eax, %r11d
movl %r12d, %eax
movl %r8d, %r12d
movl %r15d, %r8d
roll $0x13, %ecx
xorl %r13d, %ecx
roll $0xa, %r9d
xorl %ecx, %r9d
xorl %ebp, %r14d
addl %r9d, %r14d
addl %edx, %r14d
addq $0x4, %rsi
movl %r14d, %r15d
jmp 0x4937
movabsq $0x1e, %rsi
movl -0x24(%rsp), %r13d
cmpq $0x4e, %rsi
je 0x4acd
leal -0xd(%rsi), %ecx
andl $0xf, %ecx
movl 0x28(%rdi,%rcx,4), %ecx
movl %esi, %edx
movl %ecx, %r9d
roll $0x19, %r9d
andl $0xf, %edx
movl %ecx, %ebp
roll $0xe, %ebp
movl 0x28(%rdi,%rdx,4), %edx
xorl %r9d, %ebp
shrl $0x3, %ecx
xorl %ebp, %ecx
movl %edx, %r9d
roll $0xf, %r9d
movl %edx, %ebp
roll $0xd, %ebp
xorl %r9d, %ebp
leaq -0xe(%rsi), %r9
andl $0xf, %r9d
shrl $0xa, %edx
xorl %ebp, %edx
leal -0x5(%rsi), %r14d
andl $0xf, %r14d
movl 0x28(%rdi,%r14,4), %ebp
addl 0x28(%rdi,%r9,4), %ebp
addl %ebp, %edx
addl %ecx, %edx
movl %edx, 0x28(%rdi,%r9,4)
movl %r11d, %ecx
movl %r11d, %r9d
movl %r11d, %ebp
roll $0x1a, %ebp
roll $0x15, %ecx
roll $0x7, %r9d
xorl %ebp, %ecx
xorl %ecx, %r9d
movl %ebx, %ecx
xorl %r10d, %ecx
andl %r11d, %ecx
xorl %r10d, %ecx
addl %r13d, %ecx
addl %r9d, %ecx
leaq 0x74a(%rip), %r9        # 0x51c0
addl -0x38(%r9,%rsi,4), %ecx
addl %edx, %ecx
movl %r15d, %edx
movl %r15d, %r9d
movl %r15d, %ebp
roll $0x1e, %ebp
roll $0x13, %edx
xorl %ebp, %edx
movl %r8d, %ebp
xorl %r12d, %ebp
andl %r15d, %ebp
roll $0xa, %r9d
xorl %edx, %r9d
movl %r8d, %edx
andl %r12d, %edx
xorl %ebp, %edx
addl %r9d, %edx
addl %ecx, %eax
addl %ecx, %edx
movl %r10d, %r13d
movl %ebx, %r10d
movl %r11d, %ebx
movl %eax, %r11d
movl %r12d, %eax
movl %r8d, %r12d
movl %r15d, %r8d
incq %rsi
movl %edx, %r15d
jmp 0x49de
addl -0x20(%rsp), %r15d
movl %r15d, 0x8(%rdi)
addl -0x1c(%rsp), %r8d
movl %r8d, 0xc(%rdi)
addl -0x18(%rsp), %r12d
movl %r12d, 0x10(%rdi)
addl -0x14(%rsp), %eax
movl %eax, 0x14(%rdi)
addl -0x10(%rsp), %r11d
movl %r11d, 0x18(%rdi)
addl -0xc(%rsp), %ebx
movl %ebx, 0x1c(%rdi)
addl -0x8(%rsp), %r10d
movl %r10d, 0x20(%rdi)
addl -0x4(%rsp), %r13d
movl %r13d, 0x24(%rdi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq