// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %edx
cmpq $0x10, %rax
je 0x1308
xorl %r8d, %r8d
movl %edx, %ecx
xorl %r9d, %r9d
cmpq $0x4, %r8
je 0x12fa
movzbl (%rsi,%r8), %r10d
shll %cl, %r10d
orl %r10d, %r9d
incq %r8
addl $-0x8, %ecx
jmp 0x12e1
movl %r9d, -0x60(%rsp,%rax,4)
incq %rax
addq $0x4, %rsi
jmp 0x12d3
movabsq $0x10, %rax
cmpq $0x40, %rax
je 0x1361
movl -0x9c(%rsp,%rax,4), %ecx
movl %ecx, %edx
roll $0x19, %edx
movl %ecx, %esi
roll $0xe, %esi
movl -0x68(%rsp,%rax,4), %r8d
xorl %edx, %esi
shrl $0x3, %ecx
xorl %esi, %ecx
movl %r8d, %edx
roll $0xf, %edx
movl %r8d, %esi
roll $0xd, %esi
xorl %edx, %esi
shrl $0xa, %r8d
addl -0xa0(%rsp,%rax,4), %ecx
addl -0x7c(%rsp,%rax,4), %ecx
xorl %esi, %r8d
addl %r8d, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
jmp 0x1312
movl (%rdi), %r9d
movl 0x4(%rdi), %esi
movl 0x8(%rdi), %ebx
movl 0xc(%rdi), %r8d
movl 0x10(%rdi), %ecx
movl 0x14(%rdi), %r14d
movl 0x18(%rdi), %ebp
movl 0x1c(%rdi), %r11d
xorl %r13d, %r13d
leaq 0xcca(%rip), %rax       # 0x2050
movl %ebx, -0x78(%rsp)
movl %r8d, -0x74(%rsp)
movl %ecx, -0x70(%rsp)
movl %r14d, -0x6c(%rsp)
movl %ebp, -0x68(%rsp)
movl %r11d, -0x64(%rsp)
movl %esi, -0x7c(%rsp)
movl %r9d, -0x80(%rsp)
movl %ebp, %r12d
movl %r14d, %ebp
movl %ecx, %r14d
movl %ebx, %r15d
cmpq $0x100, %r13            # imm = 0x100
je 0x1438
movl %r14d, %ecx
roll $0x1a, %ecx
movl %r14d, %edx
roll $0x15, %edx
movl %r14d, %r10d
roll $0x7, %r10d
xorl %ecx, %edx
xorl %edx, %r10d
movl %ebp, %ecx
xorl %r12d, %ecx
andl %r14d, %ecx
xorl %r12d, %ecx
addl %ecx, %r11d
addl %r10d, %r11d
addl (%r13,%rax), %r11d
addl -0x60(%rsp,%r13), %r11d
movl %r9d, %r10d
movl %r9d, %ecx
movl %esi, %edx
movl %esi, %ebx
xorl %r15d, %esi
andl %r9d, %esi
andl %r15d, %edx
xorl %esi, %edx
movl %r9d, %esi
roll $0x1e, %r9d
roll $0x13, %r10d
xorl %r9d, %r10d
roll $0xa, %ecx
xorl %r10d, %ecx
addl %ecx, %edx
movl %r8d, %ecx
addl %r11d, %ecx
addl %r11d, %edx
addq $0x4, %r13
movl %r15d, %r8d
movl %r12d, %r11d
movl %edx, %r9d
jmp 0x13aa
addl -0x80(%rsp), %r9d
movl %r9d, (%rdi)
addl -0x7c(%rsp), %esi
movl %esi, 0x4(%rdi)
addl -0x78(%rsp), %r15d
movl %r15d, 0x8(%rdi)
addl -0x74(%rsp), %r8d
movl %r8d, 0xc(%rdi)
addl -0x70(%rsp), %r14d
movl %r14d, 0x10(%rdi)
addl -0x6c(%rsp), %ebp
movl %ebp, 0x14(%rdi)
addl -0x68(%rsp), %r12d
movl %r12d, 0x18(%rdi)
addl -0x64(%rsp), %r11d
movl %r11d, 0x1c(%rdi)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq