#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*/ assert(int);
int os_atoi_alt(char *);
void test_atoi(void) {
  assert(os_atoi_alt("0") == 0);
  assert(os_atoi_alt("1") == 1);
  assert(os_atoi_alt("123456") == 123456);
  assert(os_atoi_alt("+245") == +245);
  assert(os_atoi_alt("-245") == -245);
  assert(os_atoi_alt("+912") == 912);
}


x86 assembly (clang, -O0):
<test_atoi>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <os_atoi_alt@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xebb(%rip),%rdi
call   1040 <os_atoi_alt@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xea1(%rip),%rdi
call   1040 <os_atoi_alt@plt>
cmp    $0x1e240,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe8a(%rip),%rdi
call   1040 <os_atoi_alt@plt>
cmp    $0xf5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe71(%rip),%rdi
call   1040 <os_atoi_alt@plt>
cmp    $0xffffff0b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe58(%rip),%rdi
call   1040 <os_atoi_alt@plt>
cmp    $0x390,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_atoi>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <os_atoi_alt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xec1(%rip),%rdi
call   1040 <os_atoi_alt@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xea9(%rip),%rdi
call   1040 <os_atoi_alt@plt>
xor    %edi,%edi
cmp    $0x1e240,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe94(%rip),%rdi
call   1040 <os_atoi_alt@plt>
xor    %edi,%edi
cmp    $0xf5,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe7d(%rip),%rdi
call   1040 <os_atoi_alt@plt>
xor    %edi,%edi
cmp    $0xffffff0b,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xe66(%rip),%rdi
call   1040 <os_atoi_alt@plt>
xor    %edi,%edi
cmp    $0x390,%eax
sete   %dil
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [7 x i8] c"123456\00"
@.str.3 = [5 x i8] c"+245\00"
@.str.4 = [5 x i8] c"-245\00"
@.str.5 = [5 x i8] c"+912\00"
define void @test_atoi() {
%1 = call i32 @os_atoi_alt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 @os_atoi_alt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @os_atoi_alt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 123456
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @os_atoi_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 245
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @os_atoi_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 %17, -245
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @os_atoi_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 %21, 912
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [7 x i8] c"123456\00"
@.str.3 = [5 x i8] c"+245\00"
@.str.4 = [5 x i8] c"-245\00"
@.str.5 = [5 x i8] c"+912\00"
define void @test_atoi() {
%1 = tail call i32 @os_atoi_alt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @os_atoi_alt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @os_atoi_alt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 123456
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @os_atoi_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 245
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @os_atoi_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 %17, -245
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @os_atoi_alt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 %21, 912
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
ret void
}