// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/omdsha256k256n104tau160v2/ref/sha256.c
// Function: sha256_comp
void sha256_comp (hashblock res, const hashblock hash, const void *in)
	{
	uint32_t a,b,c,d,e,f,g,h,s0,s1,T1,T2;
	uint32_t    H[8];
	uint32_t	X[16],l;
	int i;
	const unsigned char *data=in;

	for (i = 0; i < SHA256_DIGEST_LENGTH/4; i++) {
	   HOST_c2l(hash, H[i]);
	}

	a = H[0];	b = H[1];	c = H[2];	d = H[3];
	e = H[4];	f = H[5];	g = H[6];	h = H[7];

	for (i=0;i<16;i++)
		{
		HOST_c2l(data,l); T1 = X[i] = l;
		T1 += h + Sigma1(e) + Ch(e,f,g) + K256[i];
		T2 = Sigma0(a) + Maj(a,b,c);
		h = g;
		g = f;
		f = e;
		e = d + T1;
		d = c;	c = b;	b = a;	a = T1 + T2;
		}

	for (;i<64;i++)
		{
		s0 = X[(i+1)&0x0f];	s0 = sigma0(s0);
		s1 = X[(i+14)&0x0f];	s1 = sigma1(s1);

		T1 = X[i&0xf] += s0 + s1 + X[(i+9)&0xf];
		T1 += h + Sigma1(e) + Ch(e,f,g) + K256[i];
		T2 = Sigma0(a) + Maj(a,b,c);
		h = g;	g = f;	f = e;	e = d + T1;
		d = c;	c = b;	b = a;	a = T1 + T2;
		}

	H[0] += a;	H[1] += b;	H[2] += c;	H[3] += d;
	H[4] += e;	H[5] += f;	H[6] += g;	H[7] += h;

	for (i = 0; i < SHA256_DIGEST_LENGTH/4; i++) {
	   HOST_l2c(H[i], res);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rax
xorl %ecx, %ecx
cmpq $0x8, %rcx
je 0x1bc3
movl (%rsi,%rcx,4), %edx
movbel %edx, -0x80(%rsp,%rcx,4)
incq %rcx
jmp 0x1baf
movq %rdi, -0x38(%rsp)
movl -0x80(%rsp), %ebx
movl -0x7c(%rsp), %r10d
movl -0x78(%rsp), %r13d
movl -0x74(%rsp), %r11d
movl -0x70(%rsp), %r8d
movl -0x6c(%rsp), %ebp
movl -0x68(%rsp), %r15d
movl -0x64(%rsp), %r14d
xorl %esi, %esi
leaq 0x449(%rip), %rdi       # 0x2040
movl %r10d, -0x54(%rsp)
movl %r13d, -0x50(%rsp)
movl %r11d, -0x4c(%rsp)
movl %r8d, -0x48(%rsp)
movl %ebp, -0x44(%rsp)
movl %r15d, -0x40(%rsp)
movl %r14d, -0x3c(%rsp)
movl %ebx, -0x58(%rsp)
movl %r15d, %edx
movl %ebp, %r15d
movl %r8d, %ebp
movl %r13d, %r9d
movl %r10d, %r13d
cmpq $0x40, %rsi
je 0x1cbd
movl (%rax,%rsi), %r8d
movbel %r8d, -0x30(%rsp,%rsi)
bswapl %r8d
rorxl $0x6, %ebp, %r10d
rorxl $0xb, %ebp, %ecx
xorl %r10d, %ecx
rorxl $0x19, %ebp, %r10d
xorl %ecx, %r10d
movl %r15d, %ecx
andl %ebp, %ecx
andnl %edx, %ebp, %r12d
orl %ecx, %r12d
addl %r12d, %r14d
addl %r10d, %r14d
addl (%rsi,%rdi), %r14d
addl %r8d, %r14d
rorxl $0x2, %ebx, %ecx
rorxl $0xd, %ebx, %r8d
xorl %ecx, %r8d
rorxl $0x16, %ebx, %ecx
xorl %r8d, %ecx
movl %r9d, %r8d
xorl %r13d, %r8d
andl %ebx, %r8d
movl %ebx, %r10d
movl %r9d, %ebx
andl %r13d, %ebx
xorl %r8d, %ebx
addl %ecx, %ebx
movl %r11d, %r8d
addl %r14d, %r8d
addl %r14d, %ebx
addq $0x4, %rsi
movl %r9d, %r11d
movl %edx, %r14d
jmp 0x1c1d
movabsq $0x1e, %rsi
movl %edx, %r10d
movl %r15d, %edx
movl %ebp, %r15d
movl %r9d, %eax
movl %r13d, %r9d
cmpq $0x4e, %rsi
je 0x1db7
leaq -0xe(%rsi), %r13
leal -0xd(%rsi), %ecx
andl $0xf, %ecx
movl -0x30(%rsp,%rcx,4), %ebp
rorxl $0x7, %ebp, %ecx
rorxl $0x12, %ebp, %r8d
xorl %ecx, %r8d
shrl $0x3, %ebp
xorl %r8d, %ebp
movl %esi, %ecx
andl $0xf, %ecx
movl -0x30(%rsp,%rcx,4), %ecx
rorxl $0x11, %ecx, %r8d
rorxl $0x13, %ecx, %r12d
xorl %r8d, %r12d
shrl $0xa, %ecx
xorl %r12d, %ecx
leal -0x5(%rsi), %r8d
andl $0xf, %r8d
andl $0xf, %r13d
addl -0x30(%rsp,%r8,4), %ebp
addl -0x30(%rsp,%r13,4), %ebp
addl %ecx, %ebp
movl %ebp, -0x30(%rsp,%r13,4)
rorxl $0x6, %r15d, %ecx
rorxl $0xb, %r15d, %r8d
xorl %ecx, %r8d
rorxl $0x19, %r15d, %ecx
xorl %r8d, %ecx
movl %edx, %r8d
andl %r15d, %r8d
andnl %r10d, %r15d, %r12d
orl %r8d, %r12d
addl %r12d, %r14d
addl %ecx, %r14d
addl -0x38(%rdi,%rsi,4), %r14d
addl %ebp, %r14d
rorxl $0x2, %ebx, %ecx
rorxl $0xd, %ebx, %r8d
xorl %ecx, %r8d
rorxl $0x16, %ebx, %ecx
xorl %r8d, %ecx
movl %eax, %r8d
xorl %r9d, %r8d
andl %ebx, %r8d
movl %ebx, %r13d
movl %eax, %ebx
andl %r9d, %ebx
xorl %r8d, %ebx
addl %ecx, %ebx
movl %r11d, %ebp
addl %r14d, %ebp
addl %r14d, %ebx
incq %rsi
movl %eax, %r11d
movl %r10d, %r14d
jmp 0x1cc7
addl -0x58(%rsp), %ebx
movl %ebx, -0x80(%rsp)
addl -0x54(%rsp), %r9d
movl %r9d, -0x7c(%rsp)
addl -0x50(%rsp), %eax
movl %eax, -0x78(%rsp)
addl -0x4c(%rsp), %r11d
movl %r11d, -0x74(%rsp)
addl -0x48(%rsp), %r15d
movl %r15d, -0x70(%rsp)
addl -0x44(%rsp), %edx
movl %edx, -0x6c(%rsp)
addl -0x40(%rsp), %r10d
movl %r10d, -0x68(%rsp)
addl -0x3c(%rsp), %r14d
movl %r14d, -0x64(%rsp)
xorl %eax, %eax
movq -0x38(%rsp), %rdx
cmpq $0x8, %rax
je 0x1e1c
movl -0x80(%rsp,%rax,4), %ecx
movbel %ecx, (%rdx,%rax,4)
incq %rax
jmp 0x1e08
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop