#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*/ sprintf(char *, char *, unsigned char);
void auth_readablesum(unsigned char *md5sum, char *readable) {
  unsigned int i;
  char *s = readable;
  for (i = 0; i < 16; ++i, s += 2) {
    sprintf(s, "%.2x", md5sum[i]);
  }
}


x86 assembly (clang, -O0):
<auth_readablesum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jae    116e <auth_readablesum+0x5e>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
lea    0xeb5(%rip),%rsi
movzbl (%rax,%rcx,1),%edx
call   1030 <sprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    112f <auth_readablesum+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auth_readablesum>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
movzbl (%rdi),%edx
lea    0xedb(%rip),%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x2(%rbx),%rdi
movzbl 0x1(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x4(%rbx),%rdi
movzbl 0x2(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x6(%rbx),%rdi
movzbl 0x3(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x8(%rbx),%rdi
movzbl 0x4(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0xa(%rbx),%rdi
movzbl 0x5(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0xc(%rbx),%rdi
movzbl 0x6(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0xe(%rbx),%rdi
movzbl 0x7(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x10(%rbx),%rdi
movzbl 0x8(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x12(%rbx),%rdi
movzbl 0x9(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x14(%rbx),%rdi
movzbl 0xa(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x16(%rbx),%rdi
movzbl 0xb(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x18(%rbx),%rdi
movzbl 0xc(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x1a(%rbx),%rdi
movzbl 0xd(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x1c(%rbx),%rdi
movzbl 0xe(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
add    $0x1e,%rbx
movzbl 0xf(%r14),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sprintf@plt>

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

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