// File: /workspace/github_c_makefile_star2_O0/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha256_Transform
void sha256_Transform(const sha2_word32* state_in, const sha2_word32* data, sha2_word32* state_out) {
	sha2_word32	a, b, c, d, e, f, g, h, s0, s1;
	sha2_word32	T1, T2, W256[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];
	f = state_in[5];
	g = state_in[6];
	h = state_in[7];

	j = 0;
	do {
		/* Apply the SHA-256 compression function to update a..h with copy */
		T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
		T2 = Sigma0_256(a) + Maj(a, b, c);
		h = g;
		g = f;
		f = e;
		e = d + T1;
		d = c;
		c = b;
		b = a;
		a = T1 + T2;

		j++;
	} while (j < 16);

	do {
		/* Part of the message block expansion: */
		s0 = W256[(j+1)&0x0f];
		s0 = sigma0_256(s0);
		s1 = W256[(j+14)&0x0f];	
		s1 = sigma1_256(s1);

		/* Apply the SHA-256 compression function to update a..h */
		T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + 
		     (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
		T2 = Sigma0_256(a) + Maj(a, b, c);
		h = g;
		g = f;
		f = e;
		e = d + T1;
		d = c;
		c = b;
		b = a;
		a = T1 + T2;

		j++;
	} while (j < 64);

	/* 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;
	state_out[5] = state_in[5] + f;
	state_out[6] = state_in[6] + g;
	state_out[7] = state_in[7] + h;

	/* Clean up */
	a = b = c = d = e = f = g = h = T1 = T2 = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
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)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x38(%rbp), %eax
movl -0x2c(%rbp), %ecx
shrl $0x6, %ecx
movl -0x2c(%rbp), %edx
shll $0x1a, %edx
orl %edx, %ecx
movl -0x2c(%rbp), %edx
shrl $0xb, %edx
movl -0x2c(%rbp), %esi
shll $0x15, %esi
orl %esi, %edx
xorl %edx, %ecx
movl -0x2c(%rbp), %edx
shrl $0x19, %edx
movl -0x2c(%rbp), %esi
shll $0x7, %esi
orl %esi, %edx
xorl %edx, %ecx
addl %ecx, %eax
movl -0x2c(%rbp), %ecx
andl -0x30(%rbp), %ecx
movl -0x2c(%rbp), %edx
xorl $-0x1, %edx
andl -0x34(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
movslq -0x94(%rbp), %rdx
leaq 0x580f(%rip), %rcx      # 0xf090
addl (%rcx,%rdx,4), %eax
movq -0x10(%rbp), %rcx
movq %rcx, %rdx
addq $0x4, %rdx
movq %rdx, -0x10(%rbp)
movl (%rcx), %ecx
movslq -0x94(%rbp), %rdx
movl %ecx, -0x90(%rbp,%rdx,4)
addl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x2, %eax
movl -0x1c(%rbp), %ecx
shll $0x1e, %ecx
orl %ecx, %eax
movl -0x1c(%rbp), %ecx
shrl $0xd, %ecx
movl -0x1c(%rbp), %edx
shll $0x13, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x1c(%rbp), %ecx
shrl $0x16, %ecx
movl -0x1c(%rbp), %edx
shll $0xa, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x1c(%rbp), %ecx
andl -0x20(%rbp), %ecx
movl -0x1c(%rbp), %edx
andl -0x24(%rbp), %edx
xorl %edx, %ecx
movl -0x20(%rbp), %edx
andl -0x24(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x48(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x44(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
cmpl $0x10, -0x94(%rbp)
jl 0x982d
jmp 0x9945
movl -0x94(%rbp), %eax
addl $0x1, %eax
andl $0xf, %eax
cltq
movl -0x90(%rbp,%rax,4), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
shrl $0x7, %eax
movl -0x3c(%rbp), %ecx
shll $0x19, %ecx
orl %ecx, %eax
movl -0x3c(%rbp), %ecx
shrl $0x12, %ecx
movl -0x3c(%rbp), %edx
shll $0xe, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x3c(%rbp), %ecx
shrl $0x3, %ecx
xorl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x94(%rbp), %eax
addl $0xe, %eax
andl $0xf, %eax
cltq
movl -0x90(%rbp,%rax,4), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
shrl $0x11, %eax
movl -0x40(%rbp), %ecx
shll $0xf, %ecx
orl %ecx, %eax
movl -0x40(%rbp), %ecx
shrl $0x13, %ecx
movl -0x40(%rbp), %edx
shll $0xd, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x40(%rbp), %ecx
shrl $0xa, %ecx
xorl %ecx, %eax
movl %eax, -0x40(%rbp)
movl -0x38(%rbp), %eax
movl -0x2c(%rbp), %ecx
shrl $0x6, %ecx
movl -0x2c(%rbp), %edx
shll $0x1a, %edx
orl %edx, %ecx
movl -0x2c(%rbp), %edx
shrl $0xb, %edx
movl -0x2c(%rbp), %esi
shll $0x15, %esi
orl %esi, %edx
xorl %edx, %ecx
movl -0x2c(%rbp), %edx
shrl $0x19, %edx
movl -0x2c(%rbp), %esi
shll $0x7, %esi
orl %esi, %edx
xorl %edx, %ecx
addl %ecx, %eax
movl -0x2c(%rbp), %ecx
andl -0x30(%rbp), %ecx
movl -0x2c(%rbp), %edx
xorl $-0x1, %edx
andl -0x34(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
movslq -0x94(%rbp), %rdx
leaq 0x5675(%rip), %rcx      # 0xf090
addl (%rcx,%rdx,4), %eax
movl -0x40(%rbp), %ecx
movl -0x94(%rbp), %edx
addl $0x9, %edx
andl $0xf, %edx
movslq %edx, %rdx
addl -0x90(%rbp,%rdx,4), %ecx
addl -0x3c(%rbp), %ecx
movl -0x94(%rbp), %edx
andl $0xf, %edx
movslq %edx, %rdx
addl -0x90(%rbp,%rdx,4), %ecx
movl %ecx, -0x90(%rbp,%rdx,4)
addl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x2, %eax
movl -0x1c(%rbp), %ecx
shll $0x1e, %ecx
orl %ecx, %eax
movl -0x1c(%rbp), %ecx
shrl $0xd, %ecx
movl -0x1c(%rbp), %edx
shll $0x13, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x1c(%rbp), %ecx
shrl $0x16, %ecx
movl -0x1c(%rbp), %edx
shll $0xa, %edx
orl %edx, %ecx
xorl %ecx, %eax
movl -0x1c(%rbp), %ecx
andl -0x20(%rbp), %ecx
movl -0x1c(%rbp), %edx
andl -0x24(%rbp), %edx
xorl %edx, %ecx
movl -0x20(%rbp), %edx
andl -0x24(%rbp), %edx
xorl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x48(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x44(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
cmpl $0x40, -0x94(%rbp)
jl 0x9945
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)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
addl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
addl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %ecx
addl -0x38(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)