void MD5_Binary(const char *string, int len, char *output) {
  unsigned char padding_message[64];
  unsigned char *pstring;
  unsigned int string_byte_len;
  unsigned int string_bit_len;
  unsigned int copy_len;
  unsigned int msg_digest[4];
  unsigned int *A = &msg_digest[0];
  unsigned int *B = &msg_digest[1];
  unsigned int *C = &msg_digest[2];
  unsigned int *D = &msg_digest[3];
  int i;
  *A = 0x67452301;
  *B = 0xefcdab89;
  *C = 0x98badcfe;
  *D = 0x10325476;
  string_byte_len = len;
  pstring = (unsigned char *)string;
  for (i = string_byte_len; 64 <= i; i -= 64, pstring += 64)
    MD5_Round_Calculate(pstring, A, B, C, D);
  copy_len = string_byte_len % 64;
  strncpy((char *)padding_message, (char *)pstring, copy_len);
  memset(padding_message + copy_len, 0, 64 - copy_len);
  padding_message[copy_len] |= 0x80;
  if (56 <= copy_len) {
    MD5_Round_Calculate(padding_message, A, B, C, D);
    memset(padding_message, 0, 56);
  }
  string_bit_len = string_byte_len * 8;
  memcpy(&padding_message[56], &string_bit_len, 4);
  if (4294967295U / 8 < string_byte_len) {
    unsigned int high = (string_byte_len - 4294967295U / 8) * 8;
    memcpy(&padding_message[60], &high, 4);
  } else {
    memset(&padding_message[60], 0, 4);
  }
  MD5_Round_Calculate(padding_message, A, B, C, D);
  memcpy(output, msg_digest, 16);
}


x86 assembly (clang, -O0):
<MD5_Binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0xa0(%rbp)
lea    -0x90(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xa8(%rbp)
lea    -0x90(%rbp),%rax
add    $0xc,%rax
mov    %rax,-0xb0(%rbp)
mov    -0x98(%rbp),%rax
movl   $0x67452301,(%rax)
mov    -0xa0(%rbp),%rax
movl   $0xefcdab89,(%rax)
mov    -0xa8(%rbp),%rax
movl   $0x98badcfe,(%rax)
mov    -0xb0(%rbp),%rax
movl   $0x10325476,(%rax)
mov    -0xc(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    $0x40,%eax
cmp    -0xb4(%rbp),%eax
jg     122d <MD5_Binary+0xfd>
mov    -0x68(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    -0xa0(%rbp),%rdx
mov    -0xa8(%rbp),%rcx
mov    -0xb0(%rbp),%r8
mov    $0x0,%al
call   1050 <MD5_Round_Calculate@plt>
mov    -0xb4(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0xb4(%rbp)
mov    -0x68(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x68(%rbp)
jmp    11d5 <MD5_Binary+0xa5>
mov    -0x6c(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x74(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x74(%rbp),%eax
mov    %eax,%edx
call   1030 <strncpy@plt>
lea    -0x60(%rbp),%rdi
mov    -0x74(%rbp),%eax
add    %rax,%rdi
mov    $0x40,%eax
sub    -0x74(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x74(%rbp),%eax
movzbl -0x60(%rbp,%rax,1),%ecx
or     $0x80,%ecx
mov    %cl,-0x60(%rbp,%rax,1)
mov    $0x38,%eax
cmp    -0x74(%rbp),%eax
ja     12bc <MD5_Binary+0x18c>
lea    -0x60(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    -0xa0(%rbp),%rdx
mov    -0xa8(%rbp),%rcx
mov    -0xb0(%rbp),%r8
mov    $0x0,%al
call   1050 <MD5_Round_Calculate@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1040 <memset@plt>
mov    -0x6c(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x1fffffff,%eax
cmp    -0x6c(%rbp),%eax
jae    12f8 <MD5_Binary+0x1c8>
mov    -0x6c(%rbp),%eax
sub    $0x1fffffff,%eax
shl    $0x3,%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    130c <MD5_Binary+0x1dc>
lea    -0x60(%rbp),%rdi
add    $0x3c,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
lea    -0x60(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    -0xa0(%rbp),%rdx
mov    -0xa8(%rbp),%rcx
mov    -0xb0(%rbp),%r8
mov    $0x0,%al
call   1050 <MD5_Round_Calculate@plt>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x88(%rbp),%rcx
mov    %rcx,0x8(%rax)
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MD5_Binary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdx,0x18(%rsp)
mov    %rdi,%rbp
lea    0x4(%rsp),%r13
lea    0x8(%rsp),%r15
lea    0xc(%rsp),%r12
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
cmp    $0x40,%esi
mov    %rsi,0x10(%rsp)
jl     1192 <MD5_Binary+0x62>
lea    0x40(%rsi),%ebx
mov    %rsp,%r14
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <MD5_Round_Calculate@plt>
add    $0x40,%rbp
add    $0xffffffc0,%ebx
cmp    $0x7f,%ebx
ja     1170 <MD5_Binary+0x40>
mov    0x10(%rsp),%r14
mov    %r14d,%ebx
and    $0x3f,%ebx
lea    0x20(%rsp),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1030 <strncpy@plt>
lea    (%rsp,%rbx,1),%rdi
add    $0x20,%rdi
mov    $0x40,%edx
sub    %ebx,%edx
xor    %ebp,%ebp
xor    %esi,%esi
call   1040 <memset@plt>
orb    $0x80,0x20(%rsp,%rbx,1)
cmp    $0x38,%ebx
jb     1202 <MD5_Binary+0xd2>
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <MD5_Round_Calculate@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x50(%rsp)
lea    0x0(,%r14,8),%eax
mov    %eax,0x58(%rsp)
cmp    $0x20000000,%r14d
lea    0x8(,%r14,8),%eax
cmovb  %ebp,%eax
mov    %eax,0x5c(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <MD5_Round_Calculate@plt>
movaps (%rsp),%xmm0
mov    0x18(%rsp),%rax
movups %xmm0,(%rax)
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @MD5_Binary(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [64 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [4 x i32]
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
store i32* %19, i32** %13
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 1
store i32* %20, i32** %14
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 2
store i32* %21, i32** %15
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 3
store i32* %22, i32** %16
%23 = load i32*, i32** %13
store i32 1732584193, i32* %23
%24 = load i32*, i32** %14
store i32 -271733879, i32* %24
%25 = load i32*, i32** %15
store i32 -1732584194, i32* %25
%26 = load i32*, i32** %16
store i32 271733878, i32* %26
%27 = load i32, i32* %5
store i32 %27, i32* %9
%28 = load i8*, i8** %4
store i8* %28, i8** %8
%29 = load i32, i32* %9
store i32 %29, i32* %17
br label %30
30: ; preds = %40, %3
%31 = load i32, i32* %17
%32 = icmp sle i32 64, %31
br i1 %32, label %33, label %45
33: ; preds = %30
%34 = load i8*, i8** %8
%35 = load i32*, i32** %13
%36 = load i32*, i32** %14
%37 = load i32*, i32** %15
%38 = load i32*, i32** %16
%39 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @MD5_Round_Calculate to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %34, i32* %35, i32* %36, i32* %37, i32* %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %17
%42 = sub nsw i32 %41, 64
store i32 %42, i32* %17
%43 = load i8*, i8** %8
%44 = getelementptr inbounds i8, i8* %43, i64 64
store i8* %44, i8** %8
br label %30
45: ; preds = %30
%46 = load i32, i32* %9
%47 = urem i32 %46, 64
store i32 %47, i32* %11
%48 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%49 = load i8*, i8** %8
%50 = load i32, i32* %11
%51 = zext i32 %50 to i64
%52 = call i8* @strncpy(i8* %48, i8* %49, i64 %51)
%53 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%54 = load i32, i32* %11
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = load i32, i32* %11
%58 = sub i32 64, %57
%59 = zext i32 %58 to i64
%60 = load i32, i32* %11
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = or i32 %64, 128
%66 = trunc i32 %65 to i8
store i8 %66, i8* %62
%67 = load i32, i32* %11
%68 = icmp ule i32 56, %67
br i1 %68, label %69, label %77
69: ; preds = %45
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%71 = load i32*, i32** %13
%72 = load i32*, i32** %14
%73 = load i32*, i32** %15
%74 = load i32*, i32** %16
%75 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @MD5_Round_Calculate to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %70, i32* %71, i32* %72, i32* %73, i32* %74)
%76 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
br label %77
77: ; preds = %69, %45
%78 = load i32, i32* %9
%79 = mul i32 %78, 8
store i32 %79, i32* %10
%80 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 56
%81 = bitcast i32* %10 to i8*
%82 = load i32, i32* %9
%83 = icmp ult i32 536870911, %82
br i1 %83, label %84, label %90
84: ; preds = %77
%85 = load i32, i32* %9
%86 = sub i32 %85, 536870911
%87 = mul i32 %86, 8
store i32 %87, i32* %18
%88 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 60
%89 = bitcast i32* %18 to i8*
br label %92
90: ; preds = %77
%91 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 60
br label %92
92: ; preds = %90, %84
%93 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%94 = load i32*, i32** %13
%95 = load i32*, i32** %14
%96 = load i32*, i32** %15
%97 = load i32*, i32** %16
%98 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @MD5_Round_Calculate to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %93, i32* %94, i32* %95, i32* %96, i32* %97)
%99 = load i8*, i8** %6
%100 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
%101 = bitcast i32* %100 to i8*
ret void
}

LLVM IR (-O2):
define void @MD5_Binary(i8* %0, i32 %1, i8* nocapture writeonly %2) {
%4 = alloca [64 x i8]
%5 = alloca <4 x i32>
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%7 = bitcast <4 x i32>* %5 to i8*
%8 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 0
%9 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 1
%10 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 2
%11 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 3
store <4 x i32> <i32 1732584193, i32 -271733879, i32 -1732584194, i32 271733878>, <4 x i32>* %5
%12 = icmp sgt i32 %1, 63
br i1 %12, label %13, label %20
13: ; preds = %3, %13
%14 = phi i8* [ %18, %13 ], [ %0, %3 ]
%15 = phi i32 [ %17, %13 ], [ %1, %3 ]
%16 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @MD5_Round_Calculate to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %14, i32* %8, i32* %9, i32* %10, i32* %11)
%17 = add nsw i32 %15, -64
%18 = getelementptr inbounds i8, i8* %14, i64 64
%19 = icmp ugt i32 %15, 127
br i1 %19, label %13, label %20
20: ; preds = %13, %3
%21 = phi i8* [ %0, %3 ], [ %18, %13 ]
%22 = and i32 %1, 63
%23 = zext i32 %22 to i64
%24 = call i8* @strncpy(i8* %6, i8* %21, i64 %23)
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 %23
%26 = sub nuw nsw i32 64, %22
%27 = zext i32 %26 to i64
%28 = load i8, i8* %25
%29 = or i8 %28, -128
store i8 %29, i8* %25
%30 = icmp ugt i32 %22, 55
br i1 %30, label %31, label %33
31: ; preds = %20
%32 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @MD5_Round_Calculate to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %6, i32* %8, i32* %9, i32* %10, i32* %11)
br label %33
33: ; preds = %31, %20
%34 = shl i32 %1, 3
%35 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 56
%36 = bitcast i8* %35 to i32*
store i32 %34, i32* %36
%37 = icmp ugt i32 %1, 536870911
%38 = add i32 %34, 8
%39 = select i1 %37, i32 %38, i32 0
%40 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 60
%41 = bitcast i8* %40 to i32*
store i32 %39, i32* %41
%42 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @MD5_Round_Calculate to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %6, i32* %8, i32* %9, i32* %10, i32* %11)
ret void
}