// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups 0x20(%rdi), %xmm2
movups 0x30(%rdi), %xmm3
movaps %xmm0, -0x80(%rsp)
movaps %xmm1, -0x70(%rsp)
movaps %xmm2, -0x60(%rsp)
movaps %xmm3, -0x50(%rsp)
cmpq $0x80, %rdx
jb 0x468e
leaq 0x2c2e(%rip), %rax      # 0x7120
movq %rsi, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %r10d, %r10d
movq %r10, %r11
shlq $0x8, %r11
movzbl (%rcx,%r9), %r10d
orq %r11, %r10
incq %r9
cmpq $0x8, %r9
jne 0x44fe
movq %r10, (%rsp,%r8,8)
incq %r8
addq $0x8, %rcx
cmpq $0x10, %r8
jne 0x44f8
xorl %ecx, %ecx
movq 0x70(%rsp,%rcx,8), %r8
movq %r8, %r9
rolq $0x2d, %r9
movq %r8, %r10
rolq $0x3, %r10
xorq %r9, %r10
shrq $0x6, %r8
xorq %r10, %r8
addq 0x48(%rsp,%rcx,8), %r8
movq 0x8(%rsp,%rcx,8), %r9
movq %r9, %r10
rorq %r10
movq %r9, %r11
rolq $0x38, %r11
xorq %r10, %r11
shrq $0x7, %r9
xorq %r11, %r9
addq (%rsp,%rcx,8), %r8
addq %r9, %r8
movq %r8, 0x80(%rsp,%rcx,8)
incq %rcx
cmpq $0x40, %rcx
jne 0x4529
xorl %ecx, %ecx
movq -0x60(%rsp), %r9
movq %r9, %r8
rolq $0x32, %r8
movq %r9, %r10
rolq $0x2e, %r10
xorq %r8, %r10
movq %r9, %r11
rolq $0x17, %r11
xorq %r10, %r11
movq -0x58(%rsp), %r8
andq %r9, %r8
notq %r9
andq -0x50(%rsp), %r9
addq -0x48(%rsp), %r8
addq %r11, %r8
movq -0x80(%rsp), %rbx
movq -0x78(%rsp), %r10
movq %rbx, %r14
movq %rbx, %r11
movq -0x70(%rsp), %r15
movq %r15, %r12
xorq %r10, %r12
andq %rbx, %r12
rolq $0x24, %rbx
addq %r9, %r8
rolq $0x1e, %r14
xorq %rbx, %r14
movaps -0x50(%rsp), %xmm0
movaps %xmm0, -0x10(%rsp)
movaps -0x70(%rsp), %xmm0
movaps %xmm0, -0x30(%rsp)
movaps -0x60(%rsp), %xmm0
movaps %xmm0, -0x20(%rsp)
movaps -0x80(%rsp), %xmm0
movaps %xmm0, -0x40(%rsp)
addq (%rax,%rcx,8), %r8
addq (%rsp,%rcx,8), %r8
rolq $0x19, %r11
xorq %r14, %r11
andq %r10, %r15
xorq %r12, %r15
addq %r11, %r15
addq %r8, %r15
movq %r15, -0x8(%rsp)
addq %r8, -0x28(%rsp)
movl $0x1, %r8d
movq -0x48(%rsp,%r8,8), %r9
movl %r8d, %r10d
andl $0x7, %r10d
movq %r9, -0x80(%rsp,%r10,8)
incq %r8
cmpq $0x9, %r8
jne 0x4638
incq %rcx
cmpq $0x50, %rcx
jne 0x4581
xorl %ecx, %ecx
movq -0x80(%rsp,%rcx,8), %r8
addq (%rdi,%rcx,8), %r8
movq %r8, -0x80(%rsp,%rcx,8)
movq %r8, (%rdi,%rcx,8)
incq %rcx
cmpq $0x8, %rcx
jne 0x4661
subq $-0x80, %rsi
addq $-0x80, %rdx
cmpq $0x7f, %rdx
ja 0x44f2
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)