#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*/
snprintf(char *, int, char *, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const);
char *ConvertMD5Hash(const unsigned char *md5, char *result) {
  int i;
  int tlen;
  char *start;
  start = result;
  result += snprintf(
      result, 33,
      "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
      md5[0], md5[1], md5[2], md5[3], md5[4], md5[5], md5[6], md5[7], md5[8],
      md5[9], md5[10], md5[11], md5[12], md5[13], md5[14], md5[15]);
  *result = '\0';
  return start;
}


x86 assembly (clang, -O0):
<ConvertMD5Hash>:
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    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%r8b
mov    -0x30(%rbp),%rax
mov    0x2(%rax),%r9b
mov    -0x30(%rbp),%rax
mov    0x3(%rax),%al
mov    -0x30(%rbp),%rdx
mov    0x4(%rdx),%dl
mov    %dl,-0x54(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x5(%rdx),%dl
mov    %dl,-0x53(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x6(%rdx),%dl
mov    %dl,-0x52(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x7(%rdx),%dl
mov    %dl,-0x51(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x8(%rdx),%r13b
mov    -0x30(%rbp),%rdx
mov    0x9(%rdx),%r12b
mov    -0x30(%rbp),%rdx
mov    0xa(%rdx),%r15b
mov    -0x30(%rbp),%rdx
mov    0xb(%rdx),%r14b
mov    -0x30(%rbp),%rdx
mov    0xc(%rdx),%bl
mov    -0x30(%rbp),%rdx
mov    0xd(%rdx),%r11b
mov    -0x30(%rbp),%rdx
mov    0xe(%rdx),%r10b
mov    -0x30(%rbp),%rdx
mov    %rdx,-0x50(%rbp)
mov    $0x21,%esi
lea    0xe38(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %al,%eax
mov    %eax,(%rsp)
mov    -0x54(%rbp),%al
movzbl %al,%eax
mov    %eax,0x8(%rsp)
mov    -0x53(%rbp),%al
movzbl %al,%eax
mov    %eax,0x10(%rsp)
mov    -0x52(%rbp),%al
movzbl %al,%eax
mov    %eax,0x18(%rsp)
mov    -0x51(%rbp),%al
movzbl %al,%eax
mov    %eax,0x20(%rsp)
mov    -0x50(%rbp),%rax
movzbl %r13b,%r13d
mov    %r13d,0x28(%rsp)
movzbl %r12b,%r12d
mov    %r12d,0x30(%rsp)
movzbl %r15b,%r15d
mov    %r15d,0x38(%rsp)
movzbl %r14b,%r14d
mov    %r14d,0x40(%rsp)
movzbl %bl,%ebx
mov    %ebx,0x48(%rsp)
movzbl %r11b,%r11d
mov    %r11d,0x50(%rsp)
movzbl %r10b,%r10d
mov    %r10d,0x58(%rsp)
movzbl 0xf(%rax),%eax
mov    %eax,0x60(%rsp)
call   1030 <snprintf@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertMD5Hash>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
movzbl (%rdi),%ecx
movzbl 0x1(%rdi),%r8d
movzbl 0x2(%rdi),%r9d
movzbl 0x3(%rdi),%eax
mov    %rax,0x20(%rsp)
movzbl 0x4(%rdi),%eax
mov    %rax,0x18(%rsp)
movzbl 0x5(%rdi),%eax
mov    %rax,0x10(%rsp)
movzbl 0x6(%rdi),%eax
mov    %rax,0x8(%rsp)
movzbl 0x7(%rdi),%eax
mov    %rax,(%rsp)
movzbl 0x8(%rdi),%r13d
movzbl 0x9(%rdi),%eax
movzbl 0xa(%rdi),%ebp
movzbl 0xb(%rdi),%r10d
movzbl 0xc(%rdi),%r11d
movzbl 0xd(%rdi),%r14d
movzbl 0xe(%rdi),%r15d
movzbl 0xf(%rdi),%r12d
sub    $0x8,%rsp
lea    0xe75(%rip),%rdx
mov    %rsi,%rdi
mov    $0x21,%esi
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
push   %rbp
push   %rax
push   %r13
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
call   1030 <snprintf@plt>
add    $0x70,%rsp
cltq
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x28,%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* @ConvertMD5Hash(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
store i8* %8, i8** %7
%9 = load i8*, i8** %4
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = load i8, i8* %17
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 4
%24 = load i8, i8* %23
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 5
%27 = load i8, i8* %26
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 6
%30 = load i8, i8* %29
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i64 7
%33 = load i8, i8* %32
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i64 8
%36 = load i8, i8* %35
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 9
%39 = load i8, i8* %38
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 10
%42 = load i8, i8* %41
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 11
%45 = load i8, i8* %44
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i64 12
%48 = load i8, i8* %47
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 13
%51 = load i8, i8* %50
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i64 14
%54 = load i8, i8* %53
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i64 15
%57 = load i8, i8* %56
%58 = call i32 @snprintf(i8* %9, i32 33, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 zeroext %12, i8 zeroext %15, i8 zeroext %18, i8 zeroext %21, i8 zeroext %24, i8 zeroext %27, i8 zeroext %30, i8 zeroext %33, i8 zeroext %36, i8 zeroext %39, i8 zeroext %42, i8 zeroext %45, i8 zeroext %48, i8 zeroext %51, i8 zeroext %54, i8 zeroext %57)
%59 = load i8*, i8** %4
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds i8, i8* %59, i64 %60
store i8* %61, i8** %4
%62 = load i8*, i8** %4
store i8 0, i8* %62
%63 = load i8*, i8** %7
ret i8* %63
}

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* @ConvertMD5Hash(i8* nocapture %0, i8* returned %1) {
%3 = load i8, i8* %0
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 3
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %0, i64 4
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %0, i64 5
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %0, i64 6
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %0, i64 7
%17 = load i8, i8* %16
%18 = getelementptr inbounds i8, i8* %0, i64 8
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %0, i64 9
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %0, i64 10
%23 = load i8, i8* %22
%24 = getelementptr inbounds i8, i8* %0, i64 11
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %0, i64 12
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %0, i64 13
%29 = load i8, i8* %28
%30 = getelementptr inbounds i8, i8* %0, i64 14
%31 = load i8, i8* %30
%32 = getelementptr inbounds i8, i8* %0, i64 15
%33 = load i8, i8* %32
%34 = tail call i32 @snprintf(i8* %1, i32 33, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 zeroext %3, i8 zeroext %5, 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)
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %1, i64 %35
store i8 0, i8* %36
ret i8* %1
}