#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ md5(int *, size_t, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
size_t strlen(char *);
int main(int argc, char **argv) {
  char *msg = argv[1];
  size_t len;
  int i;
  uint8_t result[16];
  if (argc < 2) {
    printf("usage: %s 'string'\n", argv[0]);
    return 1;
  }
  len = strlen(msg);
  for (i = 0; i < 1000000; i++) {
    md5((uint8_t *)msg, len, result);
  }
  for (i = 0; i < 16; i++)
    printf("%2.2x", result[i]);
  puts("");
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1215 <main+0xd5>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0xf4240,-0x24(%rbp)
jge    11cd <main+0x8d>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1060 <md5@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a1 <main+0x61>
movl   $0x0,-0x24(%rbp)
cmpl   $0x10,-0x24(%rbp)
jge    1202 <main+0xc2>
movslq -0x24(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11d4 <main+0x94>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
cmp    $0x1,%edi
jg     116a <main+0x2a>
mov    (%rsi),%rsi
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebp
jmp    1295 <main+0x155>
mov    0x8(%rsi),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbp
mov    $0xf4240,%ebx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1060 <md5@plt>
add    $0xffffffff,%ebx
jne    1190 <main+0x50>
mov    (%rsp),%esi
lea    0xe67(%rip),%rbx
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"usage: %s 'string'\0A\00"
@.str.1 = [6 x i8] c"%2.2x\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca [16 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 1, i32* %3
br label %50
20: ; preds = %2
%21 = load i8*, i8** %6
%22 = call i64 @strlen(i8* %21)
store i64 %22, i64* %7
store i32 0, i32* %8
br label %23
23: ; preds = %32, %20
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 1000000
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load i8*, i8** %6
%28 = bitcast i8* %27 to i32*
%29 = load i64, i64* %7
%30 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 0
%31 = call i32 @md5(i32* %28, i64 %29, i32* %30)
br label %32
32: ; preds = %26
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %23
35: ; preds = %23
store i32 0, i32* %8
br label %36
36: ; preds = %45, %35
%37 = load i32, i32* %8
%38 = icmp slt i32 %37, 16
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %36
48: ; preds = %36
%49 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %50
50: ; preds = %48, %15
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@.str = [20 x i8] c"usage: %s 'string'\0A\00"
@.str.1 = [6 x i8] c"%2.2x\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i32]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = bitcast [16 x i32]* %3 to i8*
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %69
11: ; preds = %2
%12 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%13 = bitcast i8* %5 to i32*
%14 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
br label %15
15: ; preds = %11, %15
%16 = phi i32 [ 0, %11 ], [ %18, %15 ]
%17 = call i32 @md5(i32* %13, i64 %12, i32* %14)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, 1000000
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = load i32, i32* %14
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 1
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 2
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 3
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 4
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 5
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 6
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 7
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 8
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 9
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 10
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 11
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 12
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 13
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 14
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 15
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%68 = call i32 @putchar(i32 10)
br label %69
69: ; preds = %20, %8
%70 = phi i32 [ 1, %8 ], [ 0, %20 ]
ret i32 %70
}