// File: /workspace/github_c_makefile_star2_O1/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
vmovdqu (%rsi), %ymm0
vpmovdb %ymm0, %xmm1
vpsrld $0x8, %ymm0, %ymm2
vpmovdb %ymm2, %xmm2
vpsrld $0x10, %ymm0, %ymm3
vpmovdb %ymm3, %xmm3
movq %rdx, -0x50(%rsp)
movq %rdi, -0x58(%rsp)
vpsrld $0x18, %ymm0, %ymm0
vpmovdb %ymm0, %xmm0
vpmovzxbd %xmm1, %ymm1    # ymm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero
vpslld $0x18, %ymm1, %ymm1
vpmovzxbd %xmm2, %ymm2    # ymm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero
vpslld $0x10, %ymm2, %ymm2
vpor %ymm1, %ymm2, %ymm1
vpmovzxbd %xmm3, %ymm2    # ymm2 = xmm3[0],zero,zero,zero,xmm3[1],zero,zero,zero,xmm3[2],zero,zero,zero,xmm3[3],zero,zero,zero,xmm3[4],zero,zero,zero,xmm3[5],zero,zero,zero,xmm3[6],zero,zero,zero,xmm3[7],zero,zero,zero
vpslld $0x8, %ymm2, %ymm2
vpmovzxbd %xmm0, %ymm0    # ymm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero
vpternlogd $0xfe, %ymm1, %ymm2, %ymm0
vmovd %xmm0, %r11d
vpextrd $0x1, %xmm0, %eax
vpextrd $0x2, %xmm0, %esi
vpextrd $0x3, %xmm0, %edx
vextracti128 $0x1, %ymm0, %xmm1
vmovd %xmm1, %r13d
vpextrd $0x1, %xmm1, %r14d
vpextrd $0x2, %xmm1, %ebp
vpextrd $0x3, %xmm1, %ebx
xorl %r9d, %r9d
movq -0x50(%rsp), %rcx
movl (%rcx,%r9), %edi
movbel %edi, -0x48(%rsp,%r9)
movl %eax, %r10d
movl %esi, %ecx
movl %r13d, %r12d
movl %r14d, %r15d
movl %ebp, %r8d
movl %r11d, %eax
bswapl %edi
rorxl $0x6, %r13d, %esi
rorxl $0xb, %r13d, %r11d
xorl %esi, %r11d
rorxl $0x19, %r13d, %ebp
xorl %r11d, %ebp
movl %r14d, %r11d
andl %r13d, %r11d
andnl %r8d, %r13d, %esi
orl %r11d, %esi
addl %ebx, %esi
addl %ebp, %esi
leaq 0x12e4(%rip), %r11      # 0x3040
addl (%r9,%r11), %esi
addl %edi, %esi
rorxl $0x2, %eax, %edi
rorxl $0xd, %eax, %r11d
xorl %edi, %r11d
rorxl $0x16, %eax, %edi
xorl %r11d, %edi
movl %ecx, %ebx
xorl %r10d, %ebx
andl %eax, %ebx
movl %ecx, %r11d
andl %r10d, %r11d
xorl %ebx, %r11d
addl %edi, %r11d
movl %edx, %r13d
addl %esi, %r13d
addl %esi, %r11d
addq $0x4, %r9
movl %r8d, %ebx
movl %r14d, %ebp
movl %r12d, %r14d
movl %ecx, %edx
movl %r10d, %esi
cmpq $0x40, %r9
jne 0x1d08
movl $0x1e, %edx
movl %eax, %esi
movl %r10d, %r9d
movl %r13d, %r14d
movl %r12d, %ebp
movl %r15d, %ebx
movl %r11d, %eax
leal -0xe(%rdx), %r11d
leal -0xd(%rdx), %edi
andl $0xf, %edi
movl -0x48(%rsp,%rdi,4), %r10d
rorxl $0x7, %r10d, %edi
rorxl $0x12, %r10d, %r15d
xorl %edi, %r15d
shrl $0x3, %r10d
xorl %r15d, %r10d
movl %edx, %edi
andl $0xf, %edi
movl -0x48(%rsp,%rdi,4), %edi
rorxl $0x11, %edi, %r15d
rorxl $0x13, %edi, %r12d
xorl %r15d, %r12d
shrl $0xa, %edi
leal -0x5(%rdx), %r15d
andl $0xf, %r15d
andl $0xf, %r11d
addl -0x48(%rsp,%r15,4), %r10d
addl -0x48(%rsp,%r11,4), %r10d
xorl %r12d, %edi
addl %edi, %r10d
movl %r10d, -0x48(%rsp,%r11,4)
rorxl $0x6, %r13d, %edi
rorxl $0xb, %r13d, %r11d
xorl %edi, %r11d
rorxl $0x19, %r13d, %r15d
xorl %r11d, %r15d
movl %ebp, %r11d
andl %r13d, %r11d
andnl %ebx, %r13d, %edi
orl %r11d, %edi
addl %r8d, %edi
addl %r15d, %edi
leaq 0x11e4(%rip), %r8       # 0x3040
addl -0x38(%r8,%rdx,4), %edi
addl %r10d, %edi
rorxl $0x2, %eax, %r8d
rorxl $0xd, %eax, %r10d
xorl %r8d, %r10d
rorxl $0x16, %eax, %r8d
xorl %r10d, %r8d
movl %r9d, %r10d
xorl %esi, %r10d
andl %eax, %r10d
movl %r9d, %r11d
andl %esi, %r11d
xorl %r10d, %r11d
addl %r8d, %r11d
movl %ecx, %r13d
addl %edi, %r13d
addl %edi, %r11d
incq %rdx
movl %ebx, %r8d
movl %ebp, %r15d
movl %r14d, %r12d
movl %r9d, %ecx
movl %esi, %r10d
cmpq $0x4e, %rdx
jne 0x1db7
vmovd %r13d, %xmm1
vpinsrd $0x1, %r14d, %xmm1, %xmm1
vpinsrd $0x2, %ebp, %xmm1, %xmm1
vpinsrd $0x3, %ebx, %xmm1, %xmm1
vmovd %r11d, %xmm2
vpinsrd $0x1, %eax, %xmm2, %xmm2
vpinsrd $0x2, %esi, %xmm2, %xmm2
vpinsrd $0x3, %r9d, %xmm2, %xmm2
vinserti128 $0x1, %xmm1, %ymm2, %ymm1
vpaddd %ymm0, %ymm1, %ymm0
vpsrld $0x18, %ymm0, %ymm1
vpsrld $0x10, %ymm0, %ymm2
vpsrld $0x8, %ymm0, %ymm3
vpmovdb %ymm2, %xmm2
vpmovdb %ymm1, %xmm1
vpunpcklbw %xmm2, %xmm1, %xmm1 # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
vpmovdb %ymm0, %xmm0
vpmovdb %ymm3, %xmm2
vpunpcklbw %xmm0, %xmm2, %xmm0 # xmm0 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
vpunpcklwd %xmm0, %xmm1, %xmm2 # xmm2 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
vpunpckhwd %xmm0, %xmm1, %xmm0 # xmm0 = xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
movq -0x58(%rsp), %rax
vmovdqu %xmm0, 0x10(%rax)
vmovdqu %xmm2, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
nopl (%rax)