#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 scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void blockToSTring(uint8_t block[16], char *str) {
  int i;
  for (i = 0; i < 16; i++) {
    sprintf(&str[2 * i], "%02X", (int)block[i]);
  }
  str[16 * 2] = 0;
}


x86 assembly (clang, -O0):
<blockToSTring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1168 <blockToSTring+0x58>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%edx
lea    0xeab(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <blockToSTring+0x17>
mov    -0x10(%rbp),%rax
movb   $0x0,0x20(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockToSTring>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%edx
lea    0xedc(%rip),%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x2(%rbx),%rdi
mov    0x8(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x4(%rbx),%rdi
mov    0x10(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x6(%rbx),%rdi
mov    0x18(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x8(%rbx),%rdi
mov    0x20(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0xa(%rbx),%rdi
mov    0x28(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0xc(%rbx),%rdi
mov    0x30(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0xe(%rbx),%rdi
mov    0x38(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x10(%rbx),%rdi
mov    0x40(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x12(%rbx),%rdi
mov    0x48(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x14(%rbx),%rdi
mov    0x50(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x16(%rbx),%rdi
mov    0x58(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x18(%rbx),%rdi
mov    0x60(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x1a(%rbx),%rdi
mov    0x68(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x1c(%rbx),%rdi
mov    0x70(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
lea    0x1e(%rbx),%rdi
mov    0x78(%r14),%edx
mov    %r15,%rsi
call   1030 <sprintf@plt>
movb   $0x0,0x20(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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