#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 INT_MAX;
long INT_MIN;
long getNum(char *, char const *, int, char const *);
int /*<<< orphan*/ gnFail(char *, char *, char const *, char const *);
getInt(const char *arg, int flags, const char *name) {
  long res;
  res = getNum("getInt", arg, flags, name);
  if (res > INT_MAX || res < INT_MIN)
    gnFail("getInt", "integer out of range", arg, name);
  return (int)res;
}


x86 assembly (clang, -O0):
<getInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xebb(%rip),%rdi
call   1040 <getNum@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%rax
jg     1176 <getInt+0x56>
mov    -0x20(%rbp),%rax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
jge    1191 <getInt+0x71>
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe7b(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1030 <gnFail@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInt>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%edx
mov    %rdi,%r15
lea    0xecc(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rcx
call   1040 <getNum@plt>
mov    %rax,%rbx
mov    0x2e9f(%rip),%rax
cmp    (%rax),%rbx
jg     115a <getInt+0x3a>
mov    0x2e8b(%rip),%rax
cmp    (%rax),%rbx
jge    1173 <getInt+0x53>
lea    0xe9f(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <gnFail@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"getInt\00"
@INT_MAX = global i64 0
@INT_MIN = global i64 0
@.str.1 = [21 x i8] c"integer out of range\00"
define i32 @getInt(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = call i64 @getNum(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = load i64, i64* @INT_MAX
%14 = icmp sgt i64 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %3
%16 = load i64, i64* %7
%17 = load i64, i64* @INT_MIN
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %15, %3
%20 = load i8*, i8** %4
%21 = load i8*, i8** %6
%22 = call i32 @gnFail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21)
br label %23
23: ; preds = %19, %15
%24 = load i64, i64* %7
%25 = trunc i64 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
@.str = [7 x i8] c"getInt\00"
@INT_MAX = global i64 0
@INT_MIN = global i64 0
@.str.1 = [21 x i8] c"integer out of range\00"
define i32 @getInt(i8* %0, i32 %1, i8* %2) {
%4 = tail call i64 @getNum(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
%5 = load i64, i64* @INT_MAX
%6 = icmp sgt i64 %4, %5
%7 = load i64, i64* @INT_MIN
%8 = icmp slt i64 %4, %7
%9 = select i1 %6, i1 true, i1 %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 @gnFail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %2)
br label %12
12: ; preds = %3, %10
%13 = trunc i64 %4 to i32
ret i32 %13
}