#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 INT_MAX;
int INT_MIN;
int myAtoi(char *);
int /*<<< orphan*/ printf(char *, int, ...);
void myAtoiMain(void) {
  printf("%d %d\n", INT_MAX, INT_MIN);
  printf("%d\n", myAtoi("-"));
  printf("%d\n", myAtoi("4294967297"));
  printf("%d\n", myAtoi("4294967396"));
  printf("%d\n", myAtoi("12345"));
  printf("%d\n", myAtoi("-12345"));
  printf("%d\n", myAtoi("0"));
  printf("%d\n", myAtoi("1"));
  printf("%d\n", myAtoi("-10"));
  printf("%d\n", myAtoi("+10"));
  printf("%d\n", myAtoi("    000010"));
  printf("%d\n", myAtoi("    +000011"));
  printf("%d\n", myAtoi("    -000011"));
  printf("%d\n", myAtoi("    -00001q1"));
  printf("%d\n", myAtoi("-2147483648"));
  printf("%d\n", myAtoi("-2147483649"));
  printf("%d\n", myAtoi("2147483647"));
  printf("%d\n", myAtoi("2147483648"));
}


x86 assembly (clang, -O0):
<myAtoiMain>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
mov    0x2eac(%rip),%rax
mov    (%rax),%edx
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe81(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe64(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe17(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdff(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde7(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd6(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc6(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb6(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda7(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd97(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd87(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd54(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %eax,%esi
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<myAtoiMain>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
call   1040 <myAtoi@plt>
lea    0xeaf(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe70(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe64(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe1b(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe07(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdfa(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdee(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde2(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdd7(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdcb(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdbf(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd90(%rip),%rdi
call   1040 <myAtoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
@INT_MAX = global i32 0
@INT_MIN = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [11 x i8] c"4294967297\00"
@.str.4 = [11 x i8] c"4294967396\00"
@.str.5 = [6 x i8] c"12345\00"
@.str.6 = [7 x i8] c"-12345\00"
@.str.7 = [2 x i8] c"0\00"
@.str.8 = [2 x i8] c"1\00"
@.str.9 = [4 x i8] c"-10\00"
@.str.10 = [4 x i8] c"+10\00"
@.str.11 = [11 x i8] c" 000010\00"
@.str.12 = [12 x i8] c" +000011\00"
@.str.13 = [12 x i8] c" -000011\00"
@.str.14 = [13 x i8] c" -00001q1\00"
@.str.15 = [12 x i8] c"-2147483648\00"
@.str.16 = [12 x i8] c"-2147483649\00"
@.str.17 = [11 x i8] c"2147483647\00"
@.str.18 = [11 x i8] c"2147483648\00"
define void @myAtoiMain() {
%1 = load i32, i32* @INT_MAX
%2 = load i32, i32* @INT_MIN
%3 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = call i32 @myAtoi(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @myAtoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 @myAtoi(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 @myAtoi(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 @myAtoi(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 @myAtoi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 @myAtoi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @myAtoi(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
@INT_MAX = global i32 0
@INT_MIN = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [11 x i8] c"4294967297\00"
@.str.4 = [11 x i8] c"4294967396\00"
@.str.5 = [6 x i8] c"12345\00"
@.str.6 = [7 x i8] c"-12345\00"
@.str.7 = [2 x i8] c"0\00"
@.str.8 = [2 x i8] c"1\00"
@.str.9 = [4 x i8] c"-10\00"
@.str.10 = [4 x i8] c"+10\00"
@.str.11 = [11 x i8] c" 000010\00"
@.str.12 = [12 x i8] c" +000011\00"
@.str.13 = [12 x i8] c" -000011\00"
@.str.14 = [13 x i8] c" -00001q1\00"
@.str.15 = [12 x i8] c"-2147483648\00"
@.str.16 = [12 x i8] c"-2147483649\00"
@.str.17 = [11 x i8] c"2147483647\00"
@.str.18 = [11 x i8] c"2147483648\00"
define void @myAtoiMain() {
%1 = load i32, i32* @INT_MAX
%2 = load i32, i32* @INT_MIN
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = tail call i32 @myAtoi(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 @myAtoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 @myAtoi(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @myAtoi(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i32 @myAtoi(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 @myAtoi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = tail call i32 @myAtoi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = tail call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%23 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = tail call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%25 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = tail call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
%27 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = tail call i32 @myAtoi(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%29 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = tail call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
%31 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = tail call i32 @myAtoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
%33 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = tail call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%35 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = tail call i32 @myAtoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%37 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
ret void
}