#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;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, long);
long strtol(char *, char **, int /*<<< orphan*/);
void checkiflzero(char *optarg, int *var, int opt) {
  long tmp;
  char *tailptr;
  tmp = strtol(optarg, &tailptr, 0);
  if (tmp <= 0) {
    printf("\n\n Error: argument to -%c ", opt);
    printf("should be >0, it is: %ld\n\n", tmp);
    exit(EXIT_FAILURE);
  }
  *var = tmp;
}


x86 assembly (clang, -O0):
<checkiflzero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jg     118f <checkiflzero+0x5f>
movslq -0x14(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkiflzero>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %rax,%rbx
test   %rax,%rax
jle    115d <checkiflzero+0x2d>
mov    %ebx,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movslq %ebp,%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\0A\0A Error: argument to -%c \00"
@.str.1 = [27 x i8] c"should be >0, it is: %ld\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @checkiflzero(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = call i64 @strtol(i8* %9, i8** %8, i32 0)
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = icmp sle i64 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %3
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %15)
%17 = load i64, i64* %7
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %3
%22 = load i64, i64* %7
%23 = trunc i64 %22 to i32
%24 = load i32*, i32** %5
store i32 %23, i32* %24
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0A\0A Error: argument to -%c \00"
@.str.1 = [27 x i8] c"should be >0, it is: %ld\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @checkiflzero(i8* %0, i32* nocapture writeonly %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i64 @strtol(i8* %0, i8** %4, i32 0)
%7 = icmp slt i64 %6, 1
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = sext i32 %2 to i64
%10 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 %6)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %3
%15 = trunc i64 %6 to i32
store i32 %15, i32* %1
ret void
}