#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*/ pchar;

/* Variables and functions */
unsigned char *MD5(unsigned char *, int, unsigned char *);
int MD5_DIGEST_LENGTH;
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  unsigned char pchar[] = "password";
  unsigned char hash[MD5_DIGEST_LENGTH];
  printf("%i\n", MD5_DIGEST_LENGTH);
  unsigned char *cp = NULL;
  cp = MD5(pchar, sizeof(pchar), hash);
  int cou = 0;
  while (cp[cou]) {
    printf("%02x", (unsigned char)cp[cou++]);
  }
  printf("\nSize of MD5 strng = %i\n", cou);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x64726f7773736170,%rax
6f 72 64
mov    %rax,-0x20(%rbp)
movb   $0x0,-0x18(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%rdx
movq   $0x0,-0x38(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x9,%esi
call   1040 <MD5@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     11e7 <main+0xc7>
mov    -0x38(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x3c(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
jmp    11ae <main+0x8e>
mov    -0x3c(%rbp),%esi
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r12
movabs $0x64726f7773736170,%rax
6f 72 64
mov    %rax,-0x38(%rbp)
movb   $0x0,-0x30(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rbx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rbx
mov    %rbx,%rsp
mov    (%rax),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    -0x38(%rbp),%rdi
mov    $0x9,%esi
mov    %rbx,%rdx
call   1040 <MD5@plt>
mov    %rax,%r14
mov    (%rax),%al
xor    %r13d,%r13d
test   %al,%al
je     11bc <main+0x9c>
lea    0xe77(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rbx
add    $0x1,%r13
movzbl %al,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
movzbl 0x1(%r14,%rbx,1),%eax
test   %al,%al
jne    11a0 <main+0x80>
lea    0xe4b(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.pchar = [9 x i8] c"password\00"
@MD5_DIGEST_LENGTH = global i32 0
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [25 x i8] c"\0ASize of MD5 strng = %i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8]
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [9 x i8]* %6 to i8*
%12 = load i32, i32* @MD5_DIGEST_LENGTH
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %7
%15 = alloca i8, i64 %13
store i64 %13, i64* %8
%16 = load i32, i32* @MD5_DIGEST_LENGTH
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
store i8* null, i8** %9
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%19 = call i8* @MD5(i8* %18, i32 9, i8* %15)
store i8* %19, i8** %9
store i32 0, i32* %10
br label %20
20: ; preds = %27, %2
%21 = load i8*, i8** %9
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i8*, i8** %9
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
store i32 %30, i32* %10
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %20
36: ; preds = %20
%37 = load i32, i32* %10
%38 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %37)
store i32 0, i32* %3
%39 = load i8*, i8** %7
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@__const.main.pchar = [9 x i8] c"password\00"
@MD5_DIGEST_LENGTH = global i32 0
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [25 x i8] c"\0ASize of MD5 strng = %i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x i8]
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @MD5_DIGEST_LENGTH
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = load i32, i32* @MD5_DIGEST_LENGTH
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i8* @MD5(i8* %4, i32 9, i8* %8)
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %25, label %14
14: ; preds = %2, %14
%15 = phi i64 [ %17, %14 ], [ 0, %2 ]
%16 = phi i8 [ %21, %14 ], [ %12, %2 ]
%17 = add nuw i64 %15, 1
%18 = zext i8 %16 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds i8, i8* %11, i64 %17
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %14
23: ; preds = %14
%24 = trunc i64 %17 to i32
br label %25
25: ; preds = %23, %2
%26 = phi i32 [ 0, %2 ], [ %24, %23 ]
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %26)
ret i32 0
}