// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/omdsha512k128n128tau128v2/ref/sha512.c
// Function: sha512_comp
void sha512_comp (hashblock res, const hashblock hash, const messageblock in)
	{
	const uint64_t *W=in;
	uint64_t	a,b,c,d,e,f,g,h,s0,s1,T1,T2;
	uint64_t	X[16];
	uint64_t  H[8];
	int i;

   for (i = 0; i < SHA512_DIGEST_LENGTH/8; i++) {
	   H[i]=PULL64(hash[i*8]);
	}


	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++)
		{
#ifdef B_ENDIAN
		T1 = X[i] = W[i];
#else
		T1 = X[i] = PULL64(W[i]);
#endif
		T1 += h + Sigma1(e) + Ch(e,f,g) + K512[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<80;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) + K512[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 < SHA512_DIGEST_LENGTH/8; i++) {
	   PUSH64(H[i],res[i*8]);
	}

	}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movl $0x0, -0x74(%rsp)
cmpl $0x8, -0x74(%rsp)
jge 0x246a
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
shlq $0x38, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x1(%rax,%rdx), %eax
shlq $0x30, %rax
orq %rax, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x2(%rax,%rdx), %eax
shlq $0x28, %rax
orq %rax, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x3(%rax,%rdx), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x4(%rax,%rdx), %eax
shlq $0x18, %rax
orq %rax, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x5(%rax,%rdx), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x6(%rax,%rdx), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq 0xc8(%rsp), %rax
movl -0x74(%rsp), %edx
shll $0x3, %edx
movslq %edx, %rdx
movzbl 0x7(%rax,%rdx), %eax
shlq $0x0, %rax
orq %rax, %rcx
movslq -0x74(%rsp), %rax
movq %rcx, -0x70(%rsp,%rax,8)
movl -0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rsp)
jmp 0x2357
movq -0x70(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq -0x68(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq -0x60(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq -0x58(%rsp), %rax
movq %rax, 0x98(%rsp)
movq -0x50(%rsp), %rax
movq %rax, 0x90(%rsp)
movq -0x48(%rsp), %rax
movq %rax, 0x88(%rsp)
movq -0x40(%rsp), %rax
movq %rax, 0x80(%rsp)
movq -0x38(%rsp), %rax
movq %rax, 0x78(%rsp)
movl $0x0, -0x74(%rsp)
cmpl $0x10, -0x74(%rsp)
jge 0x2781
movq 0xb8(%rsp), %rax
movslq -0x74(%rsp), %rcx
movzbl (%rax,%rcx,8), %eax
shlq $0x38, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x1(%rcx,%rdx,8), %ecx
shlq $0x30, %rcx
orq %rcx, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x2(%rcx,%rdx,8), %ecx
shlq $0x28, %rcx
orq %rcx, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x3(%rcx,%rdx,8), %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x4(%rcx,%rdx,8), %ecx
shlq $0x18, %rcx
orq %rcx, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x5(%rcx,%rdx,8), %ecx
shlq $0x10, %rcx
orq %rcx, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x6(%rcx,%rdx,8), %ecx
shlq $0x8, %rcx
orq %rcx, %rax
movq 0xb8(%rsp), %rcx
movslq -0x74(%rsp), %rdx
movzbl 0x7(%rcx,%rdx,8), %ecx
shlq $0x0, %rcx
orq %rcx, %rax
movslq -0x74(%rsp), %rcx
movq %rax, -0x30(%rsp,%rcx,8)
movq %rax, 0x60(%rsp)
movq 0x78(%rsp), %rax
movq 0x90(%rsp), %rcx
shrq $0xe, %rcx
movq 0x90(%rsp), %rdx
shlq $0x32, %rdx
orq %rdx, %rcx
movq 0x90(%rsp), %rdx
shrq $0x12, %rdx
movq 0x90(%rsp), %rsi
shlq $0x2e, %rsi
orq %rsi, %rdx
xorq %rdx, %rcx
movq 0x90(%rsp), %rdx
shrq $0x29, %rdx
movq 0x90(%rsp), %rsi
shlq $0x17, %rsi
orq %rsi, %rdx
xorq %rdx, %rcx
addq %rcx, %rax
movq 0x90(%rsp), %rcx
andq 0x88(%rsp), %rcx
movq 0x90(%rsp), %rdx
xorq $-0x1, %rdx
andq 0x80(%rsp), %rdx
xorq %rdx, %rcx
addq %rcx, %rax
movslq -0x74(%rsp), %rdx
leaq 0xa36(%rip), %rcx       # 0x3080
addq (%rcx,%rdx,8), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xb0(%rsp), %rax
shrq $0x1c, %rax
movq 0xb0(%rsp), %rcx
shlq $0x24, %rcx
orq %rcx, %rax
movq 0xb0(%rsp), %rcx
shrq $0x22, %rcx
movq 0xb0(%rsp), %rdx
shlq $0x1e, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq 0xb0(%rsp), %rcx
shrq $0x27, %rcx
movq 0xb0(%rsp), %rdx
shlq $0x19, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq 0xb0(%rsp), %rcx
andq 0xa8(%rsp), %rcx
movq 0xb0(%rsp), %rdx
andq 0xa0(%rsp), %rdx
xorq %rdx, %rcx
movq 0xa8(%rsp), %rdx
andq 0xa0(%rsp), %rdx
xorq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x98(%rsp), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x60(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl -0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rsp)
jmp 0x24d7
jmp 0x2783
cmpl $0x50, -0x74(%rsp)
jge 0x2a36
movl -0x74(%rsp), %eax
addl $0x1, %eax
andl $0xf, %eax
cltq
movq -0x30(%rsp,%rax,8), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
shrq %rax
movq 0x70(%rsp), %rcx
shlq $0x3f, %rcx
orq %rcx, %rax
movq 0x70(%rsp), %rcx
shrq $0x8, %rcx
movq 0x70(%rsp), %rdx
shlq $0x38, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq 0x70(%rsp), %rcx
shrq $0x7, %rcx
xorq %rcx, %rax
movq %rax, 0x70(%rsp)
movl -0x74(%rsp), %eax
addl $0xe, %eax
andl $0xf, %eax
cltq
movq -0x30(%rsp,%rax,8), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
shrq $0x13, %rax
movq 0x68(%rsp), %rcx
shlq $0x2d, %rcx
orq %rcx, %rax
movq 0x68(%rsp), %rcx
shrq $0x3d, %rcx
movq 0x68(%rsp), %rdx
shlq $0x3, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq 0x68(%rsp), %rcx
shrq $0x6, %rcx
xorq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
addq 0x68(%rsp), %rax
movl -0x74(%rsp), %ecx
addl $0x9, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
addq -0x30(%rsp,%rcx,8), %rax
movl -0x74(%rsp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
addq -0x30(%rsp,%rcx,8), %rax
movq %rax, -0x30(%rsp,%rcx,8)
movq %rax, 0x60(%rsp)
movq 0x78(%rsp), %rax
movq 0x90(%rsp), %rcx
shrq $0xe, %rcx
movq 0x90(%rsp), %rdx
shlq $0x32, %rdx
orq %rdx, %rcx
movq 0x90(%rsp), %rdx
shrq $0x12, %rdx
movq 0x90(%rsp), %rsi
shlq $0x2e, %rsi
orq %rsi, %rdx
xorq %rdx, %rcx
movq 0x90(%rsp), %rdx
shrq $0x29, %rdx
movq 0x90(%rsp), %rsi
shlq $0x17, %rsi
orq %rsi, %rdx
xorq %rdx, %rcx
addq %rcx, %rax
movq 0x90(%rsp), %rcx
andq 0x88(%rsp), %rcx
movq 0x90(%rsp), %rdx
xorq $-0x1, %rdx
andq 0x80(%rsp), %rdx
xorq %rdx, %rcx
addq %rcx, %rax
movslq -0x74(%rsp), %rdx
leaq 0x781(%rip), %rcx       # 0x3080
addq (%rcx,%rdx,8), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xb0(%rsp), %rax
shrq $0x1c, %rax
movq 0xb0(%rsp), %rcx
shlq $0x24, %rcx
orq %rcx, %rax
movq 0xb0(%rsp), %rcx
shrq $0x22, %rcx
movq 0xb0(%rsp), %rdx
shlq $0x1e, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq 0xb0(%rsp), %rcx
shrq $0x27, %rcx
movq 0xb0(%rsp), %rdx
shlq $0x19, %rdx
orq %rdx, %rcx
xorq %rcx, %rax
movq 0xb0(%rsp), %rcx
andq 0xa8(%rsp), %rcx
movq 0xb0(%rsp), %rdx
andq 0xa0(%rsp), %rdx
xorq %rdx, %rcx
movq 0xa8(%rsp), %rdx
andq 0xa0(%rsp), %rdx
xorq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x98(%rsp), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x60(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl -0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rsp)
jmp 0x2783
movq 0xb0(%rsp), %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq 0xa8(%rsp), %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq 0xa0(%rsp), %rax
addq -0x60(%rsp), %rax
movq %rax, -0x60(%rsp)
movq 0x98(%rsp), %rax
addq -0x58(%rsp), %rax
movq %rax, -0x58(%rsp)
movq 0x90(%rsp), %rax
addq -0x50(%rsp), %rax
movq %rax, -0x50(%rsp)
movq 0x88(%rsp), %rax
addq -0x48(%rsp), %rax
movq %rax, -0x48(%rsp)
movq 0x80(%rsp), %rax
addq -0x40(%rsp), %rax
movq %rax, -0x40(%rsp)
movq 0x78(%rsp), %rax
addq -0x38(%rsp), %rax
movq %rax, -0x38(%rsp)
movl $0x0, -0x74(%rsp)
cmpl $0x8, -0x74(%rsp)
jge 0x2c45
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x38, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x30, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x1(%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x28, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x2(%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x20, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x3(%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x18, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x4(%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x10, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x5(%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x8, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x6(%rax,%rcx)
movslq -0x74(%rsp), %rax
movq -0x70(%rsp,%rax,8), %rax
shrq $0x0, %rax
andq $0xff, %rax
movb %al, %dl
movq 0xd0(%rsp), %rax
movl -0x74(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x7(%rax,%rcx)
movl -0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rsp)
jmp 0x2acb
addq $0xd8, %rsp
retq
nopl (%rax)