// File: /workspace/github_c_makefile_star2_O1/LoupVaillant[P]Monocypher-Utils/src/sha512.c
// Function: sha512_compress
static void sha512_compress(crypto_sha512_ctx *ctx)
{
    u64 *w = ctx->w;
    FOR(i,  0, 16) { w[i] = ctx->input[i]; }
    FOR(i, 16, 80) { w[i] = (lit_sigma1(w[i- 2]) + w[i- 7] +
                             lit_sigma0(w[i-15]) + w[i-16]); }

    u64 a = ctx->hash[0];    u64 b = ctx->hash[1];
    u64 c = ctx->hash[2];    u64 d = ctx->hash[3];
    u64 e = ctx->hash[4];    u64 f = ctx->hash[5];
    u64 g = ctx->hash[6];    u64 h = ctx->hash[7];
    FOR(i, 0, 80) {
        u64 t1 = big_sigma1(e) + ch (e, f, g) + h + K[i] + w[i];
        u64 t2 = big_sigma0(a) + maj(a, b, c);
        h = g;  g = f;  f = e;  e = d  + t1;
        d = c;  c = b;  b = a;  a = t1 + t2;
    }
    ctx->hash[0] += a;    ctx->hash[1] += b;
    ctx->hash[2] += c;    ctx->hash[3] += d;
    ctx->hash[4] += e;    ctx->hash[5] += f;
    ctx->hash[6] += g;    ctx->hash[7] += h;
}

// Assembly:
movq %rdi, %r8
leaq 0x2c0(%rdi), %rsi
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
xorl %ecx, %ecx
movq 0x70(%r8,%rcx,8), %rax
movq %rax, %rdx
rolq $0x2d, %rdx
movq %rax, %rsi
rolq $0x3, %rsi
xorq %rdx, %rsi
shrq $0x6, %rax
xorq %rsi, %rax
addq 0x48(%r8,%rcx,8), %rax
movq 0x8(%r8,%rcx,8), %rdx
movq %rdx, %rsi
rorq %rsi
movq %rdx, %rdi
rolq $0x38, %rdi
xorq %rsi, %rdi
shrq $0x7, %rdx
xorq %rdi, %rdx
addq (%r8,%rcx,8), %rax
addq %rdx, %rax
movq %rax, 0x80(%r8,%rcx,8)
incq %rcx
cmpq $0x40, %rcx
jne 0x8890
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x280(%r8), %r11
movq 0x288(%r8), %r10
movq 0x290(%r8), %rax
movq 0x298(%r8), %rcx
movq 0x2a0(%r8), %rbp
movq 0x2a8(%r8), %rbx
movq 0x2b0(%r8), %r12
movq %r8, -0x48(%rsp)
movq 0x2b8(%r8), %r13
xorl %r14d, %r14d
movq %r13, -0x8(%rsp)
movq %r12, -0x10(%rsp)
movq %rbx, -0x18(%rsp)
movq %rbp, -0x20(%rsp)
movq %rcx, -0x28(%rsp)
movq %rax, -0x30(%rsp)
movq %rax, %r8
movq %r10, -0x38(%rsp)
movq %r11, -0x40(%rsp)
movq %rbp, %rax
movq %rbp, %rdx
rolq $0x32, %rdx
movq %rbx, %r15
movq %rbp, %rdi
rolq $0x2e, %rdi
movq %r12, %rsi
movq %rbp, %r9
rolq $0x17, %r9
xorq %rdx, %rdi
xorq %rdi, %r9
movq %rbx, %r12
xorq %rsi, %r12
andq %rbp, %r12
xorq %rsi, %r12
addq %r13, %r12
addq %r9, %r12
leaq 0x16a8(%rip), %rdx      # 0xa040
addq (%r14,%rdx), %r12
movq -0x48(%rsp), %rdx
addq (%rdx,%r14), %r12
movq %r11, %rdi
rolq $0x24, %r11
movq %r10, %r9
movq %rdi, %r10
rolq $0x1e, %r10
movq %r8, %rdx
movq %rdi, %r8
rolq $0x19, %r8
xorq %r11, %r10
xorq %r10, %r8
movq %rdx, %r10
xorq %r9, %r10
andq %rdi, %r10
movq %rdx, %r11
andq %r9, %r11
xorq %r10, %r11
addq %r8, %r11
movq %rcx, %rbp
addq %r12, %rbp
addq %r12, %r11
addq $0x8, %r14
movq %rsi, %r13
movq %rbx, %r12
movq %rax, %rbx
movq %rdx, %rcx
movq %r9, %r8
movq %rdi, %r10
cmpq $0x280, %r14            # imm = 0x280
jne 0x895b
addq -0x40(%rsp), %r11
movq -0x48(%rsp), %rcx
movq %r11, 0x280(%rcx)
addq -0x38(%rsp), %rdi
movq %rdi, 0x288(%rcx)
addq -0x30(%rsp), %r9
movq %r9, 0x290(%rcx)
addq -0x28(%rsp), %rdx
movq %rdx, 0x298(%rcx)
addq -0x20(%rsp), %rbp
movq %rbp, 0x2a0(%rcx)
addq -0x18(%rsp), %rax
movq %rax, 0x2a8(%rcx)
addq -0x10(%rsp), %r15
movq %r15, 0x2b0(%rcx)
addq -0x8(%rsp), %rsi
movq %rsi, 0x2b8(%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq