// File: /workspace/github_c_makefile_star2_O1/ls4154[P]hash-c/sha224.c
// Function: sha224_iterate
static void _sha224_iterate(struct sha224_ctx *ctx, byte_t *chunk)
{
	word_t w[64];

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

	for (int i = 16; i < 64; ++i) {
		word_t s0 = ROR(w[i - 15], 7) ^ ROR(w[i - 15], 18) ^ SHR(w[i - 15], 3);
		word_t s1 = ROR(w[i - 2], 17) ^ ROR(w[i - 2], 19) ^ SHR(w[i - 2], 10);
		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 < 64; ++i) {
		word_t s1 = ROR(e, 6) ^ ROR(e, 11) ^ ROR(e, 25);
		word_t ch = (e & f) ^ ((~e) & g);
		word_t tmp1 = h + s1 + ch + k[i] + w[i];
		word_t s0 = ROR(a, 2) ^ ROR(a, 13) ^ ROR(a, 22);
		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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
xorl %eax, %eax
movl $0x0, -0x60(%rsp,%rax,4)
movl $0x18, %ecx
xorl %r8d, %r8d
xorl %edx, %edx
movzbl (%rsi,%r8), %r9d
shll %cl, %r9d
orl %r9d, %edx
incq %r8
addl $-0x8, %ecx
cmpq $0x4, %r8
jne 0x130b
movl %edx, -0x60(%rsp,%rax,4)
incq %rax
addq $0x4, %rsi
cmpq $0x10, %rax
jne 0x12f9
movl $0x10, %eax
movl -0x9c(%rsp,%rax,4), %ecx
movl %ecx, %edx
roll $0x19, %edx
movl -0x68(%rsp,%rax,4), %esi
movl %ecx, %r8d
roll $0xe, %r8d
xorl %edx, %r8d
movl %esi, %edx
roll $0xf, %edx
shrl $0x3, %ecx
movl %esi, %r9d
roll $0xd, %r9d
xorl %r8d, %ecx
xorl %edx, %r9d
shrl $0xa, %esi
xorl %r9d, %esi
addl -0xa0(%rsp,%rax,4), %ecx
addl -0x7c(%rsp,%rax,4), %ecx
addl %esi, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
cmpq $0x40, %rax
jne 0x1338
movl (%rdi), %r11d
movl 0x4(%rdi), %r12d
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %r9d
movl 0x10(%rdi), %r8d
movl 0x14(%rdi), %ebp
movl 0x18(%rdi), %ebx
movl 0x1c(%rdi), %r15d
xorl %r14d, %r14d
leaq 0xca3(%rip), %r13       # 0x2050
movl %r11d, -0x80(%rsp)
movl %r12d, -0x7c(%rsp)
movl %r15d, -0x64(%rsp)
movl %ebx, -0x68(%rsp)
movl %ebp, -0x6c(%rsp)
movl %r8d, -0x70(%rsp)
movl %r9d, -0x74(%rsp)
movl %ecx, -0x78(%rsp)
movl %ecx, %edx
movl %r8d, %eax
movl %ebp, %r10d
roll $0x1a, %r8d
movl %ebx, %esi
movl %eax, %ebx
roll $0x15, %ebx
movl %r12d, %ecx
movl %eax, %ebp
roll $0x7, %ebp
xorl %r8d, %ebx
xorl %ebx, %ebp
movl %r10d, %ebx
xorl %esi, %ebx
andl %eax, %ebx
xorl %esi, %ebx
addl %r15d, %ebx
addl %ebp, %ebx
addl (%r14,%r13), %ebx
addl -0x60(%rsp,%r14), %ebx
movl %r11d, %r12d
movl %r11d, %r8d
roll $0x1e, %r8d
roll $0x13, %r11d
xorl %r8d, %r11d
movl %r12d, %r8d
roll $0xa, %r8d
xorl %r11d, %r8d
movl %ecx, %ebp
xorl %edx, %ebp
andl %r12d, %ebp
movl %ecx, %r11d
andl %edx, %r11d
xorl %ebp, %r11d
addl %r8d, %r11d
movl %r9d, %r8d
addl %ebx, %r8d
addl %ebx, %r11d
addq $0x4, %r14
movl %esi, %r15d
movl %r10d, %ebx
movl %eax, %ebp
movl %edx, %r9d
cmpq $0x100, %r14            # imm = 0x100
jne 0x13d2
addl -0x80(%rsp), %r11d
movl %r11d, (%rdi)
addl -0x7c(%rsp), %r12d
movl %r12d, 0x4(%rdi)
addl -0x78(%rsp), %ecx
movl %ecx, 0x8(%rdi)
addl -0x74(%rsp), %edx
movl %edx, 0xc(%rdi)
addl -0x70(%rsp), %r8d
movl %r8d, 0x10(%rdi)
addl -0x6c(%rsp), %eax
movl %eax, 0x14(%rdi)
addl -0x68(%rsp), %r10d
movl %r10d, 0x18(%rdi)
addl -0x64(%rsp), %esi
movl %esi, 0x1c(%rdi)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq