// File: /workspace/github_c_makefile_star2_O0/ls4154[P]hash-c/sha1.c
// Function: sha1_iterate
static void _sha1_iterate(struct sha1_ctx *ctx, byte_t *chunk)
{
	word_t w[80];

	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);
	}

#ifdef SHA0
	for (int i = 16; i < 80; ++i)
		w[i] = w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16];
#else
	for (int i = 16; i < 80; ++i)
		w[i] = ROL(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);
#endif

	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];

	for (int i = 0; i < 80; ++i) {
		word_t tmp;
		word_t k;

		switch (i / 20) {
		case 0:
			tmp = (b & c) | ((~b) & d);
			k = 0x5a827999;
			break;
		case 1:
			tmp = b ^ c ^ d;
			k = 0x6ed9eba1;
			break;
		case 2:
			tmp = (b & c) | (b & d) | (c & d);
			k = 0x8f1bbcdc;
			break;
		default :
			tmp = b ^ c ^ d;
			k = 0xca62c1d6;
		}
		tmp += ROL(a, 5) + e + k + w[i];
		e = d;
		d = c;
		c = ROL(b, 30);
		b = a;
		a = tmp;
	}

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x154(%rbp)
cmpl $0x10, -0x154(%rbp)
jge 0x141b
movslq -0x154(%rbp), %rax
movl $0x0, -0x150(%rbp,%rax,4)
movl $0x0, -0x158(%rbp)
cmpl $0x4, -0x158(%rbp)
jge 0x1405
movq -0x10(%rbp), %rax
movl -0x154(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x158(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl $0x3, %ecx
subl -0x158(%rbp), %ecx
shll $0x3, %ecx
shll %cl, %eax
movl %eax, %ecx
movslq -0x154(%rbp), %rax
orl -0x150(%rbp,%rax,4), %ecx
movl %ecx, -0x150(%rbp,%rax,4)
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x13a6
jmp 0x1407
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0x137d
movl $0x10, -0x15c(%rbp)
cmpl $0x50, -0x15c(%rbp)
jge 0x14ee
movl -0x15c(%rbp), %eax
subl $0x3, %eax
cltq
movl -0x150(%rbp,%rax,4), %ecx
movl -0x15c(%rbp), %eax
subl $0x8, %eax
cltq
xorl -0x150(%rbp,%rax,4), %ecx
movl -0x15c(%rbp), %eax
subl $0xe, %eax
cltq
xorl -0x150(%rbp,%rax,4), %ecx
movl -0x15c(%rbp), %eax
subl $0x10, %eax
cltq
xorl -0x150(%rbp,%rax,4), %ecx
shll %ecx
movl -0x15c(%rbp), %eax
subl $0x3, %eax
cltq
movl -0x150(%rbp,%rax,4), %eax
movl -0x15c(%rbp), %edx
subl $0x8, %edx
movslq %edx, %rdx
xorl -0x150(%rbp,%rdx,4), %eax
movl -0x15c(%rbp), %edx
subl $0xe, %edx
movslq %edx, %rdx
xorl -0x150(%rbp,%rdx,4), %eax
movl -0x15c(%rbp), %edx
subl $0x10, %edx
movslq %edx, %rdx
xorl -0x150(%rbp,%rdx,4), %eax
shrl $0x1f, %eax
orl %eax, %ecx
movslq -0x15c(%rbp), %rax
movl %ecx, -0x150(%rbp,%rax,4)
movl -0x15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x15c(%rbp)
jmp 0x1425
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x160(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x164(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x168(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x16c(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x170(%rbp)
movl $0x0, -0x174(%rbp)
cmpl $0x50, -0x174(%rbp)
jge 0x16d1
movslq -0x174(%rbp), %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rax
addl %ecx, %eax
movl %eax, -0x180(%rbp)
je 0x1587
jmp 0x156a
movl -0x180(%rbp), %eax
subl $0x1, %eax
je 0x15b9
jmp 0x1577
movl -0x180(%rbp), %eax
subl $0x2, %eax
je 0x15dd
jmp 0x1617
movl -0x164(%rbp), %eax
andl -0x168(%rbp), %eax
movl -0x164(%rbp), %ecx
xorl $-0x1, %ecx
andl -0x16c(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x178(%rbp)
movl $0x5a827999, -0x17c(%rbp) # imm = 0x5A827999
jmp 0x1639
movl -0x164(%rbp), %eax
xorl -0x168(%rbp), %eax
xorl -0x16c(%rbp), %eax
movl %eax, -0x178(%rbp)
movl $0x6ed9eba1, -0x17c(%rbp) # imm = 0x6ED9EBA1
jmp 0x1639
movl -0x164(%rbp), %eax
andl -0x168(%rbp), %eax
movl -0x164(%rbp), %ecx
andl -0x16c(%rbp), %ecx
orl %ecx, %eax
movl -0x168(%rbp), %ecx
andl -0x16c(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x178(%rbp)
movl $0x8f1bbcdc, -0x17c(%rbp) # imm = 0x8F1BBCDC
jmp 0x1639
movl -0x164(%rbp), %eax
xorl -0x168(%rbp), %eax
xorl -0x16c(%rbp), %eax
movl %eax, -0x178(%rbp)
movl $0xca62c1d6, -0x17c(%rbp) # imm = 0xCA62C1D6
movl -0x160(%rbp), %eax
shll $0x5, %eax
movl -0x160(%rbp), %ecx
shrl $0x1b, %ecx
orl %ecx, %eax
addl -0x170(%rbp), %eax
addl -0x17c(%rbp), %eax
movslq -0x174(%rbp), %rcx
addl -0x150(%rbp,%rcx,4), %eax
addl -0x178(%rbp), %eax
movl %eax, -0x178(%rbp)
movl -0x16c(%rbp), %eax
movl %eax, -0x170(%rbp)
movl -0x168(%rbp), %eax
movl %eax, -0x16c(%rbp)
movl -0x164(%rbp), %eax
shll $0x1e, %eax
movl -0x164(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movl %eax, -0x168(%rbp)
movl -0x160(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0x178(%rbp), %eax
movl %eax, -0x160(%rbp)
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
jmp 0x1538
movl -0x160(%rbp), %ecx
movq -0x8(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movl -0x164(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movl -0x168(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movl -0x16c(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl -0x170(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax,%rax)