#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 htoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("123A is: %d\n", htoi("123A\0"));
  printf("0xFF is: %d\n", htoi("0xFF\0"));
  printf("0XBB is: %d\n", htoi("0xBB\0"));
  printf("0xGG is: %d\n", htoi("0xGG\0"));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xf09(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
call   1040 <htoi@plt>
mov    %eax,%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf0c(%rip),%rdi
call   1040 <htoi@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
call   1040 <htoi@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
call   1040 <htoi@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
call   1040 <htoi@plt>
lea    0xea5(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"123A is: %d\0A\00"
@.str.1 = [6 x i8] c"123A\00\00"
@.str.2 = [13 x i8] c"0xFF is: %d\0A\00"
@.str.3 = [6 x i8] c"0xFF\00\00"
@.str.4 = [13 x i8] c"0XBB is: %d\0A\00"
@.str.5 = [6 x i8] c"0xBB\00\00"
@.str.6 = [13 x i8] c"0xGG is: %d\0A\00"
@.str.7 = [6 x i8] c"0xGG\00\00"
define i32 @main() {
%1 = call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %5)
%7 = call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"123A is: %d\0A\00"
@.str.1 = [6 x i8] c"123A\00\00"
@.str.2 = [13 x i8] c"0xFF is: %d\0A\00"
@.str.3 = [6 x i8] c"0xFF\00\00"
@.str.4 = [13 x i8] c"0XBB is: %d\0A\00"
@.str.5 = [6 x i8] c"0xBB\00\00"
@.str.6 = [13 x i8] c"0xGG is: %d\0A\00"
@.str.7 = [6 x i8] c"0xGG\00\00"
define i32 @main() {
%1 = tail call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = tail call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %5)
%7 = tail call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %7)
ret i32 0
}