#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ MD5_Round_Calculate(unsigned char const *, unsigned int *,
                                       unsigned int *, unsigned int *,
                                       unsigned int *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned int *, int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, unsigned int);
void MD5_String2binary(const char *string, unsigned char *output) {
  unsigned char padding_message[64];
  const unsigned char *pstring;
  unsigned int string_byte_len, string_bit_len, copy_len, msg_digest[4];
  unsigned int *A = &msg_digest[0], *B = &msg_digest[1], *C = &msg_digest[2],
               *D = &msg_digest[3];
  int i;
  *A = 0x67452301;
  *B = 0xefcdab89;
  *C = 0x98badcfe;
  *D = 0x10325476;
  string_byte_len = (unsigned int)strlen(string);
  pstring = (const 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, (const 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 (0xffffffff / 8 < string_byte_len) {
    unsigned int high = (string_byte_len - 0xffffffff / 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_String2binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x90(%rbp)
lea    -0x80(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x98(%rbp)
lea    -0x80(%rbp),%rax
add    $0xc,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x88(%rbp),%rax
movl   $0x67452301,(%rax)
mov    -0x90(%rbp),%rax
movl   $0xefcdab89,(%rax)
mov    -0x98(%rbp),%rax
movl   $0x98badcfe,(%rax)
mov    -0xa0(%rbp),%rax
movl   $0x10325476,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    $0x40,%eax
cmp    -0xa4(%rbp),%eax
jg     1242 <MD5_String2binary+0xf2>
mov    -0x58(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%r8
call   1060 <MD5_Round_Calculate@plt>
mov    -0xa4(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x58(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x58(%rbp)
jmp    11ec <MD5_String2binary+0x9c>
mov    -0x5c(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x64(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x64(%rbp),%edx
call   1030 <strncpy@plt>
lea    -0x50(%rbp),%rdi
mov    -0x64(%rbp),%eax
add    %rax,%rdi
mov    $0x40,%edx
sub    -0x64(%rbp),%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x64(%rbp),%eax
movzbl -0x50(%rbp,%rax,1),%ecx
or     $0x80,%ecx
mov    %cl,-0x50(%rbp,%rax,1)
mov    $0x38,%eax
cmp    -0x64(%rbp),%eax
ja     12c9 <MD5_String2binary+0x179>
lea    -0x50(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%r8
call   1060 <MD5_Round_Calculate@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1050 <memset@plt>
mov    -0x5c(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x38,%rdi
lea    -0x60(%rbp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    $0x1fffffff,%eax
cmp    -0x5c(%rbp),%eax
jae    1325 <MD5_String2binary+0x1d5>
mov    -0x5c(%rbp),%eax
sub    $0x1fffffff,%eax
shl    $0x3,%eax
mov    %eax,-0xa8(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x3c,%rdi
lea    -0xa8(%rbp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
jmp    1339 <MD5_String2binary+0x1e9>
lea    -0x50(%rbp),%rdi
add    $0x3c,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%r8
call   1060 <MD5_Round_Calculate@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x10,%edx
call   1070 <memcpy@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MD5_String2binary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,0x28(%rsp)
mov    %rdi,%rbp
lea    0x14(%rsp),%r13
lea    0x18(%rsp),%r15
lea    0x1c(%rsp),%r12
movaps 0xe84(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
call   1040 <strlen@plt>
cmp    $0x40,%eax
mov    %rax,0x20(%rsp)
jl     11c0 <MD5_String2binary+0x70>
lea    0x40(%rax),%ebx
lea    0x10(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1060 <MD5_Round_Calculate@plt>
add    $0x40,%rbp
add    $0xffffffc0,%ebx
cmp    $0x7f,%ebx
ja     11a0 <MD5_String2binary+0x50>
mov    0x20(%rsp),%r14
mov    %r14d,%ebx
and    $0x3f,%ebx
lea    0x30(%rsp),%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
lea    (%rsp,%rbx,1),%rdi
add    $0x30,%rdi
mov    $0x40,%edx
sub    %ebx,%edx
xor    %esi,%esi
call   1050 <memset@plt>
orb    $0x80,0x30(%rsp,%rbx,1)
cmp    $0x38,%ebx
jb     1224 <MD5_String2binary+0xd4>
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1060 <MD5_Round_Calculate@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1050 <memset@plt>
lea    0x0(,%r14,8),%ebx
mov    %ebx,0xc(%rsp)
lea    0x68(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
cmp    $0x20000000,%r14d
jb     126a <MD5_String2binary+0x11a>
add    $0x8,%ebx
mov    %ebx,0x8(%rsp)
lea    0x6c(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
jmp    127b <MD5_String2binary+0x12b>
lea    0x6c(%rsp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <memset@plt>
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1060 <MD5_Round_Calculate@plt>
mov    0x28(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1070 <memcpy@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @MD5_String2binary(i8* %0, i8* %1) {
%3 = alloca [64 x i8]
%4 = alloca i32
%5 = alloca <4 x i32>
%6 = alloca i32
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%8 = bitcast i32* %4 to i8*
%9 = bitcast <4 x i32>* %5 to i8*
%10 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 0
%11 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 1
%12 = getelementptr inbounds <4 x i32>, <4 x i32>* %5, i64 0, i64 2
%13 = 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
%14 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%15 = trunc i64 %14 to i32
%16 = icmp sgt i32 %15, 63
br i1 %16, label %17, label %24
17: ; preds = %2, %17
%18 = phi i32 [ %21, %17 ], [ %15, %2 ]
%19 = phi i8* [ %22, %17 ], [ %0, %2 ]
%20 = call i32 @MD5_Round_Calculate(i8* %19, i32* %10, i32* %11, i32* %12, i32* %13)
%21 = add nsw i32 %18, -64
%22 = getelementptr inbounds i8, i8* %19, i64 64
%23 = icmp ugt i32 %18, 127
br i1 %23, label %17, label %24
24: ; preds = %17, %2
%25 = phi i8* [ %0, %2 ], [ %22, %17 ]
%26 = and i32 %15, 63
%27 = call i32 @strncpy(i8* %7, i8* %25, i32 %26)
%28 = zext i32 %26 to i64
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %28
%30 = sub nuw nsw i32 64, %26
%31 = call i32 @memset(i8* %29, i32 0, i32 %30)
%32 = load i8, i8* %29
%33 = or i8 %32, -128
store i8 %33, i8* %29
%34 = icmp ugt i32 %26, 55
br i1 %34, label %35, label %38
35: ; preds = %24
%36 = call i32 @MD5_Round_Calculate(i8* %7, i32* %10, i32* %11, i32* %12, i32* %13)
%37 = call i32 @memset(i8* %7, i32 0, i32 56)
br label %38
38: ; preds = %35, %24
%39 = shl i32 %15, 3
store i32 %39, i32* %4
%40 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 56
%41 = call i32 @memcpy(i8* %40, i32* %4, i32 4)
%42 = icmp ugt i32 %15, 536870911
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = bitcast i32* %6 to i8*
%45 = add i32 %39, 8
store i32 %45, i32* %6
%46 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 60
%47 = call i32 @memcpy(i8* %46, i32* %6, i32 4)
br label %51
48: ; preds = %38
%49 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 60
%50 = call i32 @memset(i8* %49, i32 0, i32 4)
br label %51
51: ; preds = %48, %43
%52 = call i32 @MD5_Round_Calculate(i8* %7, i32* %10, i32* %11, i32* %12, i32* %13)
%53 = call i32 @memcpy(i8* %1, i32* %10, i32 16)
ret void
}