#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 const, unsigned char const,
        unsigned char const, unsigned char const, unsigned char const,
        unsigned char const, unsigned char const, unsigned char const,
        unsigned char const, unsigned char const, unsigned char const,
        unsigned char const, unsigned char const, unsigned char const,
        unsigned char const, unsigned char const);
void write_hex(const unsigned char *md5, char *hexstr) {
  sprintf(hexstr,
          "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
          md5[0], md5[1], md5[2], md5[3], md5[4], md5[5], md5[6], md5[7],
          md5[8], md5[9], md5[10], md5[11], md5[12], md5[13], md5[14], md5[15]);
}


x86 assembly (clang, -O0):
<write_hex>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%dl
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x30(%rbp),%rax
mov    0x2(%rax),%r8b
mov    -0x30(%rbp),%rax
mov    0x3(%rax),%r9b
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%al
mov    -0x30(%rbp),%rsi
mov    0x5(%rsi),%sil
mov    %sil,-0x43(%rbp)
mov    -0x30(%rbp),%rsi
mov    0x6(%rsi),%sil
mov    %sil,-0x42(%rbp)
mov    -0x30(%rbp),%rsi
mov    0x7(%rsi),%sil
mov    %sil,-0x41(%rbp)
mov    -0x30(%rbp),%rsi
mov    0x8(%rsi),%r13b
mov    -0x30(%rbp),%rsi
mov    0x9(%rsi),%r12b
mov    -0x30(%rbp),%rsi
mov    0xa(%rsi),%r15b
mov    -0x30(%rbp),%rsi
mov    0xb(%rsi),%r14b
mov    -0x30(%rbp),%rsi
mov    0xc(%rsi),%bl
mov    -0x30(%rbp),%rsi
mov    0xd(%rsi),%r11b
mov    -0x30(%rbp),%rsi
mov    0xe(%rsi),%r10b
mov    -0x30(%rbp),%rsi
mov    %rsi,-0x40(%rbp)
lea    0xe42(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %al,%eax
mov    %eax,(%rsp)
mov    -0x43(%rbp),%al
movzbl %al,%eax
mov    %eax,0x8(%rsp)
mov    -0x42(%rbp),%al
movzbl %al,%eax
mov    %eax,0x10(%rsp)
mov    -0x41(%rbp),%al
movzbl %al,%eax
mov    %eax,0x18(%rsp)
mov    -0x40(%rbp),%rax
movzbl %r13b,%r13d
mov    %r13d,0x20(%rsp)
movzbl %r12b,%r12d
mov    %r12d,0x28(%rsp)
movzbl %r15b,%r15d
mov    %r15d,0x30(%rsp)
movzbl %r14b,%r14d
mov    %r14d,0x38(%rsp)
movzbl %bl,%ebx
mov    %ebx,0x40(%rsp)
movzbl %r11b,%r11d
mov    %r11d,0x48(%rsp)
movzbl %r10b,%r10d
mov    %r10d,0x50(%rsp)
movzbl 0xf(%rax),%eax
mov    %eax,0x58(%rsp)
call   1030 <sprintf@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_hex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movzbl (%rdi),%edx
movzbl 0x1(%rdi),%ecx
movzbl 0x2(%rdi),%r8d
movzbl 0x3(%rdi),%r9d
movzbl 0x4(%rdi),%eax
mov    %rax,0x20(%rsp)
movzbl 0x5(%rdi),%eax
mov    %rax,0x18(%rsp)
movzbl 0x6(%rdi),%eax
mov    %rax,0x10(%rsp)
movzbl 0x7(%rdi),%eax
mov    %rax,0x8(%rsp)
movzbl 0x8(%rdi),%r12d
movzbl 0x9(%rdi),%r13d
movzbl 0xa(%rdi),%r15d
movzbl 0xb(%rdi),%ebp
movzbl 0xc(%rdi),%r10d
movzbl 0xd(%rdi),%eax
movzbl 0xe(%rdi),%r11d
movzbl 0xf(%rdi),%ebx
lea    0xe81(%rip),%r14
mov    %rsi,%rdi
mov    %r14,%rsi
push   %rbx
push   %r11
push   %rax
push   %r10
push   %rbp
push   %r15
push   %r13
push   %r12
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
call   1030 <sprintf@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [65 x i8] c"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\00"
define void @write_hex(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 3
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %0, i64 4
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %0, i64 5
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %0, i64 6
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %0, i64 7
%17 = load i8, i8* %16
%18 = getelementptr inbounds i8, i8* %0, i64 8
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %0, i64 9
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %0, i64 10
%23 = load i8, i8* %22
%24 = getelementptr inbounds i8, i8* %0, i64 11
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %0, i64 12
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %0, i64 13
%29 = load i8, i8* %28
%30 = getelementptr inbounds i8, i8* %0, i64 14
%31 = load i8, i8* %30
%32 = getelementptr inbounds i8, i8* %0, i64 15
%33 = load i8, i8* %32
%34 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 zeroext %3, i8 zeroext %5, i8 zeroext %7, i8 zeroext %9, i8 zeroext %11, i8 zeroext %13, i8 zeroext %15, i8 zeroext %17, i8 zeroext %19, i8 zeroext %21, i8 zeroext %23, i8 zeroext %25, i8 zeroext %27, i8 zeroext %29, i8 zeroext %31, i8 zeroext %33)
ret void
}