#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 isNumber(char const *);
int /*<<< orphan*/ printf(char *, char const *);
scalar_t__ toInt(char const *);
bool validateArg(const char *arg) {
  if (false == isNumber(arg)) {
    printf("Not a number: %s\n", arg);
    return false;
  }
  if (toInt(arg) <= 0) {
    printf("Not a positive number: %s\n", arg);
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<validateArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <isNumber@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    116d <validateArg+0x3d>
mov    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <validateArg+0x73>
mov    -0x10(%rbp),%rdi
call   1050 <toInt@plt>
cmp    $0x0,%rax
jg     119c <validateArg+0x6c>
mov    -0x10(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <validateArg+0x73>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validateArg>:
push   %rbx
mov    %rdi,%rbx
call   1040 <isNumber@plt>
test   %eax,%eax
je     1154 <validateArg+0x24>
mov    %rbx,%rdi
call   1050 <toInt@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jle    115d <validateArg+0x2d>
pop    %rbx
ret
lea    0xea5(%rip),%rdi
jmp    1164 <validateArg+0x34>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Not a number: %s\0A\00"
@.str.1 = [27 x i8] c"Not a positive number: %s\0A\00"
define i32 @validateArg(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @isNumber(i8* %4)
%6 = icmp eq i32 0, %5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %2
br label %18
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @toInt(i8* %11)
%13 = icmp sle i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 0, i32* %2
br label %18
17: ; preds = %10
store i32 1, i32* %2
br label %18
18: ; preds = %17, %14, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [18 x i8] c"Not a number: %s\0A\00"
@.str.1 = [27 x i8] c"Not a positive number: %s\0A\00"
define i32 @validateArg(i8* %0) {
%2 = tail call i32 @isNumber(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @toInt(i8* %0)
%6 = icmp slt i64 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %4, %1
%8 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), %4 ]
%9 = tail call i32 @printf(i8* %8, i8* %0)
br label %10
10: ; preds = %7, %4
%11 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %11
}