#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 */
typedef int /*<<< orphan*/ MD5_CTX;

/* Variables and functions */
int /*<<< orphan*/ MD5_Final(unsigned char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ MD5_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ MD5_Update(int /*<<< orphan*/ *, unsigned char *,
                              int /*<<< orphan*/);
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) {
  MD5_CTX ctx;
  unsigned char *data = "1234";
  unsigned char md[16];
  char buf[33] = {'\0'};
  char tmp[3] = {'\0'};
  int i;
  MD5_Init(&ctx);
  MD5_Update(&ctx, data, strlen(data));
  MD5_Final(md, &ctx);
  for (i = 0; i < 16; i++) {
    sprintf(tmp, "%02x", 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    0xe63(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1060 <memset@plt>
lea    -0x63(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1060 <memset@plt>
lea    -0x14(%rbp),%rdi
call   1080 <MD5_Init@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x70(%rbp),%rsi
mov    %eax,%edx
lea    -0x14(%rbp),%rdi
call   10a0 <MD5_Update@plt>
lea    -0x30(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <MD5_Final@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0x10,-0x68(%rbp)
jge    123c <main+0xbc>
lea    -0x63(%rbp),%rdi
movslq -0x68(%rbp),%rax
lea    0xdee(%rip),%rsi
movzbl -0x30(%rbp,%rax,1),%edx
call   1090 <sprintf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x63(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11fe <main+0x7e>
lea    -0x60(%rbp),%rsi
lea    0xdc3(%rip),%rdi
call   1050 <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
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x40(%rsp)
movb   $0x0,0x1a(%rsp)
movw   $0x0,0x18(%rsp)
lea    0x1c(%rsp),%r14
mov    %r14,%rdi
call   1070 <MD5_Init@plt>
lea    0xe55(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1090 <MD5_Update@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <MD5_Final@plt>
movzbl (%rsp),%edx
lea    0xe2f(%rip),%r15
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <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   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x2(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x3(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x5(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x6(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x7(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0x9(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xa(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xb(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xd(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xe(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
movzbl 0xf(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xc78(%rip),%rdi
mov    %r14,%rsi
call   1050 <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 = [5 x i8] c"%02x\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 i32
%7 = alloca i8*
%8 = alloca [16 x i8]
%9 = alloca [33 x i8]
%10 = alloca [3 x i8]
%11 = alloca i32
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** %7
%12 = bitcast [33 x i8]* %9 to i8*
%13 = bitcast [3 x i8]* %10 to i8*
%14 = call i32 @MD5_Init(i32* %6)
%15 = load i8*, i8** %7
%16 = load i8*, i8** %7
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @MD5_Update(i32* %6, i8* %15, i32 %17)
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%20 = call i32 @MD5_Final(i8* %19, i32* %6)
store i32 0, i32* %11
br label %21
21: ; preds = %34, %2
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 16
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %29)
%31 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%33 = call i32 @strcat(i8* %31, i8* %32)
br label %34
34: ; preds = %24
%35 = load i32, i32* %11
%36 = add nsw i32 %35, 1
store i32 %36, i32* %11
br label %21
37: ; preds = %21
%38 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %38)
ret i32 0
}

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