#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 EXIT_SUCCESS;
long long atoll(char *);
int /*<<< orphan*/ gna(long long);
int /*<<< orphan*/ trigger_error(char *);
int main(int ac, char *av[]) {
  long long number;
  if (ac < 2) {
    trigger_error("Invalid argument number\n");
  }
  number = atoll(av[1]);
  if (number < 0) {
    trigger_error("Number must be positive\n");
  } else if (number == 0) {
    trigger_error("Zero is an invalid value\n");
  }
  gna(number);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115c <main+0x2c>
lea    0xea9(%rip),%rdi
call   1030 <trigger_error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoll@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1189 <main+0x59>
lea    0xe9a(%rip),%rdi
call   1030 <trigger_error@plt>
jmp    11a5 <main+0x75>
cmpq   $0x0,-0x18(%rbp)
jne    11a0 <main+0x70>
lea    0xe97(%rip),%rdi
call   1030 <trigger_error@plt>
jmp    11a5 <main+0x75>
mov    -0x18(%rbp),%rdi
call   1040 <gna@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1145 <main+0x15>
lea    0xec0(%rip),%rdi
call   1030 <trigger_error@plt>
mov    0x8(%rbx),%rdi
call   1050 <atoll@plt>
mov    %rax,%rbx
test   %rax,%rax
js     1161 <main+0x31>
jne    116d <main+0x3d>
lea    0xed3(%rip),%rdi
jmp    1168 <main+0x38>
lea    0xeb1(%rip),%rdi
call   1030 <trigger_error@plt>
mov    %rbx,%rdi
call   1040 <gna@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Invalid argument number\0A\00"
@.str.1 = [25 x i8] c"Number must be positive\0A\00"
@.str.2 = [26 x i8] c"Zero is an invalid value\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @trigger_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @atoll(i8* %14)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @trigger_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %26
20: ; preds = %11
%21 = load i64, i64* %6
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @trigger_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %18
%27 = load i64, i64* %6
%28 = call i32 @gna(i64 %27)
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}

LLVM IR (-O2):
@.str = [25 x i8] c"Invalid argument number\0A\00"
@.str.1 = [25 x i8] c"Number must be positive\0A\00"
@.str.2 = [26 x i8] c"Zero is an invalid value\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @trigger_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @atoll(i8* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = icmp eq i64 %9, 0
br i1 %12, label %13, label %16
13: ; preds = %11, %6
%14 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), %11 ]
%15 = tail call i32 @trigger_error(i8* %14)
br label %16
16: ; preds = %13, %11
%17 = tail call i32 @gna(i64 %9)
%18 = load i32, i32* @EXIT_SUCCESS
ret i32 %18
}