#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 */
long long INT_MAX;
long long INT_MIN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
long long strtoll(char const *, char **, int);
int stoI4(const char *X, int *ptr_Y) {
  int status = 0;
  char *endptr;
  long long Y;
  if ((X == NULL) || (*X == '\0')) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 130,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  Y = strtoll(X, &endptr, 10);
  if ((*endptr != '\0') && (*endptr != '\n')) {
    fprintf(stderr, "endptr = [%s]\n", endptr);
    fprintf(stderr, "X = [%s]\n", X);
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 135,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  if ((Y < INT_MIN) || (Y > INT_MAX)) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 137,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  *ptr_Y = Y;
BYE:
  return status;
}


x86 assembly (clang, -O0):
<stoI4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1152 <stoI4+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1181 <stoI4+0x61>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
mov    $0x82,%edx
lea    0xea8(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    127f <stoI4+0x15f>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     121c <stoI4+0xfc>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     121c <stoI4+0xfc>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xef2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xe03(%rip),%rsi
mov    $0x87,%edx
lea    0xe0d(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    127f <stoI4+0x15f>
mov    -0x28(%rbp),%rax
mov    0x2db9(%rip),%rcx
cmp    (%rcx),%rax
jl     1244 <stoI4+0x124>
mov    -0x28(%rbp),%rax
mov    0x2dad(%rip),%rcx
cmp    (%rcx),%rax
jle    1273 <stoI4+0x153>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
lea    0xdac(%rip),%rsi
mov    $0x89,%edx
lea    0xdb6(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    127f <stoI4+0x15f>
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stoI4>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1176 <stoI4+0x56>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1176 <stoI4+0x56>
mov    %rsi,%r14
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    (%rsp),%rdx
mov    (%rdx),%cl
test   %cl,%cl
je     1153 <stoI4+0x33>
cmp    $0xa,%cl
jne    11a6 <stoI4+0x86>
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
jl     11ea <stoI4+0xca>
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
jg     11ea <stoI4+0xca>
mov    %eax,(%r14)
xor    %eax,%eax
jmp    119e <stoI4+0x7e>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
lea    0xe89(%rip),%rcx
mov    $0x82,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e23(%rip),%r14
mov    (%r14),%edi
lea    0xf06(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xf04(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xe24(%rip),%rsi
lea    0xe33(%rip),%rcx
mov    $0x87,%edx
jmp    1192 <stoI4+0x72>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xe06(%rip),%rsi
lea    0xe15(%rip),%rcx
mov    $0x89,%edx
jmp    1192 <stoI4+0x72>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c\00"
@.str.2 = [15 x i8] c"endptr = [%s]\0A\00"
@.str.3 = [10 x i8] c"X = [%s]\0A\00"
@INT_MIN = global i64 0
@INT_MAX = global i64 0
define i32 @stoI4(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %5
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10, %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 130, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %54
18: ; preds = %10
%19 = load i8*, i8** %3
%20 = call i64 @strtoll(i8* %19, i8** %6, i32 10)
store i64 %20, i64* %7
%21 = load i8*, i8** %6
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %39
25: ; preds = %18
%26 = load i8*, i8** %6
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 10
br i1 %29, label %30, label %39
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %6
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %3
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 135, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %54
39: ; preds = %25, %18
%40 = load i64, i64* %7
%41 = load i64, i64* @INT_MIN
%42 = icmp slt i64 %40, %41
br i1 %42, label %47, label %43
43: ; preds = %39
%44 = load i64, i64* %7
%45 = load i64, i64* @INT_MAX
%46 = icmp sgt i64 %44, %45
br i1 %46, label %47, label %50
47: ; preds = %43, %39
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 137, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %54
50: ; preds = %43
%51 = load i64, i64* %7
%52 = trunc i64 %51 to i32
%53 = load i32*, i32** %4
store i32 %52, i32* %53
br label %54
54: ; preds = %50, %47, %30, %15
%55 = load i32, i32* %5
ret i32 %55
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c\00"
@.str.2 = [15 x i8] c"endptr = [%s]\0A\00"
@.str.3 = [10 x i8] c"X = [%s]\0A\00"
@INT_MIN = global i64 0
@INT_MAX = global i64 0
define i32 @stoI4(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i8* %0, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6, %2
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 130, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %34
12: ; preds = %6
%13 = call i64 @strtoll(i8* %0, i8** %3, i32 10)
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
switch i8 %15, label %16 [
i8 0, label %23
i8 10, label %23
]
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 135, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %34
23: ; preds = %12, %12
%24 = load i64, i64* @INT_MIN
%25 = icmp slt i64 %13, %24
%26 = load i64, i64* @INT_MAX
%27 = icmp sgt i64 %13, %26
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 137, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %34
32: ; preds = %23
%33 = trunc i64 %13 to i32
store i32 %33, i32* %1
br label %34
34: ; preds = %32, %29, %16, %9
%35 = phi i32 [ -1, %9 ], [ -1, %16 ], [ -1, %29 ], [ 0, %32 ]
ret i32 %35
}