#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);
long long str_long(char *, int *);
void test_long() {
  int error;
  long long res = str_long("12345", &error);
  if (error || res != 12345)
    fail_test(97);
  ;
  res = str_long("+9223372036854775807", &error);
  if (error || res != 9223372036854775807LL)
    fail_test(101);
  ;
  res = str_long("7", &error);
  if (error || res != 7LL)
    fail_test(105);
  ;
  res = str_long("-7", &error);
  if (error || res != -7LL)
    fail_test(109);
  ;
  res = str_long("0", &error);
  if (error || res != 0LL)
    fail_test(113);
  ;
  res = str_long("32asdfa32", &error);
  if (!error)
    fail_test(117);
  ;
  res = str_long("", &error);
  if (!error)
    fail_test(121);
  ;
  res = str_long(".", &error);
  if (!error)
    fail_test(125);
  ;
  res = str_long(" ", &error);
  if (!error)
    fail_test(129);
  ;
  res = str_long("9223372036854775808", &error);
  if (!error)
    fail_test(133);
  ;
  res = str_long("-9223372036854775809", &error);
  if (!error)
    fail_test(137);
  ;
}


x86 assembly (clang, -O0):
<test_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1154 <test_long+0x34>
cmpq   $0x3039,-0x10(%rbp)
je     115e <test_long+0x3e>
mov    $0x61,%edi
call   1040 <fail_test@plt>
lea    0xea1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1190 <test_long+0x70>
movabs $0x7fffffffffffffff,%rax
ff ff 7f
cmp    %rax,-0x10(%rbp)
je     119a <test_long+0x7a>
mov    $0x65,%edi
call   1040 <fail_test@plt>
lea    0xe7b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11c3 <test_long+0xa3>
cmpq   $0x7,-0x10(%rbp)
je     11cd <test_long+0xad>
mov    $0x69,%edi
call   1040 <fail_test@plt>
lea    0xe47(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11f6 <test_long+0xd6>
cmpq   $0xfffffffffffffff9,-0x10(%rbp)
je     1200 <test_long+0xe0>
mov    $0x6d,%edi
call   1040 <fail_test@plt>
lea    0xe17(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1229 <test_long+0x109>
cmpq   $0x0,-0x10(%rbp)
je     1233 <test_long+0x113>
mov    $0x71,%edi
call   1040 <fail_test@plt>
lea    0xde6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    125b <test_long+0x13b>
mov    $0x75,%edi
call   1040 <fail_test@plt>
lea    0xdcb(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1283 <test_long+0x163>
mov    $0x79,%edi
call   1040 <fail_test@plt>
lea    0xda0(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    12ab <test_long+0x18b>
mov    $0x7d,%edi
call   1040 <fail_test@plt>
lea    0xd7a(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    12d3 <test_long+0x1b3>
mov    $0x81,%edi
call   1040 <fail_test@plt>
lea    0xd54(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    12fb <test_long+0x1db>
mov    $0x85,%edi
call   1040 <fail_test@plt>
lea    0xd40(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <str_long@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1323 <test_long+0x203>
mov    $0x89,%edi
call   1040 <fail_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_long>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    1141 <test_long+0x21>
cmp    $0x3039,%rax
je     114b <test_long+0x2b>
mov    $0x61,%edi
call   1040 <fail_test@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    1172 <test_long+0x52>
movabs $0x7fffffffffffffff,%rcx
ff ff 7f
cmp    %rcx,%rax
je     117c <test_long+0x5c>
mov    $0x65,%edi
call   1040 <fail_test@plt>
lea    0xe99(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    119a <test_long+0x7a>
cmp    $0x7,%rax
je     11a4 <test_long+0x84>
mov    $0x69,%edi
call   1040 <fail_test@plt>
lea    0xe70(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    11c2 <test_long+0xa2>
cmp    $0xfffffffffffffff9,%rax
je     11cc <test_long+0xac>
mov    $0x6d,%edi
call   1040 <fail_test@plt>
lea    0xe4b(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    11e9 <test_long+0xc9>
test   %rax,%rax
je     11f3 <test_long+0xd3>
mov    $0x71,%edi
call   1040 <fail_test@plt>
lea    0xe26(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    1215 <test_long+0xf5>
mov    $0x75,%edi
call   1040 <fail_test@plt>
lea    0xe11(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    1237 <test_long+0x117>
mov    $0x79,%edi
call   1040 <fail_test@plt>
lea    0xdec(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    1259 <test_long+0x139>
mov    $0x7d,%edi
call   1040 <fail_test@plt>
lea    0xdcc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    127b <test_long+0x15b>
mov    $0x81,%edi
call   1040 <fail_test@plt>
lea    0xdac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
jne    129d <test_long+0x17d>
mov    $0x85,%edi
call   1040 <fail_test@plt>
lea    0xd9e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <str_long@plt>
cmpl   $0x0,0x4(%rsp)
je     12b7 <test_long+0x197>
pop    %rax
ret
mov    $0x89,%edi
call   1040 <fail_test@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"12345\00"
@.str.1 = [21 x i8] c"+9223372036854775807\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 = [20 x i8] c"9223372036854775808\00"
@.str.10 = [21 x i8] c"-9223372036854775809\00"
define void @test_long() {
%1 = alloca i32
%2 = alloca i64
%3 = call i64 @str_long(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1)
store i64 %3, i64* %2
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i64, i64* %2
%8 = icmp ne i64 %7, 12345
br i1 %8, label %9, label %11
9: ; preds = %6, %0
%10 = call i32 @fail_test(i32 97)
br label %11
11: ; preds = %9, %6
%12 = call i64 @str_long(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i64 %12, i64* %2
%13 = load i32, i32* %1
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load i64, i64* %2
%17 = icmp ne i64 %16, 9223372036854775807
br i1 %17, label %18, label %20
18: ; preds = %15, %11
%19 = call i32 @fail_test(i32 101)
br label %20
20: ; preds = %18, %15
%21 = call i64 @str_long(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %1)
store i64 %21, i64* %2
%22 = load i32, i32* %1
%23 = icmp ne i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = load i64, i64* %2
%26 = icmp ne i64 %25, 7
br i1 %26, label %27, label %29
27: ; preds = %24, %20
%28 = call i32 @fail_test(i32 105)
br label %29
29: ; preds = %27, %24
%30 = call i64 @str_long(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
store i64 %30, i64* %2
%31 = load i32, i32* %1
%32 = icmp ne i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = load i64, i64* %2
%35 = icmp ne i64 %34, -7
br i1 %35, label %36, label %38
36: ; preds = %33, %29
%37 = call i32 @fail_test(i32 109)
br label %38
38: ; preds = %36, %33
%39 = call i64 @str_long(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %1)
store i64 %39, i64* %2
%40 = load i32, i32* %1
%41 = icmp ne i32 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %38
%43 = load i64, i64* %2
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42, %38
%46 = call i32 @fail_test(i32 113)
br label %47
47: ; preds = %45, %42
%48 = call i64 @str_long(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32* %1)
store i64 %48, i64* %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 117)
br label %53
53: ; preds = %51, %47
%54 = call i64 @str_long(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32* %1)
store i64 %54, i64* %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 121)
br label %59
59: ; preds = %57, %53
%60 = call i64 @str_long(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32* %1)
store i64 %60, i64* %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 125)
br label %65
65: ; preds = %63, %59
%66 = call i64 @str_long(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32* %1)
store i64 %66, i64* %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 129)
br label %71
71: ; preds = %69, %65
%72 = call i64 @str_long(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32* %1)
store i64 %72, i64* %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 133)
br label %77
77: ; preds = %75, %71
%78 = call i64 @str_long(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32* %1)
store i64 %78, i64* %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 137)
br label %83
83: ; preds = %81, %77
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"12345\00"
@.str.1 = [21 x i8] c"+9223372036854775807\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 = [20 x i8] c"9223372036854775808\00"
@.str.10 = [21 x i8] c"-9223372036854775809\00"
define void @test_long() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @str_long(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
%6 = icmp ne i64 %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 97)
br label %10
10: ; preds = %0, %8
%11 = call i64 @str_long(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp ne i32 %12, 0
%14 = icmp ne i64 %11, 9223372036854775807
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @fail_test(i32 101)
br label %18
18: ; preds = %10, %16
%19 = call i64 @str_long(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 i64 %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 105)
br label %26
26: ; preds = %18, %24
%27 = call i64 @str_long(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 i64 %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 109)
br label %34
34: ; preds = %26, %32
%35 = call i64 @str_long(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 i64 %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 113)
br label %42
42: ; preds = %34, %40
%43 = call i64 @str_long(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 117)
br label %48
48: ; preds = %46, %42
%49 = call i64 @str_long(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 121)
br label %54
54: ; preds = %52, %48
%55 = call i64 @str_long(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 125)
br label %60
60: ; preds = %58, %54
%61 = call i64 @str_long(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 129)
br label %66
66: ; preds = %64, %60
%67 = call i64 @str_long(i8* getelementptr inbounds ([20 x i8], [20 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 133)
br label %72
72: ; preds = %70, %66
%73 = call i64 @str_long(i8* getelementptr inbounds ([21 x i8], [21 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 137)
br label %78
78: ; preds = %76, %72
ret void
}