#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*/ exit(int);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printerrorf(char *, char const, int const, int const);
int /*<<< orphan*/ stringToInt(int /*<<< orphan*/, int const, int const, int *);
__attribute__((pure)) int getOptionArgumentInt(const char o, const int min,
                                               const int max) {
  int result;
  if (!stringToInt(optarg, min, max, &result)) {
    printerrorf("Fatal: Option \"-%c\" must be numeric between %i and %i.\n", o,
                min, max);
    exit(!0);
  }
  return result;
}


x86 assembly (clang, -O0):
<getOptionArgumentInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x10(%rbp),%rcx
call   1040 <stringToInt@plt>
cmp    $0x0,%eax
jne    1187 <getOptionArgumentInt+0x57>
mov    -0x1(%rbp),%al
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe8b(%rip),%rdi
movsbl %al,%esi
call   1030 <printerrorf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOptionArgumentInt>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xc(%rsp),%rcx
call   1040 <stringToInt@plt>
test   %eax,%eax
je     1163 <getOptionArgumentInt+0x33>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movsbl %r14b,%esi
lea    0xe92(%rip),%rdi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <printerrorf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@optarg = global i32 0
@.str = [56 x i8] c"Fatal: Option \22-%c\22 must be numeric between %i and %i.\0A\00"
define i32 @getOptionArgumentInt(i8 signext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* @optarg
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @stringToInt(i32 %8, i32 %9, i32 %10, i32* %7)
%12 = icmp ne i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %3
%14 = load i8, i8* %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @printerrorf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8 signext %14, i32 %15, i32 %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
@optarg = global i32 0
@.str = [56 x i8] c"Fatal: Option \22-%c\22 must be numeric between %i and %i.\0A\00"
define i32 @getOptionArgumentInt(i8 signext %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i32, i32* @optarg
%7 = call i32 @stringToInt(i32 %6, i32 %1, i32 %2, i32* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i32 @printerrorf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8 signext %0, i32 %1, i32 %2)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %3
%13 = load i32, i32* %4
ret i32 %13
}