#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(unsigned char *, int /*<<< orphan*/, unsigned char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlen(unsigned char *);
int main(int argc, char **argv) {
  unsigned char *data = "1234";
  unsigned char md[16];
  int i;
  char tmp[3] = {'\0'}, buf[33] = {'\0'};
  MD5(data, strlen(data), md);
  for (i = 0; i < 16; i++) {
    sprintf(tmp, "%2.2x", md[i]);
    strcat(buf, tmp);
  }
  printf("%s\n", buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x37(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1050 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1050 <memset@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
lea    -0x30(%rbp),%rdx
call   1060 <MD5@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jge    1206 <main+0xa6>
lea    -0x37(%rbp),%rdi
movslq -0x34(%rbp),%rax
lea    0xe24(%rip),%rsi
movzbl -0x30(%rbp,%rax,1),%edx
call   1080 <sprintf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x37(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c8 <main+0x68>
lea    -0x60(%rbp),%rsi
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movb   $0x0,0x1e(%rsp)
movw   $0x0,0x1c(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x40(%rsp)
lea    0xe82(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <MD5@plt>
movzbl (%rsp),%edx
lea    0xe67(%rip),%r15
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x1(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x2(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x3(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x5(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x6(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x7(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x9(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xa(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xb(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xd(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xe(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xf(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xcb1(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"1234\00"
@.str.1 = [6 x i8] c"%2.2x\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [16 x i8]
%8 = alloca i32
%9 = alloca [3 x i8]
%10 = alloca [33 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
%11 = bitcast [3 x i8]* %9 to i8*
%12 = bitcast [33 x i8]* %10 to i8*
%13 = load i8*, i8** %6
%14 = load i8*, i8** %6
%15 = call i32 @strlen(i8* %14)
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%17 = call i32 @MD5(i8* %13, i32 %15, i8* %16)
store i32 0, i32* %8
br label %18
18: ; preds = %31, %2
%19 = load i32, i32* %8
%20 = icmp slt i32 %19, 16
br i1 %20, label %21, label %34
21: ; preds = %18
%22 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %26)
%28 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%30 = call i32 @strcat(i8* %28, i8* %29)
br label %31
31: ; preds = %21
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %18
34: ; preds = %18
%35 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"1234\00"
@.str.1 = [6 x i8] c"%2.2x\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = alloca [3 x i8]
%5 = alloca [33 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @MD5(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %6)
%11 = load i8, i8* %6
%12 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %11)
%13 = call i32 @strcat(i8* %8, i8* %7)
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 1
%15 = load i8, i8* %14
%16 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %15)
%17 = call i32 @strcat(i8* %8, i8* %7)
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 2
%19 = load i8, i8* %18
%20 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %19)
%21 = call i32 @strcat(i8* %8, i8* %7)
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 3
%23 = load i8, i8* %22
%24 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %23)
%25 = call i32 @strcat(i8* %8, i8* %7)
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 4
%27 = load i8, i8* %26
%28 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %27)
%29 = call i32 @strcat(i8* %8, i8* %7)
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 5
%31 = load i8, i8* %30
%32 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %31)
%33 = call i32 @strcat(i8* %8, i8* %7)
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 6
%35 = load i8, i8* %34
%36 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %35)
%37 = call i32 @strcat(i8* %8, i8* %7)
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 7
%39 = load i8, i8* %38
%40 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %39)
%41 = call i32 @strcat(i8* %8, i8* %7)
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 8
%43 = load i8, i8* %42
%44 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %43)
%45 = call i32 @strcat(i8* %8, i8* %7)
%46 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 9
%47 = load i8, i8* %46
%48 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %47)
%49 = call i32 @strcat(i8* %8, i8* %7)
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 10
%51 = load i8, i8* %50
%52 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %51)
%53 = call i32 @strcat(i8* %8, i8* %7)
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 11
%55 = load i8, i8* %54
%56 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %55)
%57 = call i32 @strcat(i8* %8, i8* %7)
%58 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 12
%59 = load i8, i8* %58
%60 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %59)
%61 = call i32 @strcat(i8* %8, i8* %7)
%62 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 13
%63 = load i8, i8* %62
%64 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %63)
%65 = call i32 @strcat(i8* %8, i8* %7)
%66 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 14
%67 = load i8, i8* %66
%68 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %67)
%69 = call i32 @strcat(i8* %8, i8* %7)
%70 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 15
%71 = load i8, i8* %70
%72 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %71)
%73 = call i32 @strcat(i8* %8, i8* %7)
%74 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret i32 0
}