// File: /workspace/github_c_makefile_star2_O0/ls4154[P]hash-c/sha512.c
// Function: sha512_iterate
static void _sha512_iterate(struct sha512_ctx *ctx, byte_t *chunk)
{
	word_t w[80];

	for (int i = 0; i < 16; ++i) {
		w[i] = 0;
		for (int j = 0; j < 8; ++j)
			w[i] |= (word_t)*(chunk + 8 * i + j) << 8 * (7 - j);
	}

	for (int i = 16; i < 80; ++i) {
		word_t s0 = ROR(w[i - 15], 1) ^ ROR(w[i - 15], 8) ^ SHR(w[i - 15], 7);
		word_t s1 = ROR(w[i - 2], 19) ^ ROR(w[i - 2], 61) ^ SHR(w[i - 2], 6);
		w[i] = w[i - 16] + s0 + w[i - 7] + s1;
	}

	word_t a = ctx->h[0];
	word_t b = ctx->h[1];
	word_t c = ctx->h[2];
	word_t d = ctx->h[3];
	word_t e = ctx->h[4];
	word_t f = ctx->h[5];
	word_t g = ctx->h[6];
	word_t h = ctx->h[7];

	for (int i = 0; i < 80; ++i) {
		word_t s1 = ROR(e, 14) ^ ROR(e, 18) ^ ROR(e, 41);
		word_t ch = (e & f) ^ ((~e) & g);
		word_t tmp1 = h + s1 + ch + k[i] + w[i];
		word_t s0 = ROR(a, 28) ^ ROR(a, 34) ^ ROR(a, 39);
		word_t maj = (a & b) ^ (a & c) ^ (b & c);
		word_t tmp2 = s0 + maj;

		h = g;
		g = f;
		f = e;
		e = d + tmp1;
		d = c;
		c = b;
		b = a;
		a = tmp1 + tmp2;
	}

	ctx->h[0] += a;
	ctx->h[1] += b;
	ctx->h[2] += c;
	ctx->h[3] += d;
	ctx->h[4] += e;
	ctx->h[5] += f;
	ctx->h[6] += g;
	ctx->h[7] += h;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x294(%rbp)
cmpl $0x10, -0x294(%rbp)
jge 0x1492
movslq -0x294(%rbp), %rax
movq $0x0, -0x290(%rbp,%rax,8)
movl $0x0, -0x298(%rbp)
cmpl $0x8, -0x298(%rbp)
jge 0x147c
movq -0x10(%rbp), %rax
movl -0x294(%rbp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x298(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl $0x7, %ecx
subl -0x298(%rbp), %ecx
shll $0x3, %ecx
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, %rcx
movslq -0x294(%rbp), %rax
orq -0x290(%rbp,%rax,8), %rcx
movq %rcx, -0x290(%rbp,%rax,8)
movl -0x298(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x298(%rbp)
jmp 0x1417
jmp 0x147e
movl -0x294(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x294(%rbp)
jmp 0x13ed
movl $0x10, -0x29c(%rbp)
cmpl $0x50, -0x29c(%rbp)
jge 0x1613
movl -0x29c(%rbp), %eax
subl $0xf, %eax
cltq
movq -0x290(%rbp,%rax,8), %rax
shrq %rax
movl -0x29c(%rbp), %ecx
subl $0xf, %ecx
movslq %ecx, %rcx
movq -0x290(%rbp,%rcx,8), %rcx
shlq $0x3f, %rcx
orq %rcx, %rax
movl -0x29c(%rbp), %ecx
subl $0xf, %ecx
movslq %ecx, %rcx
movq -0x290(%rbp,%rcx,8), %rcx
shrq $0x8, %rcx
movl -0x29c(%rbp), %edx
subl $0xf, %edx
movslq %edx, %rdx
movq -0x290(%rbp,%rdx,8), %rdx
shlq $0x38, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movl -0x29c(%rbp), %ecx
subl $0xf, %ecx
movslq %ecx, %rcx
movq -0x290(%rbp,%rcx,8), %rcx
shrq $0x7, %rcx
xorq %rcx, %rax
movq %rax, -0x2a8(%rbp)
movl -0x29c(%rbp), %eax
subl $0x2, %eax
cltq
movq -0x290(%rbp,%rax,8), %rax
shrq $0x13, %rax
movl -0x29c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq -0x290(%rbp,%rcx,8), %rcx
shlq $0x2d, %rcx
orq %rcx, %rax
movl -0x29c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq -0x290(%rbp,%rcx,8), %rcx
shrq $0x3d, %rcx
movl -0x29c(%rbp), %edx
subl $0x2, %edx
movslq %edx, %rdx
movq -0x290(%rbp,%rdx,8), %rdx
shlq $0x3, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movl -0x29c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq -0x290(%rbp,%rcx,8), %rcx
shrq $0x6, %rcx
xorq %rcx, %rax
movq %rax, -0x2b0(%rbp)
movl -0x29c(%rbp), %eax
subl $0x10, %eax
cltq
movq -0x290(%rbp,%rax,8), %rcx
addq -0x2a8(%rbp), %rcx
movl -0x29c(%rbp), %eax
subl $0x7, %eax
cltq
addq -0x290(%rbp,%rax,8), %rcx
addq -0x2b0(%rbp), %rcx
movslq -0x29c(%rbp), %rax
movq %rcx, -0x290(%rbp,%rax,8)
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0x149c
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2b8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2c0(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x2c8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x2d0(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x2d8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x2e0(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x2e8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x2f0(%rbp)
movl $0x0, -0x2f4(%rbp)
cmpl $0x50, -0x2f4(%rbp)
jge 0x1896
movq -0x2d8(%rbp), %rax
shrq $0xe, %rax
movq -0x2d8(%rbp), %rcx
shlq $0x32, %rcx
orq %rcx, %rax
movq -0x2d8(%rbp), %rcx
shrq $0x12, %rcx
movq -0x2d8(%rbp), %rdx
shlq $0x2e, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq -0x2d8(%rbp), %rcx
shrq $0x29, %rcx
movq -0x2d8(%rbp), %rdx
shlq $0x17, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq %rax, -0x300(%rbp)
movq -0x2d8(%rbp), %rax
andq -0x2e0(%rbp), %rax
movq -0x2d8(%rbp), %rcx
xorq $-0x1, %rcx
andq -0x2e8(%rbp), %rcx
xorq %rcx, %rax
movq %rax, -0x308(%rbp)
movq -0x2f0(%rbp), %rax
addq -0x300(%rbp), %rax
addq -0x308(%rbp), %rax
movslq -0x2f4(%rbp), %rdx
leaq 0x8ea(%rip), %rcx       # 0x2030
addq (%rcx,%rdx,8), %rax
movslq -0x2f4(%rbp), %rcx
addq -0x290(%rbp,%rcx,8), %rax
movq %rax, -0x310(%rbp)
movq -0x2b8(%rbp), %rax
shrq $0x1c, %rax
movq -0x2b8(%rbp), %rcx
shlq $0x24, %rcx
orq %rcx, %rax
movq -0x2b8(%rbp), %rcx
shrq $0x22, %rcx
movq -0x2b8(%rbp), %rdx
shlq $0x1e, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq -0x2b8(%rbp), %rcx
shrq $0x27, %rcx
movq -0x2b8(%rbp), %rdx
shlq $0x19, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq %rax, -0x318(%rbp)
movq -0x2b8(%rbp), %rax
andq -0x2c0(%rbp), %rax
movq -0x2b8(%rbp), %rcx
andq -0x2c8(%rbp), %rcx
xorq %rcx, %rax
movq -0x2c0(%rbp), %rcx
andq -0x2c8(%rbp), %rcx
xorq %rcx, %rax
movq %rax, -0x320(%rbp)
movq -0x318(%rbp), %rax
addq -0x320(%rbp), %rax
movq %rax, -0x328(%rbp)
movq -0x2e8(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq -0x2e0(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq -0x2d8(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movq -0x2d0(%rbp), %rax
addq -0x310(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x2c8(%rbp), %rax
movq %rax, -0x2d0(%rbp)
movq -0x2c0(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x2b8(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movq -0x310(%rbp), %rax
addq -0x328(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movl -0x2f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2f4(%rbp)
jmp 0x1694
movq -0x2b8(%rbp), %rcx
movq -0x8(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x2c0(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x2c8(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x2d0(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x2d8(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x2e0(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movq -0x2e8(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq -0x2f0(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
nopw %cs:(%rax,%rax)