// File: /workspace/github_c_makefile_star2_O0/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha1_Transform
void sha1_Transform(const sha2_word32* state_in, const sha2_word32* data, sha2_word32* state_out) {
	sha2_word32	a, b, c, d, e;
	sha2_word32	T1;
	sha2_word32	W1[16];
	int		j;

	/* Initialize registers with the prev. intermediate value */
	a = state_in[0];
	b = state_in[1];
	c = state_in[2];
	d = state_in[3];
	e = state_in[4];
	j = 0;
	do {
		T1 = ROTL32(5, a) + Ch(b, c, d) + e + K1_0_TO_19 + (W1[j] = *data++);
		e = d;
		d = c;
		c = ROTL32(30, b);
		b = a;
		a = T1;
		j++;
	} while (j < 16);

	do {
		T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
		T1 = ROTL32(5, a) + Ch(b,c,d) + e + K1_0_TO_19 + (W1[j&0x0f] = ROTL32(1, T1));
		e = d;
		d = c;
		c = ROTL32(30, b);
		b = a;
		a = T1;
		j++;
	} while (j < 20);

	do {
		T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
		T1 = ROTL32(5, a) + Parity(b,c,d) + e + K1_20_TO_39 + (W1[j&0x0f] = ROTL32(1, T1));
		e = d;
		d = c;
		c = ROTL32(30, b);
		b = a;
		a = T1;
		j++;
	} while (j < 40);

	do {
		T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
		T1 = ROTL32(5, a) + Maj(b,c,d) + e + K1_40_TO_59 + (W1[j&0x0f] = ROTL32(1, T1));
		e = d;
		d = c;
		c = ROTL32(30, b);
		b = a;
		a = T1;
		j++;
	} while (j < 60);

	do {
		T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
		T1 = ROTL32(5, a) + Parity(b,c,d) + e + K1_60_TO_79 + (W1[j&0x0f] = ROTL32(1, T1));
		e = d;
		d = c;
		c = ROTL32(30, b);
		b = a;
		a = T1;
		j++;
	} while (j < 80);


	/* Compute the current intermediate hash value */
	state_out[0] = state_in[0] + a;
	state_out[1] = state_in[1] + b;
	state_out[2] = state_in[2] + c;
	state_out[3] = state_in[3] + d;
	state_out[4] = state_in[4] + e;

	/* Clean up */
	a = b = c = d = e = T1 = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl -0x1c(%rbp), %ecx
shrl $0x1b, %ecx
orl %ecx, %eax
movl -0x20(%rbp), %ecx
andl -0x24(%rbp), %ecx
movl -0x20(%rbp), %edx
xorl $-0x1, %edx
andl -0x28(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
addq $0x5a827999, %rax       # imm = 0x5A827999
movq -0x10(%rbp), %rcx
movq %rcx, %rdx
addq $0x4, %rdx
movq %rdx, -0x10(%rbp)
movl (%rcx), %ecx
movslq -0x74(%rbp), %rdx
movl %ecx, -0x70(%rbp,%rdx,4)
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
shll $0x1e, %eax
movl -0x20(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x10, -0x74(%rbp)
jl 0x8c98
jmp 0x8d23
movl -0x74(%rbp), %eax
addl $0xd, %eax
andl $0xf, %eax
cltq
movl -0x70(%rbp,%rax,4), %eax
movl -0x74(%rbp), %ecx
addl $0x8, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
addl $0x2, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl -0x1c(%rbp), %ecx
shrl $0x1b, %ecx
orl %ecx, %eax
movl -0x20(%rbp), %ecx
andl -0x24(%rbp), %ecx
movl -0x20(%rbp), %edx
xorl $-0x1, %edx
andl -0x28(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
addq $0x5a827999, %rax       # imm = 0x5A827999
movl -0x30(%rbp), %ecx
shll %ecx
movl -0x30(%rbp), %edx
shrl $0x1f, %edx
orl %edx, %ecx
movl -0x74(%rbp), %edx
andl $0xf, %edx
movslq %edx, %rdx
movl %ecx, -0x70(%rbp,%rdx,4)
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
shll $0x1e, %eax
movl -0x20(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x14, -0x74(%rbp)
jl 0x8d23
jmp 0x8dee
movl -0x74(%rbp), %eax
addl $0xd, %eax
andl $0xf, %eax
cltq
movl -0x70(%rbp,%rax,4), %eax
movl -0x74(%rbp), %ecx
addl $0x8, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
addl $0x2, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl -0x1c(%rbp), %ecx
shrl $0x1b, %ecx
orl %ecx, %eax
movl -0x20(%rbp), %ecx
xorl -0x24(%rbp), %ecx
xorl -0x28(%rbp), %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
addq $0x6ed9eba1, %rax       # imm = 0x6ED9EBA1
movl -0x30(%rbp), %ecx
shll %ecx
movl -0x30(%rbp), %edx
shrl $0x1f, %edx
orl %edx, %ecx
movl -0x74(%rbp), %edx
andl $0xf, %edx
movslq %edx, %rdx
movl %ecx, -0x70(%rbp,%rdx,4)
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
shll $0x1e, %eax
movl -0x20(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x28, -0x74(%rbp)
jl 0x8dee
jmp 0x8eb1
movl -0x74(%rbp), %eax
addl $0xd, %eax
andl $0xf, %eax
cltq
movl -0x70(%rbp,%rax,4), %eax
movl -0x74(%rbp), %ecx
addl $0x8, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
addl $0x2, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl -0x1c(%rbp), %ecx
shrl $0x1b, %ecx
orl %ecx, %eax
movl -0x20(%rbp), %ecx
andl -0x24(%rbp), %ecx
movl -0x20(%rbp), %edx
andl -0x28(%rbp), %edx
xorl %edx, %ecx
movl -0x24(%rbp), %edx
andl -0x28(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
movabsq $0x8f1bbcdc, %rcx       # imm = 0x8F1BBCDC
addq %rcx, %rax
movl -0x30(%rbp), %ecx
shll %ecx
movl -0x30(%rbp), %edx
shrl $0x1f, %edx
orl %edx, %ecx
movl -0x74(%rbp), %edx
andl $0xf, %edx
movslq %edx, %rdx
movl %ecx, -0x70(%rbp,%rdx,4)
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
shll $0x1e, %eax
movl -0x20(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x3c, -0x74(%rbp)
jl 0x8eb1
jmp 0x8f88
movl -0x74(%rbp), %eax
addl $0xd, %eax
andl $0xf, %eax
cltq
movl -0x70(%rbp,%rax,4), %eax
movl -0x74(%rbp), %ecx
addl $0x8, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
addl $0x2, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl -0x74(%rbp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
xorl -0x70(%rbp,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl -0x1c(%rbp), %ecx
shrl $0x1b, %ecx
orl %ecx, %eax
movl -0x20(%rbp), %ecx
xorl -0x24(%rbp), %ecx
xorl -0x28(%rbp), %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
movabsq $0xca62c1d6, %rcx       # imm = 0xCA62C1D6
addq %rcx, %rax
movl -0x30(%rbp), %ecx
shll %ecx
movl -0x30(%rbp), %edx
shrl $0x1f, %edx
orl %edx, %ecx
movl -0x74(%rbp), %edx
andl $0xf, %edx
movslq %edx, %rdx
movl %ecx, -0x70(%rbp,%rdx,4)
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
shll $0x1e, %eax
movl -0x20(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x50, -0x74(%rbp)
jl 0x8f88
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
addl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
addl -0x28(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
addl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
popq %rbp
retq
nop