// File: /workspace/github_c_makefile_star2_O2/janmojzis[P]mcencrypt/crypto_hash_sha512.c
// Function: blocks
static void blocks(unsigned long long *z, const unsigned char *m, unsigned long long n) {

    unsigned long long b[8], a[8], w[80], t;
    long long i, j;

    for (i = 0; i < 8; ++i) a[i] = z[i];
  
    while (n >= 128) { 
        for (i =  0; i < 16; ++i) w[i] = load64_bigendian(m + 8 * i);
        for (i = 16; i < 80; ++i) w[i] = (sigma1(w[i - 2]) + w[i - 7] + sigma0(w[i - 15]) + w[i - 16]) & 0xffffffffffffffffULL;

        for (i = 0; i < 80; ++i) {
            for (j = 0; j < 8; ++j) b[j] = a[j];
            t = a[7] + Sigma1(a[4]) + Ch(a[4], a[5], a[6]) + K[i] + w[i];
            b[7] = t + Sigma0(a[0]) + Maj(a[0], a[1], a[2]);
            b[3] += t;
            for (j = 0; j < 8; ++j) a[(j + 1) % 8] = b[j] & 0xffffffffffffffffULL;
        }
    
        for (i = 0; i < 8; ++i) { a[i] += z[i]; a[i] &= 0xffffffffffffffffULL; z[i] = a[i]; }
    
        m += 128;
        n -= 128;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x280, %rsp            # imm = 0x280
xorl %eax, %eax
cmpq $0x8, %rax
je 0x4410
movq (%rdi,%rax,8), %rcx
movq %rcx, -0x80(%rsp,%rax,8)
incq %rax
jmp 0x43fc
leaq 0x2d09(%rip), %rax      # 0x7120
movabsq $0x1, %rcx
cmpq $0x80, %rdx
jb 0x45c1
movq %rsi, %r8
xorl %r9d, %r9d
cmpq $0x10, %r9
je 0x4464
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq $0x8, %r11
je 0x4457
shlq $0x8, %r10
movzbl (%r8,%r11), %ebx
orq %rbx, %r10
incq %r11
jmp 0x4440
movq %r10, (%rsp,%r9,8)
incq %r9
addq $0x8, %r8
jmp 0x4434
xorl %r8d, %r8d
cmpq $0x40, %r8
je 0x44bf
movq 0x70(%rsp,%r8,8), %r9
movq %r9, %r10
rolq $0x2d, %r10
movq %r9, %r11
rolq $0x3, %r11
xorq %r10, %r11
shrq $0x6, %r9
xorq %r11, %r9
addq 0x48(%rsp,%r8,8), %r9
movq 0x8(%rsp,%r8,8), %r10
movq %r10, %r11
rorq %r11
movq %r10, %rbx
rolq $0x38, %rbx
xorq %r11, %rbx
shrq $0x7, %r10
addq (%rsp,%r8,8), %r9
xorq %rbx, %r10
addq %r10, %r9
movq %r9, 0x80(%rsp,%r8,8)
incq %r8
jmp 0x4467
xorl %r8d, %r8d
cmpq $0x50, %r8
je 0x4594
xorl %r9d, %r9d
cmpq $0x8, %r9
je 0x44e4
movq -0x80(%rsp,%r9,8), %r10
movq %r10, -0x40(%rsp,%r9,8)
incq %r9
jmp 0x44cf
movq -0x60(%rsp), %r10
movq %r10, %r9
rolq $0x32, %r9
movq %r10, %r11
rolq $0x2e, %r11
xorq %r9, %r11
movq %r10, %rbx
rolq $0x17, %rbx
xorq %r11, %rbx
movq -0x58(%rsp), %r9
andq %r10, %r9
notq %r10
andq -0x50(%rsp), %r10
addq -0x48(%rsp), %r9
addq %rbx, %r9
movq -0x80(%rsp), %r11
movq -0x78(%rsp), %rbx
movq %r11, %r14
movq %r11, %r15
movq -0x70(%rsp), %r12
movq %r12, %r13
xorq %rbx, %r13
andq %r11, %r13
rolq $0x24, %r11
addq %r10, %r9
rolq $0x1e, %r14
xorq %r11, %r14
addq (%rax,%r8,8), %r9
addq (%rsp,%r8,8), %r9
rolq $0x19, %r15
xorq %r14, %r15
andq %rbx, %r12
xorq %r13, %r12
addq %r15, %r12
addq %r9, %r12
movq %r12, -0x8(%rsp)
addq %r9, -0x28(%rsp)
movq %rcx, %r9
cmpq $0x9, %r9
je 0x458c
movq -0x48(%rsp,%r9,8), %r10
movl %r9d, %r11d
andl $0x7, %r11d
movq %r10, -0x80(%rsp,%r11,8)
incq %r9
jmp 0x4570
incq %r8
jmp 0x44c2
xorl %r8d, %r8d
cmpq $0x8, %r8
je 0x45b4
movq -0x80(%rsp,%r8,8), %r9
addq (%rdi,%r8,8), %r9
movq %r9, -0x80(%rsp,%r8,8)
movq %r9, (%rdi,%r8,8)
incq %r8
jmp 0x4597
subq $-0x80, %rsi
addq $-0x80, %rdx
jmp 0x4421
addq $0x280, %rsp            # imm = 0x280
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq