#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*/ DoMD5(unsigned char *, unsigned char const *, unsigned long);
int /*<<< orphan*/ sprintf(unsigned char *, char *, unsigned char,
                           unsigned char, unsigned char, unsigned char,
                           unsigned char, unsigned char, unsigned char,
                           unsigned char, unsigned char, unsigned char,
                           unsigned char, unsigned char, unsigned char,
                           unsigned char, unsigned char, unsigned char);
char *md5hash(unsigned char *dst, const unsigned char *src, unsigned long n) {
  unsigned char tmp[16];
  DoMD5(tmp, src, n);
  sprintf(dst,
          "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
          tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7],
          tmp[8], tmp[9], tmp[10], tmp[11], tmp[12], tmp[13], tmp[14], tmp[15]);
  return dst;
}


x86 assembly (clang, -O0):
<md5hash>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1030 <DoMD5@plt>
mov    -0x30(%rbp),%rdi
mov    -0x50(%rbp),%dl
mov    -0x4f(%rbp),%cl
mov    -0x4e(%rbp),%r8b
mov    -0x4d(%rbp),%r9b
mov    -0x4c(%rbp),%al
mov    -0x4b(%rbp),%sil
mov    %sil,-0x53(%rbp)
mov    -0x4a(%rbp),%sil
mov    %sil,-0x52(%rbp)
mov    -0x49(%rbp),%r13b
mov    -0x48(%rbp),%r12b
mov    -0x47(%rbp),%r15b
mov    -0x46(%rbp),%r14b
mov    -0x45(%rbp),%bl
mov    -0x44(%rbp),%r11b
mov    -0x43(%rbp),%r10b
mov    -0x42(%rbp),%sil
mov    %sil,-0x51(%rbp)
lea    0xe60(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %al,%eax
mov    %eax,(%rsp)
mov    -0x53(%rbp),%al
movzbl %al,%eax
mov    %eax,0x8(%rsp)
mov    -0x52(%rbp),%al
movzbl %al,%eax
mov    %eax,0x10(%rsp)
mov    -0x51(%rbp),%al
movzbl %r13b,%r13d
mov    %r13d,0x18(%rsp)
movzbl %r12b,%r12d
mov    %r12d,0x20(%rsp)
movzbl %r15b,%r15d
mov    %r15d,0x28(%rsp)
movzbl %r14b,%r14d
mov    %r14d,0x30(%rsp)
movzbl %bl,%ebx
mov    %ebx,0x38(%rsp)
movzbl %r11b,%r11d
mov    %r11d,0x40(%rsp)
movzbl %r10b,%r10d
mov    %r10d,0x48(%rsp)
movzbl %al,%eax
mov    %eax,0x50(%rsp)
movzbl -0x41(%rbp),%eax
mov    %eax,0x58(%rsp)
call   1040 <sprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<md5hash>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%r13
mov    %rsp,%rdi
call   1030 <DoMD5@plt>
movzbl (%rsp),%edx
movzbl 0x1(%rsp),%ecx
movzbl 0x2(%rsp),%r8d
movzbl 0x3(%rsp),%r9d
movzbl 0x4(%rsp),%eax
mov    %rax,0x30(%rsp)
movzbl 0x5(%rsp),%eax
mov    %rax,0x28(%rsp)
movzbl 0x6(%rsp),%eax
mov    %rax,0x20(%rsp)
movzbl 0x7(%rsp),%eax
mov    %rax,0x18(%rsp)
movzbl 0x8(%rsp),%r12d
movzbl 0x9(%rsp),%eax
movzbl 0xa(%rsp),%ebx
movzbl 0xb(%rsp),%ebp
movzbl 0xc(%rsp),%r10d
movzbl 0xd(%rsp),%r11d
movzbl 0xe(%rsp),%r14d
movzbl 0xf(%rsp),%r15d
lea    0xe56(%rip),%rsi
mov    %r13,%rdi
push   %r15
push   %r14
push   %r11
push   %r10
push   %rbp
push   %rbx
push   %rax
push   %r12
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
call   1040 <sprintf@plt>
add    $0x60,%rsp
mov    %r13,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [65 x i8] c"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\00"
define i8* @md5hash(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca [16 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @DoMD5(i8* %8, i8* %9, i64 %10)
%12 = load i8*, i8** %4
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%14 = load i8, i8* %13
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 1
%16 = load i8, i8* %15
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 2
%18 = load i8, i8* %17
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 3
%20 = load i8, i8* %19
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 4
%22 = load i8, i8* %21
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 5
%24 = load i8, i8* %23
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 6
%26 = load i8, i8* %25
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 7
%28 = load i8, i8* %27
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 8
%30 = load i8, i8* %29
%31 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 9
%32 = load i8, i8* %31
%33 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 10
%34 = load i8, i8* %33
%35 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 11
%36 = load i8, i8* %35
%37 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 12
%38 = load i8, i8* %37
%39 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 13
%40 = load i8, i8* %39
%41 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 14
%42 = load i8, i8* %41
%43 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 15
%44 = load i8, i8* %43
%45 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 zeroext %14, i8 zeroext %16, i8 zeroext %18, i8 zeroext %20, i8 zeroext %22, i8 zeroext %24, i8 zeroext %26, i8 zeroext %28, i8 zeroext %30, i8 zeroext %32, i8 zeroext %34, i8 zeroext %36, i8 zeroext %38, i8 zeroext %40, i8 zeroext %42, i8 zeroext %44)
%46 = load i8*, i8** %4
ret i8* %46
}

LLVM IR (-O2):
@.str = [65 x i8] c"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\00"
define i8* @md5hash(i8* returned writeonly %0, i8* %1, i64 %2) {
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%6 = call i32 @DoMD5(i8* %5, i8* %1, i64 %2)
%7 = load i8, i8* %5
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 2
%11 = load i8, i8* %10
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 3
%13 = load i8, i8* %12
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 4
%15 = load i8, i8* %14
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 5
%17 = load i8, i8* %16
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 6
%19 = load i8, i8* %18
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 7
%21 = load i8, i8* %20
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 8
%23 = load i8, i8* %22
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 9
%25 = load i8, i8* %24
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 10
%27 = load i8, i8* %26
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 11
%29 = load i8, i8* %28
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 12
%31 = load i8, i8* %30
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 13
%33 = load i8, i8* %32
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 14
%35 = load i8, i8* %34
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 15
%37 = load i8, i8* %36
%38 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 zeroext %7, i8 zeroext %9, i8 zeroext %11, i8 zeroext %13, i8 zeroext %15, i8 zeroext %17, i8 zeroext %19, i8 zeroext %21, i8 zeroext %23, i8 zeroext %25, i8 zeroext %27, i8 zeroext %29, i8 zeroext %31, i8 zeroext %33, i8 zeroext %35, i8 zeroext %37)
ret i8* %0
}