#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_FAILURE;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ perror(char *);
unsigned long strtoul(int /*<<< orphan*/, char **, int /*<<< orphan*/);
unsigned long int get_ui_arg_opt() {
  char *tailptr;
  errno = 0;
  unsigned long int retval = strtoul(optarg, &tailptr, 0);
  if (tailptr[0] != '\0' || errno != 0) {
    perror("Error with argument to option. Must be a positive integer stating "
           "maximum number of steps in the proof.\n");
    exit(EXIT_FAILURE);
  }
  return retval;
}


x86 assembly (clang, -O0):
<get_ui_arg_opt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
movq   $0x0,(%rax)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    117f <get_ui_arg_opt+0x4f>
mov    0x2e63(%rip),%rax
cmpq   $0x0,(%rax)
je     1199 <get_ui_arg_opt+0x69>
lea    0xe7a(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ui_arg_opt>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e9c(%rip),%rbx
movq   $0x0,(%rbx)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    116e <get_ui_arg_opt+0x3e>
cmpq   $0x0,(%rbx)
jne    116e <get_ui_arg_opt+0x3e>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe8b(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@errno = global i64 0
@optarg = global i32 0
@.str = [105 x i8] c"Error with argument to option. Must be a positive integer stating maximum number of steps in the proof.\0A\00"
@EXIT_FAILURE = global i32 0
define i64 @get_ui_arg_opt() {
%1 = alloca i8*
%2 = alloca i64
store i64 0, i64* @errno
%3 = load i32, i32* @optarg
%4 = call i64 @strtoul(i32 %3, i8** %1, i32 0)
store i64 %4, i64* %2
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i64, i64* @errno
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10, %0
%14 = call i32 @perror(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %10
%18 = load i64, i64* %2
ret i64 %18
}

LLVM IR (-O2):
@errno = global i64 0
@optarg = global i32 0
@.str = [105 x i8] c"Error with argument to option. Must be a positive integer stating maximum number of steps in the proof.\0A\00"
@EXIT_FAILURE = global i32 0
define i64 @get_ui_arg_opt() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i64 0, i64* @errno
%3 = load i32, i32* @optarg
%4 = call i64 @strtoul(i32 %3, i8** %1, i32 0)
%5 = load i8*, i8** %1
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
%8 = load i64, i64* @errno
%9 = icmp ne i64 %8, 0
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = call i32 @perror(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
ret i64 %4
}