#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 *);
int /*<<< orphan*/ printf(char *, char *, ...);
int main() {
  printf("%s\t\t%s\t%s\n", "Test", "Expected", "Actual");
  printf("%s\t\t%s\t%s\n", "----", "--------", "------");
  printf("%s\t\t%ld\t\t%ld\n", "0x07e3", 2019L, htoi("0x07e3"));
  printf("%s\t\t%ld\t\t%ld\n", "0XFF", 255L, htoi("0XFF"));
  printf("%s\t\t%ld\t\t%ld\n", "07e3", 2019L, htoi("07e3"));
  printf("%s\t\t%ld\t\t%ld\n", "0x07OK", 7L, htoi("0x07OK"));
  printf("%s\t\t%ld\t\t%ld\n", "X1234", 0L, htoi("X1234"));
  printf("%s\t%ld\t\t%ld\n", "0xffffffff00", -256L, htoi("0xffffffff00"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xece(%rip),%rsi
lea    0xecc(%rip),%rdx
lea    0xece(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    0xec4(%rip),%rsi
lea    0xeb9(%rip),%rdx
lea    0xeb4(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%ecx
lea    0xe9f(%rip),%rdi
lea    0xea6(%rip),%rsi
mov    $0x7e3,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%ecx
lea    0xe77(%rip),%rdi
lea    0xe85(%rip),%rsi
mov    $0xff,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%ecx
lea    0xe4f(%rip),%rdi
lea    0xe58(%rip),%rsi
mov    $0x7e3,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%ecx
lea    0xe27(%rip),%rdi
lea    0xe3a(%rip),%rsi
mov    $0x7,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%ecx
lea    0xdff(%rip),%rdi
lea    0xe19(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1a(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%ecx
lea    0xdff(%rip),%rdi
lea    0xe05(%rip),%rsi
mov    $0xffffffffffffff00,%rdx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
lea    0xed9(%rip),%rsi
lea    0xed7(%rip),%rdx
lea    0xed9(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rsi
lea    0xec8(%rip),%rdx
lea    0xec3(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
lea    0xeaa(%rip),%r14
mov    $0x7e3,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
mov    $0xff,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7c(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
mov    $0x7e3,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe63(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
mov    $0x7,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe47(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe3a(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
lea    0xe1e(%rip),%rdi
mov    %rbx,%rsi
mov    $0xffffffffffffff00,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s\09\09%s\09%s\0A\00"
@.str.1 = [5 x i8] c"Test\00"
@.str.2 = [9 x i8] c"Expected\00"
@.str.3 = [7 x i8] c"Actual\00"
@.str.4 = [5 x i8] c"----\00"
@.str.5 = [9 x i8] c"--------\00"
@.str.6 = [7 x i8] c"------\00"
@.str.7 = [14 x i8] c"%s\09\09%ld\09\09%ld\0A\00"
@.str.8 = [7 x i8] c"0x07e3\00"
@.str.9 = [5 x i8] c"0XFF\00"
@.str.10 = [5 x i8] c"07e3\00"
@.str.11 = [7 x i8] c"0x07OK\00"
@.str.12 = [6 x i8] c"X1234\00"
@.str.13 = [13 x i8] c"%s\09%ld\09\09%ld\0A\00"
@.str.14 = [13 x i8] c"0xffffffff00\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%3 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%4 = call i32 @htoi(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%5 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i64 2019, i32 %4)
%6 = call i32 @htoi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%7 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i64 255, i32 %6)
%8 = call i32 @htoi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%9 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i64 2019, i32 %8)
%10 = call i32 @htoi(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%11 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i64 7, i32 %10)
%12 = call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i64 0, i32 %12)
%14 = call i32 @htoi(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i64 -256, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s\09\09%s\09%s\0A\00"
@.str.1 = [5 x i8] c"Test\00"
@.str.2 = [9 x i8] c"Expected\00"
@.str.3 = [7 x i8] c"Actual\00"
@.str.4 = [5 x i8] c"----\00"
@.str.5 = [9 x i8] c"--------\00"
@.str.6 = [7 x i8] c"------\00"
@.str.7 = [14 x i8] c"%s\09\09%ld\09\09%ld\0A\00"
@.str.8 = [7 x i8] c"0x07e3\00"
@.str.9 = [5 x i8] c"0XFF\00"
@.str.10 = [5 x i8] c"07e3\00"
@.str.11 = [7 x i8] c"0x07OK\00"
@.str.12 = [6 x i8] c"X1234\00"
@.str.13 = [13 x i8] c"%s\09%ld\09\09%ld\0A\00"
@.str.14 = [13 x i8] c"0xffffffff00\00"
define i32 @main() {
%1 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%3 = tail call i32 @htoi(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i64 2019, i32 %3)
%5 = tail call i32 @htoi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i64 255, i32 %5)
%7 = tail call i32 @htoi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i64 2019, i32 %7)
%9 = tail call i32 @htoi(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i64 7, i32 %9)
%11 = tail call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i64 0, i32 %11)
%13 = tail call i32 @htoi(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%14 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i64 -256, i32 %13)
ret i32 0
}