#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*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
void print_digest(unsigned char *digest) {
  int i;
  char mdString[33];
  mdString[32] = '\0';
  for (i = 0; i < 16; i++)
    sprintf(&mdString[i * 2], "%02x", (unsigned int)digest[i]);
  printf("%s\n", mdString);
}


x86 assembly (clang, -O0):
<print_digest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1176 <print_digest+0x56>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
lea    -0x30(%rbp),%rdi
add    %rax,%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe9d(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <print_digest+0x17>
lea    -0x30(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_digest>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movb   $0x0,0x20(%rsp)
movzbl (%rdi),%edx
lea    0xec5(%rip),%r15
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x2(%rsp),%rdi
movzbl 0x1(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x4(%rsp),%rdi
movzbl 0x2(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x6(%rsp),%rdi
movzbl 0x3(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x8(%rsp),%rdi
movzbl 0x4(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0xa(%rsp),%rdi
movzbl 0x5(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0xc(%rsp),%rdi
movzbl 0x6(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0xe(%rsp),%rdi
movzbl 0x7(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x10(%rsp),%rdi
movzbl 0x8(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x12(%rsp),%rdi
movzbl 0x9(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x14(%rsp),%rdi
movzbl 0xa(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x16(%rsp),%rdi
movzbl 0xb(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x18(%rsp),%rdi
movzbl 0xc(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x1a(%rsp),%rdi
movzbl 0xd(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x1c(%rsp),%rdi
movzbl 0xe(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0x1e(%rsp),%rdi
movzbl 0xf(%rbx),%edx
mov    %r15,%rsi
call   1040 <sprintf@plt>
lea    0xdb6(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @print_digest(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [33 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 32
store i8 0, i8* %5
store i32 0, i32* %3
br label %6
6: ; preds = %21, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 %12
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %9
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %6
24: ; preds = %6
%25 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %25)
ret void
}

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