// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/citrusleaf/cf_crypto.c
// Function: cf_SHA1ProcessMessageBlock
static void
cf_SHA1ProcessMessageBlock(cf_SHA1Context *context)
{
	const uint32_t K[] = {
			0x5A827999,
			0x6ED9EBA1,
			0x8F1BBCDC,
			0xCA62C1D6
	};

	int t;
	uint32_t temp;
	uint32_t W[80];
	uint32_t A, B, C, D, E;

	for (t = 0; t < 16; t++) {
		W[t] = (uint32_t)(context->Message_Block[t * 4]) << 24;
		W[t] |= (uint32_t)(context->Message_Block[t * 4 + 1]) << 16;
		W[t] |= context->Message_Block[t * 4 + 2] << 8;
		W[t] |= context->Message_Block[t * 4 + 3];
	}

	for (t = 16; t < 80; t++) {
		W[t] = cf_SHA1CircularShift(1,
				W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16]);
	}

	A = context->Intermediate_Hash[0];
	B = context->Intermediate_Hash[1];
	C = context->Intermediate_Hash[2];
	D = context->Intermediate_Hash[3];
	E = context->Intermediate_Hash[4];

	for (t = 0; t < 20; t++) {
		temp = cf_SHA1CircularShift(5, A) +
				((B & C) | ((~B) & D)) + E + W[t] + K[0];
		E = D;
		D = C;
		C = cf_SHA1CircularShift(30, B);
		B = A;
		A = temp;
	}

	for (t = 20; t < 40; t++) {
		temp = cf_SHA1CircularShift(5, A) + (B ^ C ^ D) + E + W[t] + K[1];
		E = D;
		D = C;
		C = cf_SHA1CircularShift(30, B);
		B = A;
		A = temp;
	}

	for (t = 40; t < 60; t++) {
		temp = cf_SHA1CircularShift(5, A) +
				((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
		E = D;
		D = C;
		C = cf_SHA1CircularShift(30, B);
		B = A;
		A = temp;
	}

	for (t = 60; t < 80; t++) {
		temp = cf_SHA1CircularShift(5, A) + (B ^ C ^ D) + E + W[t] + K[3];
		E = D;
		D = C;
		C = cf_SHA1CircularShift(30, B);
		B = A;
		A = temp;
	}

	context->Intermediate_Hash[0] += A;
	context->Intermediate_Hash[1] += B;
	context->Intermediate_Hash[2] += C;
	context->Intermediate_Hash[3] += D;
	context->Intermediate_Hash[4] += E;

	context->Message_Block_Index = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq $-0x40, %rax
movzbl 0x5e(%rdi,%rax), %ecx
shll $0x18, %ecx
movl %ecx, -0x40(%rsp,%rax)
movzbl 0x5f(%rdi,%rax), %edx
shll $0x10, %edx
orl %ecx, %edx
movl %edx, -0x40(%rsp,%rax)
movzbl 0x60(%rdi,%rax), %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl %ecx, -0x40(%rsp,%rax)
movzbl 0x61(%rdi,%rax), %edx
orl %ecx, %edx
movl %edx, -0x40(%rsp,%rax)
addq $0x4, %rax
jne 0x15b95
movq $-0x100, %rax
movl 0xa0(%rsp,%rax), %ecx
xorl 0xb4(%rsp,%rax), %ecx
xorl 0x88(%rsp,%rax), %ecx
xorl 0x80(%rsp,%rax), %ecx
roll %ecx
movl %ecx, 0xc0(%rsp,%rax)
addq $0x4, %rax
jne 0x15bd5
movl (%rdi), %r8d
movl 0x4(%rdi), %esi
movl 0x8(%rdi), %edx
movl 0xc(%rdi), %ecx
movl 0x10(%rdi), %eax
movq $-0x50, %r11
movl %eax, %r12d
movl %ecx, %r13d
movl %edx, %r9d
movl %esi, %r14d
movl %r8d, %r10d
movl %r10d, %ebx
movl %r9d, %r15d
movl %r13d, %ebp
movl %r10d, %r9d
roll $0x5, %r9d
addl %r12d, %r9d
movl %r15d, %r10d
xorl %r13d, %r10d
andl %r14d, %r10d
xorl %r13d, %r10d
addl %r9d, %r10d
movl -0x30(%rsp,%r11), %r9d
leal 0x5a827999(%r9,%r10), %r10d
movl %r14d, %r9d
roll $0x1e, %r9d
addq $0x4, %r11
movl %r13d, %r12d
movl %r15d, %r13d
movl %ebx, %r14d
jne 0x15c25
movq $-0x50, %r13
movl %r10d, %r11d
movl %r9d, %r12d
movl %r15d, %r14d
movl %r10d, %r9d
roll $0x5, %r9d
addl %ebp, %r9d
movl %r12d, %r10d
xorl %ebx, %r10d
xorl %r15d, %r10d
addl %r9d, %r10d
movl 0x20(%rsp,%r13), %r9d
leal 0x6ed9eba1(%r9,%r10), %r10d
movl %ebx, %r9d
roll $0x1e, %r9d
addq $0x4, %r13
movl %r15d, %ebp
movl %r12d, %r15d
movl %r11d, %ebx
jne 0x15c71
movq $-0x50, %r13
movl %r10d, %ebx
movl %r9d, %r15d
movl %r12d, %ebp
movl %r10d, %r9d
roll $0x5, %r9d
addl %r14d, %r9d
movl %r12d, %r10d
orl %r15d, %r10d
andl %r11d, %r10d
movl %r12d, %r14d
andl %r15d, %r14d
orl %r10d, %r14d
addl %r9d, %r14d
movl 0x70(%rsp,%r13), %r9d
leal -0x70e44324(%r9,%r14), %r10d
movl %r11d, %r9d
roll $0x1e, %r9d
addq $0x4, %r13
movl %r12d, %r14d
movl %r15d, %r12d
movl %ebx, %r11d
jne 0x15cba
movq $-0x50, %r12
movl %r10d, %r13d
movl %r9d, %r14d
movl %r15d, %r11d
movl %r10d, %r9d
roll $0x5, %r9d
addl %ebp, %r9d
movl %r14d, %r10d
xorl %ebx, %r10d
xorl %r15d, %r10d
addl %r9d, %r10d
movl 0xc0(%rsp,%r12), %r9d
leal -0x359d3e2a(%r9,%r10), %r10d
movl %ebx, %r9d
roll $0x1e, %r9d
addq $0x4, %r12
movl %r15d, %ebp
movl %r14d, %r15d
movl %r13d, %ebx
jne 0x15d0c
addl %r8d, %r10d
movl %r10d, (%rdi)
addl %esi, %r13d
movl %r13d, 0x4(%rdi)
addl %edx, %r9d
movl %r9d, 0x8(%rdi)
addl %ecx, %r14d
movl %r14d, 0xc(%rdi)
addl %eax, %r11d
movl %r11d, 0x10(%rdi)
movw $0x0, 0x1c(%rdi)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop