#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 *, int /*<<< orphan*/);
void print_digest(unsigned char *p) {
  int i;
  for (i = 0; i < 16; ++i)
    printf("%02x", *p++);
}


x86 assembly (clang, -O0):
<print_digest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1159 <print_digest+0x49>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_digest+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_digest>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl (%rdi),%esi
lea    0xedf(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x2(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x3(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x4(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x5(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x6(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x7(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x8(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x9(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xa(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xb(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xc(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xd(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xe(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xf(%rbx),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
define void @print_digest(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 16
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = zext i8 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
ret void
}

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