#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*/ ChangeTHEX2CPTR(char *, char *);
int /*<<< orphan*/ printf_outHex(char *);
void test_ChangeTHEX2CPTR(void) {
  char buffer[256] = {0};
  ChangeTHEX2CPTR("E", buffer);
  printf_outHex(buffer);
  ChangeTHEX2CPTR("E5BC35", buffer);
  printf_outHex(buffer);
  ChangeTHEX2CPTR("EX4", buffer);
  printf_outHex(buffer);
  ChangeTHEX2CPTR("E5B", buffer);
  printf_outHex(buffer);
}


x86 assembly (clang, -O0):
<test_ChangeTHEX2CPTR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    -0x100(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1050 <ChangeTHEX2CPTR@plt>
lea    -0x100(%rbp),%rdi
call   1030 <printf_outHex@plt>
lea    -0x100(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1050 <ChangeTHEX2CPTR@plt>
lea    -0x100(%rbp),%rdi
call   1030 <printf_outHex@plt>
lea    -0x100(%rbp),%rsi
lea    0xe6f(%rip),%rdi
call   1050 <ChangeTHEX2CPTR@plt>
lea    -0x100(%rbp),%rdi
call   1030 <printf_outHex@plt>
lea    -0x100(%rbp),%rsi
lea    0xe54(%rip),%rdi
call   1050 <ChangeTHEX2CPTR@plt>
lea    -0x100(%rbp),%rdi
call   1030 <printf_outHex@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ChangeTHEX2CPTR>:
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe67(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <ChangeTHEX2CPTR@plt>
mov    %rbx,%rdi
call   1030 <printf_outHex@plt>
lea    0xe4f(%rip),%rdi
mov    %rbx,%rsi
call   1040 <ChangeTHEX2CPTR@plt>
mov    %rbx,%rdi
call   1030 <printf_outHex@plt>
lea    0xe3f(%rip),%rdi
mov    %rbx,%rsi
call   1040 <ChangeTHEX2CPTR@plt>
mov    %rbx,%rdi
call   1030 <printf_outHex@plt>
lea    0xe2c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <ChangeTHEX2CPTR@plt>
mov    %rbx,%rdi
call   1030 <printf_outHex@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"E\00"
@.str.1 = [7 x i8] c"E5BC35\00"
@.str.2 = [4 x i8] c"EX4\00"
@.str.3 = [4 x i8] c"E5B\00"
define void @test_ChangeTHEX2CPTR() {
%1 = alloca [256 x i8]
%2 = bitcast [256 x i8]* %1 to i8*
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf_outHex(i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%8 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%10 = call i32 @printf_outHex(i8* %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%12 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%14 = call i32 @printf_outHex(i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%16 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%18 = call i32 @printf_outHex(i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"E\00"
@.str.1 = [7 x i8] c"E5BC35\00"
@.str.2 = [4 x i8] c"EX4\00"
@.str.3 = [4 x i8] c"E5B\00"
define void @test_ChangeTHEX2CPTR() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf_outHex(i8* %2)
%5 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @printf_outHex(i8* %2)
%7 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%8 = call i32 @printf_outHex(i8* %2)
%9 = call i32 @ChangeTHEX2CPTR(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%10 = call i32 @printf_outHex(i8* %2)
ret void
}