#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*/ char_array_to_c(char *, int, char *);
void hexencodemap() {
  static const char sHexChars[] = "0123456789ABCDEF";
  int i;
  char hexEncode1[256];
  char hexEncode2[256];
  for (i = 0; i < 256; ++i) {
    hexEncode1[i] = sHexChars[i >> 4];
    hexEncode2[i] = sHexChars[i & 0x0f];
  }
  char_array_to_c(hexEncode1, 256, "gsHexEncodeMap1");
  char_array_to_c(hexEncode2, 256, "gsHexEncodeMap2");
}


x86 assembly (clang, -O0):
<hexencodemap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1179 <hexencodemap+0x69>
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
movslq %eax,%rcx
lea    0xec1(%rip),%rax
mov    (%rax,%rcx,1),%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xea3(%rip),%rax
mov    (%rax,%rcx,1),%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x210(%rbp,%rax,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1122 <hexencodemap+0x12>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
lea    0xe85(%rip),%rdx
call   1030 <char_array_to_c@plt>
lea    -0x210(%rbp),%rdi
mov    $0x100,%esi
lea    0xe7d(%rip),%rdx
call   1030 <char_array_to_c@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexencodemap>:
sub    $0x208,%rsp
xor    %eax,%eax
lea    0xee0(%rip),%rdi
mov    %eax,%edx
shr    $0x4,%edx
movzbl (%rdx,%rdi,1),%edx
mov    %dl,0x100(%rsp,%rax,1)
mov    %eax,%esi
and    $0xe,%esi
movzbl (%rsi,%rdi,1),%ecx
mov    %cl,(%rsp,%rax,1)
lea    0x1(%rax),%ecx
mov    %dl,0x101(%rsp,%rax,1)
and    $0xf,%ecx
movzbl (%rcx,%rdi,1),%ecx
mov    %cl,0x1(%rsp,%rax,1)
add    $0x2,%rax
cmp    $0x100,%rax
jne    1120 <hexencodemap+0x10>
lea    0xead(%rip),%rdx
lea    0x100(%rsp),%rdi
mov    $0x100,%esi
call   1030 <char_array_to_c@plt>
lea    0xea4(%rip),%rdx
mov    %rsp,%rdi
mov    $0x100,%esi
call   1030 <char_array_to_c@plt>
add    $0x208,%rsp
ret

LLVM IR (-O0):
@hexencodemap.sHexChars = internal constant [17 x i8] c"0123456789ABCDEF\00"
@.str = [16 x i8] c"gsHexEncodeMap1\00"
@.str.1 = [16 x i8] c"gsHexEncodeMap2\00"
define void @hexencodemap() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %24, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 256
br i1 %6, label %7, label %27
7: ; preds = %4
%8 = load i32, i32* %1
%9 = ashr i32 %8, 4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @hexencodemap.sHexChars, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %14
store i8 %12, i8* %15
%16 = load i32, i32* %1
%17 = and i32 %16, 15
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [17 x i8], [17 x i8]* @hexencodemap.sHexChars, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %7
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %4
27: ; preds = %4
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%29 = call i32 @char_array_to_c(i8* %28, i32 256, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%31 = call i32 @char_array_to_c(i8* %30, i32 256, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@hexencodemap.sHexChars = internal unnamed_addr constant [17 x i8] c"0123456789ABCDEF\00"
@.str = [16 x i8] c"gsHexEncodeMap1\00"
@.str.1 = [16 x i8] c"gsHexEncodeMap2\00"
define void @hexencodemap() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ 0, %0 ], [ %26, %5 ]
%7 = lshr i64 %6, 4
%8 = and i64 %7, 268435455
%9 = getelementptr inbounds [17 x i8], [17 x i8]* @hexencodemap.sHexChars, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %6
store i8 %10, i8* %11
%12 = and i64 %6, 14
%13 = getelementptr inbounds [17 x i8], [17 x i8]* @hexencodemap.sHexChars, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %6
store i8 %14, i8* %15
%16 = or i64 %6, 1
%17 = lshr i64 %6, 4
%18 = and i64 %17, 268435455
%19 = getelementptr inbounds [17 x i8], [17 x i8]* @hexencodemap.sHexChars, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %16
store i8 %20, i8* %21
%22 = and i64 %16, 15
%23 = getelementptr inbounds [17 x i8], [17 x i8]* @hexencodemap.sHexChars, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %16
store i8 %24, i8* %25
%26 = add nuw nsw i64 %6, 2
%27 = icmp eq i64 %26, 256
br i1 %27, label %28, label %5
28: ; preds = %5
%29 = call i32 @char_array_to_c(i8* %3, i32 256, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @char_array_to_c(i8* %4, i32 256, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}