// File: /workspace/github_cpp_makefile_star2_O1/lianxings[P]ftp_benchmark/WjCryptLib_Md5.cc
// Function: Md5Finalise(Md5Context*, MD5_HASH*)
void Md5Finalise (
        Md5Context*         Context,        // [in out]
        MD5_HASH*           Digest          // [in]
) {
    uint32_t    used;
    uint32_t    free;

    used = Context->lo & 0x3f;

    Context->buffer[used++] = 0x80;

    free = 64 - used;

    if(free < 8)
    {
        memset( &Context->buffer[used], 0, free );
        TransformFunction( Context, Context->buffer, 64 );
        used = 0;
        free = 64;
    }

    memset( &Context->buffer[used], 0, free - 8 );

    Context->lo <<= 3;
    Context->buffer[56] = (uint8_t)( Context->lo );
    Context->buffer[57] = (uint8_t)( Context->lo >> 8 );
    Context->buffer[58] = (uint8_t)( Context->lo >> 16 );
    Context->buffer[59] = (uint8_t)( Context->lo >> 24 );
    Context->buffer[60] = (uint8_t)( Context->hi );
    Context->buffer[61] = (uint8_t)( Context->hi >> 8 );
    Context->buffer[62] = (uint8_t)( Context->hi >> 16 );
    Context->buffer[63] = (uint8_t)( Context->hi >> 24 );

    TransformFunction( Context, Context->buffer, 64 );

    Digest->bytes[0]  = (uint8_t)( Context->a );
    Digest->bytes[1]  = (uint8_t)( Context->a >> 8 );
    Digest->bytes[2]  = (uint8_t)( Context->a >> 16 );
    Digest->bytes[3]  = (uint8_t)( Context->a >> 24 );
    Digest->bytes[4]  = (uint8_t)( Context->b );
    Digest->bytes[5]  = (uint8_t)( Context->b >> 8 );
    Digest->bytes[6]  = (uint8_t)( Context->b >> 16 );
    Digest->bytes[7]  = (uint8_t)( Context->b >> 24 );
    Digest->bytes[8]  = (uint8_t)( Context->c );
    Digest->bytes[9]  = (uint8_t)( Context->c >> 8 );
    Digest->bytes[10] = (uint8_t)( Context->c >> 16 );
    Digest->bytes[11] = (uint8_t)( Context->c >> 24 );
    Digest->bytes[12] = (uint8_t)( Context->d );
    Digest->bytes[13] = (uint8_t)( Context->d >> 8 );
    Digest->bytes[14] = (uint8_t)( Context->d >> 16 );
    Digest->bytes[15] = (uint8_t)( Context->d >> 24 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %edx
andl $0x3f, %edx
leaq 0x18(%rdi), %r15
leal 0x1(%rdx), %ebp
movb $-0x80, 0x18(%rdi,%rdx)
xorl $0x3f, %edx
cmpl $0x7, %edx
ja 0x11496
movl %ebp, %edi
addq %r15, %rdi
movl %edx, %edx
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x4210
movl $0x40, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x10b2e
movl $0x40, %edx
movl %ebp, %edi
addq %r15, %rdi
addl $-0x8, %edx
xorl %esi, %esi
callq 0x4210
movl (%r14), %eax
movl 0x4(%r14), %ecx
leal (,%rax,8), %edx
movl %edx, (%r14)
movb %dl, 0x50(%r14)
movl %eax, %edx
shrl $0x5, %edx
movb %dl, 0x51(%r14)
movl %eax, %edx
shrl $0xd, %edx
movb %dl, 0x52(%r14)
shrl $0x15, %eax
movb %al, 0x53(%r14)
movl %ecx, 0x54(%r14)
movl $0x40, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x10b2e
movb 0x8(%r14), %al
movb %al, (%rbx)
movb 0x9(%r14), %al
movb %al, 0x1(%rbx)
movb 0xa(%r14), %al
movb %al, 0x2(%rbx)
movb 0xb(%r14), %al
movb %al, 0x3(%rbx)
movb 0xc(%r14), %al
movb %al, 0x4(%rbx)
movb 0xd(%r14), %al
movb %al, 0x5(%rbx)
movb 0xe(%r14), %al
movb %al, 0x6(%rbx)
movb 0xf(%r14), %al
movb %al, 0x7(%rbx)
movb 0x10(%r14), %al
movb %al, 0x8(%rbx)
movb 0x11(%r14), %al
movb %al, 0x9(%rbx)
movb 0x12(%r14), %al
movb %al, 0xa(%rbx)
movb 0x13(%r14), %al
movb %al, 0xb(%rbx)
movb 0x14(%r14), %al
movb %al, 0xc(%rbx)
movb 0x15(%r14), %al
movb %al, 0xd(%rbx)
movb 0x16(%r14), %al
movb %al, 0xe(%rbx)
movb 0x17(%r14), %al
movb %al, 0xf(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq