#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*/ htoi(char const **);
int main(void) {
  const char *s[10] = {"ff",     "0x3B",   "0XE7A9", "C0DE", "0aff",
                       "0xEJA9", "0HE7A9", "random", NULL};
  const char **s_ptr = s;
  while (*s_ptr) {
    htoi(s_ptr);
    ++s_ptr;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2c96(%rip),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
cmpq   $0x0,(%rax)
je     1174 <main+0x54>
mov    -0x68(%rbp),%rdi
call   1040 <htoi@plt>
mov    -0x68(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x68(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0x2cf4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2cd8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2cbc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2ca0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c84(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <htoi@plt>
cmpq   $0x0,0x8(%rbx)
lea    0x8(%rbx),%rbx
jne    1160 <main+0x50>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ff\00"
@.str.1 = [5 x i8] c"0x3B\00"
@.str.2 = [7 x i8] c"0XE7A9\00"
@.str.3 = [5 x i8] c"C0DE\00"
@.str.4 = [5 x i8] c"0aff\00"
@.str.5 = [7 x i8] c"0xEJA9\00"
@.str.6 = [7 x i8] c"0HE7A9\00"
@.str.7 = [7 x i8] c"random\00"
@__const.main.s = [10 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* null, i8* null]
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8*]
%3 = alloca i8**
store i32 0, i32* %1
%4 = bitcast [10 x i8*]* %2 to i8*
%5 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 0
store i8** %5, i8*** %3
br label %6
6: ; preds = %10, %0
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8**, i8*** %3
%12 = call i32 @htoi(i8** %11)
%13 = load i8**, i8*** %3
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %3
br label %6
15: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ff\00"
@.str.1 = [5 x i8] c"0x3B\00"
@.str.2 = [7 x i8] c"0XE7A9\00"
@.str.3 = [5 x i8] c"C0DE\00"
@.str.4 = [5 x i8] c"0aff\00"
@.str.5 = [7 x i8] c"0xEJA9\00"
@.str.6 = [7 x i8] c"0HE7A9\00"
@.str.7 = [7 x i8] c"random\00"
@__const.main.s = [10 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* null, i8* null]
define i32 @main() {
%1 = alloca [10 x i8*]
%2 = bitcast [10 x i8*]* %1 to i8*
%3 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 0
br label %4
4: ; preds = %0, %4
%5 = phi i8** [ %7, %4 ], [ %3, %0 ]
%6 = call i32 @htoi(i8** %5)
%7 = getelementptr inbounds i8*, i8** %5, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %4
10: ; preds = %4
ret i32 0
}