#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 SHRT_MAX;
long long SHRT_MIN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
long long strtoll(char const *, char **, int);
int stoI2(const char *X, short *ptr_Y) {
  int status = 0;
  char *endptr;
  long long Y;
  if ((X == NULL) || (*X == '\0')) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 108,
                "/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, "Line %3d of File %s \n", 110,
                "/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 < SHRT_MIN) || (Y > SHRT_MAX)) {
    fprintf(stderr, "not a short = [%s] \n", X);
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 113,
                "/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):
<stoI2>:
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 <stoI2+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1181 <stoI2+0x61>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
mov    $0x6c,%edx
lea    0xea8(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1266 <stoI2+0x146>
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     11e6 <stoI2+0xc6>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     11e6 <stoI2+0xc6>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
mov    $0x6e,%edx
lea    0xe43(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1266 <stoI2+0x146>
mov    -0x28(%rbp),%rax
mov    0x2de7(%rip),%rcx
cmp    (%rcx),%rax
jl     120e <stoI2+0xee>
mov    -0x28(%rbp),%rax
mov    0x2dcb(%rip),%rcx
cmp    (%rcx),%rax
jle    1258 <stoI2+0x138>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xdc7(%rip),%rsi
mov    $0x71,%edx
lea    0xdd1(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1266 <stoI2+0x146>
mov    -0x28(%rbp),%rax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stoI2>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1173 <stoI2+0x53>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1173 <stoI2+0x53>
mov    %rsi,%r14
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    (%rsp),%rcx
mov    (%rcx),%cl
test   %cl,%cl
je     1153 <stoI2+0x33>
cmp    $0xa,%cl
jne    11a3 <stoI2+0x83>
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
jl     11c1 <stoI2+0xa1>
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%rax
jg     11c1 <stoI2+0xa1>
mov    %ax,(%r14)
xor    %eax,%eax
jmp    119b <stoI2+0x7b>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
lea    0xe8c(%rip),%rcx
mov    $0x6c,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
lea    0xe5c(%rip),%rcx
mov    $0x6e,%edx
jmp    118f <stoI2+0x6f>
mov    0x2e18(%rip),%r14
mov    (%r14),%edi
lea    0xeeb(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xe1a(%rip),%rsi
lea    0xe29(%rip),%rcx
mov    $0x71,%edx
jmp    118f <stoI2+0x6f>

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"
@SHRT_MIN = global i64 0
@SHRT_MAX = global i64 0
@.str.2 = [21 x i8] c"not a short = [%s] \0A\00"
define i32 @stoI2(i8* %0, i16* %1) {
%3 = alloca i8*
%4 = alloca i16*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %3
store i16* %1, i16** %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 108, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %51
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 %33
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 %33
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 110, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %51
33: ; preds = %25, %18
%34 = load i64, i64* %7
%35 = load i64, i64* @SHRT_MIN
%36 = icmp slt i64 %34, %35
br i1 %36, label %41, label %37
37: ; preds = %33
%38 = load i64, i64* %7
%39 = load i64, i64* @SHRT_MAX
%40 = icmp sgt i64 %38, %39
br i1 %40, label %41, label %47
41: ; preds = %37, %33
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %3
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 113, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %51
47: ; preds = %37
%48 = load i64, i64* %7
%49 = trunc i64 %48 to i16
%50 = load i16*, i16** %4
store i16 %49, i16* %50
br label %51
51: ; preds = %47, %41, %30, %15
%52 = load i32, i32* %5
ret i32 %52
}

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"
@SHRT_MIN = global i64 0
@SHRT_MAX = global i64 0
@.str.2 = [21 x i8] c"not a short = [%s] \0A\00"
define i32 @stoI2(i8* %0, i16* 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 108, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %32
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 %19
i8 10, label %19
]
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 110, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %32
19: ; preds = %12, %12
%20 = load i64, i64* @SHRT_MIN
%21 = icmp slt i64 %13, %20
%22 = load i64, i64* @SHRT_MAX
%23 = icmp sgt i64 %13, %22
%24 = select i1 %21, i1 true, i1 %23
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 113, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %32
30: ; preds = %19
%31 = trunc i64 %13 to i16
store i16 %31, i16* %1
br label %32
32: ; preds = %30, %25, %16, %9
%33 = phi i32 [ -1, %9 ], [ -1, %16 ], [ -1, %25 ], [ 0, %30 ]
ret i32 %33
}