// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/misc/hash/md5.cpp
// Function: smooth::Hash::MD5::Finish()
S::String S::Hash::MD5::Finish()
{
	UnsignedInt64	 bits	= (buffer.Size() + size) * 8;
	Int		 index	= buffer.Size();

	/* Pad out to 56 mod 64.
	 */
	Int		 padLen	= (index < 56) ? (56 - index) : (120 - index);

	UnsignedByte	*end = new UnsignedByte [128];

	memcpy(end, buffer, index);
	memcpy(end + index, PADDING, padLen);

	end[index + padLen    ] = bits	     & 0xFF;
	end[index + padLen + 1] = bits >>  8 & 0xFF;
	end[index + padLen + 2] = bits >> 16 & 0xFF;
	end[index + padLen + 3] = bits >> 24 & 0xFF;
	end[index + padLen + 4] = bits >> 32 & 0xFF;
	end[index + padLen + 5] = bits >> 40 & 0xFF;
	end[index + padLen + 6] = bits >> 48 & 0xFF;
	end[index + padLen + 7] = bits >> 56 & 0xFF;

	Transform(end);

	if (padLen > 56) Transform(end + 64);

	delete [] end;

	String	 string;

	for (Int i = 0; i < 4; i++) string.Append(Number((Int64) REVERSE_INT32(state[i])).ToHexString(8));

	return string;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x80(%rbp)
movq %rdi, %rax
movq %rax, -0x78(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
addq $0x18, %rdi
callq 0x71140
movq -0x70(%rbp), %rdi
cltq
addq 0x10(%rdi), %rax
shlq $0x3, %rax
movq %rax, -0x18(%rbp)
addq $0x18, %rdi
callq 0x71140
movl %eax, -0x1c(%rbp)
cmpl $0x38, -0x1c(%rbp)
jge 0x100203
movl $0x38, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x84(%rbp)
jmp 0x100211
movl $0x78, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x80, %edi
callq 0x5ab20
movq -0x70(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
addq $0x18, %rdi
callq 0x71100
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movslq -0x1c(%rbp), %rdx
callq 0x593a0
movq -0x28(%rbp), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
movslq -0x20(%rbp), %rdx
leaq 0x10b897(%rip), %rsi    # 0x20bb00
callq 0x593a0
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x8, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x10, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x18, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x20, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x28, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x30, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
shrq $0x38, %rax
andq $0xff, %rax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rsi
callq 0x5abd0
cmpl $0x38, -0x20(%rbp)
jle 0x1003a3
movq -0x70(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x40, %rsi
callq 0x5abd0
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, %rax
je 0x1003c0
movq -0x98(%rbp), %rdi
callq 0x5a5e0
movq -0x80(%rbp), %rdi
movb $0x0, -0x29(%rbp)
xorl %esi, %esi
callq 0x5da90
movl $0x0, -0x30(%rbp)
cmpl $0x4, -0x30(%rbp)
jge 0x10049b
movq -0x70(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl %ecx, %eax
shll $0x18, %eax
movl %ecx, %edx
shrl $0x8, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
orl %esi, %eax
andl $0xff00, %edx           # imm = 0xFF00
orl %edx, %eax
shrl $0x18, %ecx
orl %ecx, %eax
movl %eax, %esi
leaq -0x58(%rbp), %rdi
callq 0x5dd30
jmp 0x10041c
leaq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x5bf10
jmp 0x100430
movq -0x80(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5a710
jmp 0x10043f
leaq -0x48(%rbp), %rdi
callq 0x5df00
leaq -0x58(%rbp), %rdi
callq 0x5d990
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1003d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1004bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x100490
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5df00
leaq -0x58(%rbp), %rdi
callq 0x5d990
jmp 0x1004bb
movb $0x1, -0x29(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x1004ae
movq -0x80(%rbp), %rdi
callq 0x5df00
movq -0x78(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x5df00
movq -0x60(%rbp), %rdi
callq 0x5b6b0
nopl (%rax)