#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*/ fail_test(int);
int str_int(char *, int *);
void test_int() {
  int error;
  int i = str_int("+12345", &error);
  if (error || i != 12345)
    fail_test(49);
  ;
  i = str_int("123456789", &error);
  if (error || i != 123456789)
    fail_test(53);
  ;
  i = str_int("7", &error);
  if (error || i != 7)
    fail_test(57);
  ;
  i = str_int("-7", &error);
  if (error || i != -7)
    fail_test(61);
  ;
  i = str_int("0", &error);
  if (error || i != 0)
    fail_test(65);
  ;
  i = str_int("32asdfa32", &error);
  if (!error)
    fail_test(69);
  ;
  i = str_int("", &error);
  if (!error)
    fail_test(73);
  ;
  i = str_int(".", &error);
  if (!error)
    fail_test(77);
  ;
  i = str_int(" ", &error);
  if (!error)
    fail_test(81);
  ;
  i = str_int("123123123123", &error);
  if (!error)
    fail_test(85);
  ;
  i = str_int("-123123123123", &error);
  if (!error)
    fail_test(89);
  ;
}


x86 assembly (clang, -O0):
<test_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1152 <test_int+0x32>
cmpl   $0x3039,-0x8(%rbp)
je     115c <test_int+0x3c>
mov    $0x31,%edi
call   1030 <fail_test@plt>
lea    0xea4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1186 <test_int+0x66>
cmpl   $0x75bcd15,-0x8(%rbp)
je     1190 <test_int+0x70>
mov    $0x35,%edi
call   1030 <fail_test@plt>
lea    0xe7b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11b7 <test_int+0x97>
cmpl   $0x7,-0x8(%rbp)
je     11c1 <test_int+0xa1>
mov    $0x39,%edi
call   1030 <fail_test@plt>
lea    0xe49(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11e8 <test_int+0xc8>
cmpl   $0xfffffff9,-0x8(%rbp)
je     11f2 <test_int+0xd2>
mov    $0x3d,%edi
call   1030 <fail_test@plt>
lea    0xe1b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1219 <test_int+0xf9>
cmpl   $0x0,-0x8(%rbp)
je     1223 <test_int+0x103>
mov    $0x41,%edi
call   1030 <fail_test@plt>
lea    0xdec(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    124a <test_int+0x12a>
mov    $0x45,%edi
call   1030 <fail_test@plt>
lea    0xdd2(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1271 <test_int+0x151>
mov    $0x49,%edi
call   1030 <fail_test@plt>
lea    0xda8(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1298 <test_int+0x178>
mov    $0x4d,%edi
call   1030 <fail_test@plt>
lea    0xd83(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    12bf <test_int+0x19f>
mov    $0x51,%edi
call   1030 <fail_test@plt>
lea    0xd5f(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    12e6 <test_int+0x1c6>
mov    $0x55,%edi
call   1030 <fail_test@plt>
lea    0xd37(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <str_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    130d <test_int+0x1ed>
mov    $0x59,%edi
call   1030 <fail_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_int>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    1140 <test_int+0x20>
cmp    $0x3039,%eax
je     114a <test_int+0x2a>
mov    $0x31,%edi
call   1030 <fail_test@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    1169 <test_int+0x49>
cmp    $0x75bcd15,%eax
je     1173 <test_int+0x53>
mov    $0x35,%edi
call   1030 <fail_test@plt>
lea    0xe98(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    1190 <test_int+0x70>
cmp    $0x7,%eax
je     119a <test_int+0x7a>
mov    $0x39,%edi
call   1030 <fail_test@plt>
lea    0xe70(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    11b7 <test_int+0x97>
cmp    $0xfffffff9,%eax
je     11c1 <test_int+0xa1>
mov    $0x3d,%edi
call   1030 <fail_test@plt>
lea    0xe4c(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
or     0x4(%rsp),%eax
je     11e2 <test_int+0xc2>
mov    $0x41,%edi
call   1030 <fail_test@plt>
lea    0xe2d(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    1204 <test_int+0xe4>
mov    $0x45,%edi
call   1030 <fail_test@plt>
lea    0xe18(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    1226 <test_int+0x106>
mov    $0x49,%edi
call   1030 <fail_test@plt>
lea    0xdf3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    1248 <test_int+0x128>
mov    $0x4d,%edi
call   1030 <fail_test@plt>
lea    0xdd3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    126a <test_int+0x14a>
mov    $0x51,%edi
call   1030 <fail_test@plt>
lea    0xdb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
jne    128c <test_int+0x16c>
mov    $0x55,%edi
call   1030 <fail_test@plt>
lea    0xd91(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <str_int@plt>
cmpl   $0x0,0x4(%rsp)
je     12a6 <test_int+0x186>
pop    %rax
ret
mov    $0x59,%edi
call   1030 <fail_test@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"+12345\00"
@.str.1 = [10 x i8] c"123456789\00"
@.str.2 = [2 x i8] c"7\00"
@.str.3 = [3 x i8] c"-7\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [10 x i8] c"32asdfa32\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [2 x i8] c".\00"
@.str.8 = [2 x i8] c" \00"
@.str.9 = [13 x i8] c"123123123123\00"
@.str.10 = [14 x i8] c"-123123123123\00"
define void @test_int() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @str_int(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1)
store i32 %3, i32* %2
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 12345
br i1 %8, label %9, label %11
9: ; preds = %6, %0
%10 = call i32 @fail_test(i32 49)
br label %11
11: ; preds = %9, %6
%12 = call i32 @str_int(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 %12, i32* %2
%13 = load i32, i32* %1
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 123456789
br i1 %17, label %18, label %20
18: ; preds = %15, %11
%19 = call i32 @fail_test(i32 53)
br label %20
20: ; preds = %18, %15
%21 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %1)
store i32 %21, i32* %2
%22 = load i32, i32* %1
%23 = icmp ne i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 7
br i1 %26, label %27, label %29
27: ; preds = %24, %20
%28 = call i32 @fail_test(i32 57)
br label %29
29: ; preds = %27, %24
%30 = call i32 @str_int(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
store i32 %30, i32* %2
%31 = load i32, i32* %1
%32 = icmp ne i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = load i32, i32* %2
%35 = icmp ne i32 %34, -7
br i1 %35, label %36, label %38
36: ; preds = %33, %29
%37 = call i32 @fail_test(i32 61)
br label %38
38: ; preds = %36, %33
%39 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %1)
store i32 %39, i32* %2
%40 = load i32, i32* %1
%41 = icmp ne i32 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %38
%43 = load i32, i32* %2
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42, %38
%46 = call i32 @fail_test(i32 65)
br label %47
47: ; preds = %45, %42
%48 = call i32 @str_int(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32* %1)
store i32 %48, i32* %2
%49 = load i32, i32* %1
%50 = icmp ne i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %47
%52 = call i32 @fail_test(i32 69)
br label %53
53: ; preds = %51, %47
%54 = call i32 @str_int(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32* %1)
store i32 %54, i32* %2
%55 = load i32, i32* %1
%56 = icmp ne i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %53
%58 = call i32 @fail_test(i32 73)
br label %59
59: ; preds = %57, %53
%60 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32* %1)
store i32 %60, i32* %2
%61 = load i32, i32* %1
%62 = icmp ne i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %59
%64 = call i32 @fail_test(i32 77)
br label %65
65: ; preds = %63, %59
%66 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32* %1)
store i32 %66, i32* %2
%67 = load i32, i32* %1
%68 = icmp ne i32 %67, 0
br i1 %68, label %71, label %69
69: ; preds = %65
%70 = call i32 @fail_test(i32 81)
br label %71
71: ; preds = %69, %65
%72 = call i32 @str_int(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32* %1)
store i32 %72, i32* %2
%73 = load i32, i32* %1
%74 = icmp ne i32 %73, 0
br i1 %74, label %77, label %75
75: ; preds = %71
%76 = call i32 @fail_test(i32 85)
br label %77
77: ; preds = %75, %71
%78 = call i32 @str_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i32* %1)
store i32 %78, i32* %2
%79 = load i32, i32* %1
%80 = icmp ne i32 %79, 0
br i1 %80, label %83, label %81
81: ; preds = %77
%82 = call i32 @fail_test(i32 89)
br label %83
83: ; preds = %81, %77
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"+12345\00"
@.str.1 = [10 x i8] c"123456789\00"
@.str.2 = [2 x i8] c"7\00"
@.str.3 = [3 x i8] c"-7\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [10 x i8] c"32asdfa32\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [2 x i8] c".\00"
@.str.8 = [2 x i8] c" \00"
@.str.9 = [13 x i8] c"123123123123\00"
@.str.10 = [14 x i8] c"-123123123123\00"
define void @test_int() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @str_int(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
%6 = icmp ne i32 %3, 12345
%7 = select i1 %5, i1 true, i1 %6
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @fail_test(i32 49)
br label %10
10: ; preds = %0, %8
%11 = call i32 @str_int(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp ne i32 %12, 0
%14 = icmp ne i32 %11, 123456789
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @fail_test(i32 53)
br label %18
18: ; preds = %10, %16
%19 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%20 = load i32, i32* %1
%21 = icmp ne i32 %20, 0
%22 = icmp ne i32 %19, 7
%23 = select i1 %21, i1 true, i1 %22
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @fail_test(i32 57)
br label %26
26: ; preds = %18, %24
%27 = call i32 @str_int(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%28 = load i32, i32* %1
%29 = icmp ne i32 %28, 0
%30 = icmp ne i32 %27, -7
%31 = select i1 %29, i1 true, i1 %30
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 @fail_test(i32 61)
br label %34
34: ; preds = %26, %32
%35 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%36 = load i32, i32* %1
%37 = icmp ne i32 %36, 0
%38 = icmp ne i32 %35, 0
%39 = select i1 %37, i1 true, i1 %38
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = call i32 @fail_test(i32 65)
br label %42
42: ; preds = %34, %40
%43 = call i32 @str_int(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%44 = load i32, i32* %1
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @fail_test(i32 69)
br label %48
48: ; preds = %46, %42
%49 = call i32 @str_int(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%50 = load i32, i32* %1
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 @fail_test(i32 73)
br label %54
54: ; preds = %52, %48
%55 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%56 = load i32, i32* %1
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @fail_test(i32 77)
br label %60
60: ; preds = %58, %54
%61 = call i32 @str_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%62 = load i32, i32* %1
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = call i32 @fail_test(i32 81)
br label %66
66: ; preds = %64, %60
%67 = call i32 @str_int(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%68 = load i32, i32* %1
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %66
%71 = call i32 @fail_test(i32 85)
br label %72
72: ; preds = %70, %66
%73 = call i32 @str_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%74 = load i32, i32* %1
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 @fail_test(i32 89)
br label %78
78: ; preds = %76, %72
ret void
}