// File: s0sasaki[P]ExecutableBlockchain/sha256.cpp
// Function: SHA256::transform(unsigned char const*, unsigned int)
void SHA256::transform(const unsigned char *message, unsigned int block_nb)
{
    uint32 w[64];
    uint32 wv[8];
    uint32 t1, t2;
    const unsigned char *sub_block;
    int i;
    int j;
    for (i = 0; i < (int) block_nb; i++) {
        sub_block = message + (i << 6);
        for (j = 0; j < 16; j++) {
            SHA2_PACK32(&sub_block[j << 2], &w[j]);
        }
        for (j = 16; j < 64; j++) {
            w[j] =  SHA256_F4(w[j -  2]) + w[j -  7] + SHA256_F3(w[j - 15]) + w[j - 16];
        }
        for (j = 0; j < 8; j++) {
            wv[j] = m_h[j];
        }
        for (j = 0; j < 64; j++) {
            t1 = wv[7] + SHA256_F2(wv[4]) + SHA2_CH(wv[4], wv[5], wv[6])
                 + sha256_k[j] + w[j];
            t2 = SHA256_F1(wv[0]) + SHA2_MAJ(wv[0], wv[1], wv[2]);
            wv[7] = wv[6];
            wv[6] = wv[5];
            wv[5] = wv[4];
            wv[4] = wv[3] + t1;
            wv[3] = wv[2];
            wv[2] = wv[1];
            wv[1] = wv[0];
            wv[0] = t1 + t2;
        }
        for (j = 0; j < 8; j++) {
            m_h[j] += wv[j];
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xa08f
movq -0x10(%rbp), %rax
movl -0x154(%rbp), %ecx
shll $0x6, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
movl $0x0, -0x158(%rbp)
cmpl $0x10, -0x158(%rbp)
jge 0x9d0b
movq -0x150(%rbp), %rax
movl -0x158(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movzbl 0x3(%rax,%rcx), %ecx
movq -0x150(%rbp), %rax
movl -0x158(%rbp), %edx
shll $0x2, %edx
movslq %edx, %rdx
movzbl 0x2(%rax,%rdx), %eax
shll $0x8, %eax
orl %eax, %ecx
movq -0x150(%rbp), %rax
movl -0x158(%rbp), %edx
shll $0x2, %edx
movslq %edx, %rdx
movzbl 0x1(%rax,%rdx), %eax
shll $0x10, %eax
orl %eax, %ecx
movq -0x150(%rbp), %rax
movl -0x158(%rbp), %edx
shll $0x2, %edx
movslq %edx, %rdx
movzbl (%rax,%rdx), %eax
shll $0x18, %eax
orl %eax, %ecx
movslq -0x158(%rbp), %rax
movl %ecx, -0x120(%rbp,%rax,4)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x9c6e
movl $0x10, -0x158(%rbp)
cmpl $0x40, -0x158(%rbp)
jge 0x9e51
movl -0x158(%rbp), %eax
subl $0x2, %eax
cltq
movl -0x120(%rbp,%rax,4), %ecx
shrl $0x11, %ecx
movl -0x158(%rbp), %eax
subl $0x2, %eax
cltq
movl -0x120(%rbp,%rax,4), %eax
shll $0xf, %eax
orl %eax, %ecx
movl -0x158(%rbp), %eax
subl $0x2, %eax
cltq
movl -0x120(%rbp,%rax,4), %eax
shrl $0x13, %eax
movl -0x158(%rbp), %edx
subl $0x2, %edx
movslq %edx, %rdx
movl -0x120(%rbp,%rdx,4), %edx
shll $0xd, %edx
orl %edx, %eax
xorl %eax, %ecx
movl -0x158(%rbp), %eax
subl $0x2, %eax
cltq
movl -0x120(%rbp,%rax,4), %eax
shrl $0xa, %eax
xorl %eax, %ecx
movl -0x158(%rbp), %eax
subl $0x7, %eax
cltq
addl -0x120(%rbp,%rax,4), %ecx
movl -0x158(%rbp), %eax
subl $0xf, %eax
cltq
movl -0x120(%rbp,%rax,4), %eax
shrl $0x7, %eax
movl -0x158(%rbp), %edx
subl $0xf, %edx
movslq %edx, %rdx
movl -0x120(%rbp,%rdx,4), %edx
shll $0x19, %edx
orl %edx, %eax
movl -0x158(%rbp), %edx
subl $0xf, %edx
movslq %edx, %rdx
movl -0x120(%rbp,%rdx,4), %edx
shrl $0x12, %edx
movl -0x158(%rbp), %esi
subl $0xf, %esi
movslq %esi, %rsi
movl -0x120(%rbp,%rsi,4), %esi
shll $0xe, %esi
orl %esi, %edx
xorl %edx, %eax
movl -0x158(%rbp), %edx
subl $0xf, %edx
movslq %edx, %rdx
movl -0x120(%rbp,%rdx,4), %edx
shrl $0x3, %edx
xorl %edx, %eax
addl %eax, %ecx
movl -0x158(%rbp), %eax
subl $0x10, %eax
cltq
addl -0x120(%rbp,%rax,4), %ecx
movslq -0x158(%rbp), %rax
movl %ecx, -0x120(%rbp,%rax,4)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x9d15
movl $0x0, -0x158(%rbp)
cmpl $0x8, -0x158(%rbp)
jge 0x9e98
movq -0x160(%rbp), %rax
movslq -0x158(%rbp), %rcx
movl 0x88(%rax,%rcx,4), %ecx
movslq -0x158(%rbp), %rax
movl %ecx, -0x140(%rbp,%rax,4)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x9e5b
movl $0x0, -0x158(%rbp)
cmpl $0x40, -0x158(%rbp)
jge 0xa02b
movl -0x124(%rbp), %eax
movl -0x130(%rbp), %ecx
shrl $0x6, %ecx
movl -0x130(%rbp), %edx
shll $0x1a, %edx
orl %edx, %ecx
movl -0x130(%rbp), %edx
shrl $0xb, %edx
movl -0x130(%rbp), %esi
shll $0x15, %esi
orl %esi, %edx
xorl %edx, %ecx
movl -0x130(%rbp), %edx
shrl $0x19, %edx
movl -0x130(%rbp), %esi
shll $0x7, %esi
orl %esi, %edx
xorl %edx, %ecx
addl %ecx, %eax
movl -0x130(%rbp), %ecx
andl -0x12c(%rbp), %ecx
movl -0x130(%rbp), %edx
xorl $-0x1, %edx
andl -0x128(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
movslq -0x158(%rbp), %rdx
leaq 0x229c(%rip), %rcx      # 0xc1c0
addl (%rcx,%rdx,4), %eax
movslq -0x158(%rbp), %rcx
addl -0x120(%rbp,%rcx,4), %eax
movl %eax, -0x144(%rbp)
movl -0x140(%rbp), %eax
shrl $0x2, %eax
movl -0x140(%rbp), %ecx
shll $0x1e, %ecx
orl %ecx, %eax
movl -0x140(%rbp), %ecx
shrl $0xd, %ecx
movl -0x140(%rbp), %edx
shll $0x13, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x140(%rbp), %ecx
shrl $0x16, %ecx
movl -0x140(%rbp), %edx
shll $0xa, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x140(%rbp), %ecx
andl -0x13c(%rbp), %ecx
movl -0x140(%rbp), %edx
andl -0x138(%rbp), %edx
xorl %edx, %ecx
movl -0x13c(%rbp), %edx
andl -0x138(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x148(%rbp)
movl -0x128(%rbp), %eax
movl %eax, -0x124(%rbp)
movl -0x12c(%rbp), %eax
movl %eax, -0x128(%rbp)
movl -0x130(%rbp), %eax
movl %eax, -0x12c(%rbp)
movl -0x134(%rbp), %eax
addl -0x144(%rbp), %eax
movl %eax, -0x130(%rbp)
movl -0x138(%rbp), %eax
movl %eax, -0x134(%rbp)
movl -0x13c(%rbp), %eax
movl %eax, -0x138(%rbp)
movl -0x140(%rbp), %eax
movl %eax, -0x13c(%rbp)
movl -0x144(%rbp), %eax
addl -0x148(%rbp), %eax
movl %eax, -0x140(%rbp)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x9ea2
movl $0x0, -0x158(%rbp)
cmpl $0x8, -0x158(%rbp)
jge 0xa079
movq -0x160(%rbp), %rax
movslq -0x158(%rbp), %rcx
movl -0x140(%rbp,%rcx,4), %edx
movslq -0x158(%rbp), %rcx
addl 0x88(%rax,%rcx,4), %edx
movl %edx, 0x88(%rax,%rcx,4)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0xa035
jmp 0xa07b
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0x9c3b
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)