// File: /workspace/github_cpp_makefile_star2_O2/zhjw1998[P]Merkle-Tree/src/../include/picosha2.h
// Function: void picosha2::detail::hash256_block<unsigned long*, unsigned char*>(unsigned long*, unsigned char*, unsigned char*)
void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) {
    assert(first + 64 == last);
    static_cast<void>(last);  // for avoiding unused-variable warning
    word_t w[64];
    std::fill(w, w + 64, 0);
    for (std::size_t i = 0; i < 16; ++i) {
        w[i] = (static_cast<word_t>(mask_8bit(*(first + i * 4))) << 24) |
               (static_cast<word_t>(mask_8bit(*(first + i * 4 + 1))) << 16) |
               (static_cast<word_t>(mask_8bit(*(first + i * 4 + 2))) << 8) |
               (static_cast<word_t>(mask_8bit(*(first + i * 4 + 3))));
    }
    for (std::size_t i = 16; i < 64; ++i) {
        w[i] = mask_32bit(ssig1(w[i - 2]) + w[i - 7] + ssig0(w[i - 15]) +
                          w[i - 16]);
    }

    word_t a = *message_digest;
    word_t b = *(message_digest + 1);
    word_t c = *(message_digest + 2);
    word_t d = *(message_digest + 3);
    word_t e = *(message_digest + 4);
    word_t f = *(message_digest + 5);
    word_t g = *(message_digest + 6);
    word_t h = *(message_digest + 7);

    for (std::size_t i = 0; i < 64; ++i) {
        word_t temp1 = h + bsig1(e) + ch(e, f, g) + add_constant[i] + w[i];
        word_t temp2 = bsig0(a) + maj(a, b, c);
        h = g;
        g = f;
        f = e;
        e = mask_32bit(d + temp1);
        d = c;
        c = b;
        b = a;
        a = mask_32bit(temp1 + temp2);
    }
    *message_digest += a;
    *(message_digest + 1) += b;
    *(message_digest + 2) += c;
    *(message_digest + 3) += d;
    *(message_digest + 4) += e;
    *(message_digest + 5) += f;
    *(message_digest + 6) += g;
    *(message_digest + 7) += h;
    for (std::size_t i = 0; i < 8; ++i) {
        *(message_digest + i) = mask_32bit(*(message_digest + i));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
leaq 0x40(%rsi), %rax
cmpq %rdx, %rax
jne 0x3c24
movq %rdi, %r12
xorl %eax, %eax
cmpq $0x200, %rax            # imm = 0x200
je 0x3ab5
andq $0x0, 0x30(%rsp,%rax)
addq $0x8, %rax
jmp 0x3aa1
xorl %eax, %eax
cmpq $0x10, %rax
je 0x3acc
movl (%rsi,%rax,4), %ecx
bswapl %ecx
movq %rcx, 0x30(%rsp,%rax,8)
incq %rax
jmp 0x3ab7
pushq $0x10
popq %rbx
cmpq $0x40, %rbx
je 0x3b02
movq 0x20(%rsp,%rbx,8), %rdi
callq 0x3983
movq %rax, %r14
addl -0x8(%rsp,%rbx,8), %r14d
movq -0x48(%rsp,%rbx,8), %rdi
callq 0x39a9
addl %r14d, %eax
addl -0x50(%rsp,%rbx,8), %eax
movq %rax, 0x30(%rsp,%rbx,8)
incq %rbx
jmp 0x3acf
movq (%r12), %rax
movq 0x8(%r12), %r14
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rcx
movq 0x28(%r12), %r15
movq 0x30(%r12), %rdx
movq %rdx, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x38(%r12), %rbp
xorl %ebx, %ebx
movq (%rsp), %r8
movq %r15, (%rsp)
movq %rcx, %r15
movq %rsi, %r13
cmpq $0x200, %rbx            # imm = 0x200
je 0x3bd8
movq %rdi, 0x10(%rsp)
movq %r15, %rdi
movq %r14, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq %r8, %r14
movq %r8, 0x18(%rsp)
callq 0x39cf
movq %rax, %r12
movq (%rsp), %rax
andl %r15d, %eax
movl %r15d, %ecx
notl %ecx
andl %r14d, %ecx
movq 0x20(%rsp), %r14
addl %eax, %ebp
addl %ecx, %ebp
addl %ebp, %r12d
leaq 0xa85d(%rip), %rax      # 0xe3f0
addl (%rbx,%rax), %r12d
addl 0x30(%rsp,%rbx), %r12d
movq %r14, %rdi
callq 0x39ff
movq 0x28(%rsp), %rsi
movl %r13d, %ecx
xorl %esi, %ecx
movl %r14d, %edx
andl %ecx, %edx
movl %r13d, %ecx
andl %esi, %ecx
xorl %edx, %ecx
addl %ecx, %eax
movq 0x10(%rsp), %rcx
addl %r12d, %ecx
addl %r12d, %eax
addq $0x8, %rbx
movq %r13, %rdi
movq 0x18(%rsp), %rbp
jmp 0x3b34
movq 0x8(%rsp), %rcx
addq %rax, (%rcx)
addq %r14, 0x8(%rcx)
addq %r13, 0x10(%rcx)
addq %rdi, 0x18(%rcx)
addq %r15, 0x20(%rcx)
movq (%rsp), %rax
addq %rax, 0x28(%rcx)
addq %r8, 0x30(%rcx)
addq %rbp, 0x38(%rcx)
xorl %eax, %eax
cmpq $0x8, %rax
je 0x3c12
andl $0x0, 0x4(%rcx,%rax,8)
incq %rax
jmp 0x3c02
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa5cf(%rip), %rdi      # 0xe1fa
leaq 0xa5db(%rip), %rsi      # 0xe20d
leaq 0xa69f(%rip), %rcx      # 0xe2d8
pushq $0x5d
popq %rdx
callq 0x2100
nop