#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);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ stringToBytes(char const *, unsigned char *);
void hexToAscii(const char *s_hex, char *s) {
  int i;
  char tmp[2] = "";
  unsigned char b_s_hex[16];
  strcpy(s, "");
  stringToBytes(s_hex, b_s_hex);
  for (i = 0; i < 16; i++) {
    sprintf(tmp, "%c", b_s_hex[i]);
    strcat(s, tmp);
  }
}


x86 assembly (clang, -O0):
<hexToAscii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x16(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <stringToBytes@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11d2 <hexToAscii+0x82>
lea    -0x16(%rbp),%rdi
movslq -0x14(%rbp),%rax
lea    0xe53(%rip),%rsi
movzbl -0x30(%rbp,%rax,1),%edx
call   1070 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <hexToAscii+0x44>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexToAscii>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movw   $0x0,0xe(%rsp)
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <stringToBytes@plt>
mov    0x10(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
lea    0xe(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x11(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x12(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x13(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x14(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x15(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x16(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x17(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x18(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x19(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x1a(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x1b(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x1c(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x1d(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x1e(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    0x1f(%rsp),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @hexToAscii(i8* %0, i8* %1) {
%3 = alloca i16
%4 = alloca [16 x i8]
%5 = bitcast i16* %3 to i8*
store i16 0, i16* %3
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @stringToBytes(i8* %0, i8* %6)
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %6
store i8 %10, i8* %5
store i8 0, i8* %9
%11 = call i32 @strcat(i8* %1, i8* %5)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 1
%13 = load i8, i8* %12
store i8 %13, i8* %5
store i8 0, i8* %9
%14 = call i32 @strcat(i8* %1, i8* %5)
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 2
%16 = load i8, i8* %15
store i8 %16, i8* %5
store i8 0, i8* %9
%17 = call i32 @strcat(i8* %1, i8* %5)
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 3
%19 = load i8, i8* %18
store i8 %19, i8* %5
store i8 0, i8* %9
%20 = call i32 @strcat(i8* %1, i8* %5)
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 4
%22 = load i8, i8* %21
store i8 %22, i8* %5
store i8 0, i8* %9
%23 = call i32 @strcat(i8* %1, i8* %5)
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 5
%25 = load i8, i8* %24
store i8 %25, i8* %5
store i8 0, i8* %9
%26 = call i32 @strcat(i8* %1, i8* %5)
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 6
%28 = load i8, i8* %27
store i8 %28, i8* %5
store i8 0, i8* %9
%29 = call i32 @strcat(i8* %1, i8* %5)
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 7
%31 = load i8, i8* %30
store i8 %31, i8* %5
store i8 0, i8* %9
%32 = call i32 @strcat(i8* %1, i8* %5)
%33 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 8
%34 = load i8, i8* %33
store i8 %34, i8* %5
store i8 0, i8* %9
%35 = call i32 @strcat(i8* %1, i8* %5)
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 9
%37 = load i8, i8* %36
store i8 %37, i8* %5
store i8 0, i8* %9
%38 = call i32 @strcat(i8* %1, i8* %5)
%39 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 10
%40 = load i8, i8* %39
store i8 %40, i8* %5
store i8 0, i8* %9
%41 = call i32 @strcat(i8* %1, i8* %5)
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 11
%43 = load i8, i8* %42
store i8 %43, i8* %5
store i8 0, i8* %9
%44 = call i32 @strcat(i8* %1, i8* %5)
%45 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 12
%46 = load i8, i8* %45
store i8 %46, i8* %5
store i8 0, i8* %9
%47 = call i32 @strcat(i8* %1, i8* %5)
%48 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 13
%49 = load i8, i8* %48
store i8 %49, i8* %5
store i8 0, i8* %9
%50 = call i32 @strcat(i8* %1, i8* %5)
%51 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 14
%52 = load i8, i8* %51
store i8 %52, i8* %5
store i8 0, i8* %9
%53 = call i32 @strcat(i8* %1, i8* %5)
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 15
%55 = load i8, i8* %54
store i8 %55, i8* %5
store i8 0, i8* %9
%56 = call i32 @strcat(i8* %1, i8* %5)
ret void
}