// File: /workspace/github_c_makefile_star2_O3/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
movl 0x5e(%rdi,%rax), %ecx
bswapl %ecx
movl %ecx, -0x40(%rsp,%rax)
addq $0x4, %rax
jne 0x15c91
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 0x15ca8
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 %r9d, %r15d
movl %r10d, %r9d
movl %r10d, %ebx
movl %r13d, %ebp
movl %r15d, %r10d
roll $0x5, %r9d
xorl %r13d, %r10d
addl %r12d, %r9d
movl %r13d, %r12d
andl %r14d, %r10d
xorl %r13d, %r10d
movl %r15d, %r13d
addl %r9d, %r10d
movl -0x30(%rsp,%r11), %r9d
leal 0x5a827999(%r9,%r10), %r10d
movl %r14d, %r9d
movl %ebx, %r14d
roll $0x1e, %r9d
addq $0x4, %r11
jne 0x15cf8
movq $-0x50, %r13
movl %r9d, %r12d
movl %r10d, %r9d
movl %r10d, %r11d
movl %r15d, %r14d
movl %r12d, %r10d
roll $0x5, %r9d
xorl %ebx, %r10d
addl %ebp, %r9d
movl %r15d, %ebp
xorl %r15d, %r10d
movl %r12d, %r15d
addl %r9d, %r10d
movl 0x20(%rsp,%r13), %r9d
leal 0x6ed9eba1(%r9,%r10), %r10d
movl %ebx, %r9d
movl %r11d, %ebx
roll $0x1e, %r9d
addq $0x4, %r13
jne 0x15d44
movq $-0x50, %r13
movl %r9d, %r15d
movl %r10d, %r9d
movl %r10d, %ebx
movl %r12d, %r10d
movl %r12d, %ebp
roll $0x5, %r9d
orl %r15d, %r10d
addl %r14d, %r9d
movl %r12d, %r14d
andl %r11d, %r10d
andl %r15d, %r14d
orl %r10d, %r14d
addl %r9d, %r14d
movl 0x70(%rsp,%r13), %r9d
leal -0x70e44324(%r9,%r14), %r10d
movl %r11d, %r9d
movl %r12d, %r14d
movl %r15d, %r12d
movl %ebx, %r11d
roll $0x1e, %r9d
addq $0x4, %r13
jne 0x15d8d
movq $-0x50, %r12
movl %r9d, %r14d
movl %r10d, %r9d
movl %r10d, %r13d
movl %r15d, %r11d
movl %r14d, %r10d
roll $0x5, %r9d
xorl %ebx, %r10d
addl %ebp, %r9d
movl %r15d, %ebp
xorl %r15d, %r10d
movl %r14d, %r15d
addl %r9d, %r10d
movl 0xc0(%rsp,%r12), %r9d
leal -0x359d3e2a(%r9,%r10), %r10d
movl %ebx, %r9d
movl %r13d, %ebx
roll $0x1e, %r9d
addq $0x4, %r12
jne 0x15ddf
addl %r8d, %r10d
addl %esi, %r13d
addl %edx, %r9d
addl %ecx, %r14d
addl %eax, %r11d
movl %r10d, (%rdi)
movl %r13d, 0x4(%rdi)
movl %r9d, 0x8(%rdi)
movl %r14d, 0xc(%rdi)
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