#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 /*<<< orphan*/ assert(int);
int myatoi(char *);
int main() {
  int i;
  i = myatoi("-2147483649");
  assert(i == INT_MIN);
  i = myatoi("2147483648");
  assert(i == INT_MAX);
  i = myatoi("-2147483648");
  assert(i == INT_MIN);
  i = myatoi("      -11919730356x");
  assert(i == INT_MIN);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <myatoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeaf(%rip),%rdi
call   1030 <myatoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe86(%rip),%rdi
call   1030 <myatoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e48(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe6a(%rip),%rdi
call   1030 <myatoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e20(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <myatoi@plt>
mov    0x2eac(%rip),%rbx
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   1040 <assert@plt>
lea    0xec5(%rip),%rdi
call   1030 <myatoi@plt>
mov    0x2e94(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   1040 <assert@plt>
lea    0xea4(%rip),%rdi
call   1030 <myatoi@plt>
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe97(%rip),%rdi
call   1030 <myatoi@plt>
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"-2147483649\00"
@INT_MIN = global i32 0
@.str.1 = [11 x i8] c"2147483648\00"
@INT_MAX = global i32 0
@.str.2 = [12 x i8] c"-2147483648\00"
@.str.3 = [20 x i8] c" -11919730356x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @myatoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @INT_MIN
%6 = icmp eq i32 %4, %5
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @myatoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* @INT_MAX
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @myatoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = load i32, i32* @INT_MIN
%18 = icmp eq i32 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @myatoi(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 %21, i32* %2
%22 = load i32, i32* %2
%23 = load i32, i32* @INT_MIN
%24 = icmp eq i32 %22, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"-2147483649\00"
@INT_MIN = global i32 0
@.str.1 = [11 x i8] c"2147483648\00"
@INT_MAX = global i32 0
@.str.2 = [12 x i8] c"-2147483648\00"
@.str.3 = [20 x i8] c" -11919730356x\00"
define i32 @main() {
%1 = tail call i32 @myatoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @INT_MIN
%3 = icmp eq i32 %1, %2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @myatoi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @INT_MAX
%8 = icmp eq i32 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @myatoi(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @INT_MIN
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @myatoi(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32, i32* @INT_MIN
%18 = icmp eq i32 %16, %17
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
ret i32 0
}