#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void getCommandLine(int *inputs, int argc, char **argv) {
  if (argc < 2)
    *inputs = 2;
  else if ((**(argv + 1) >= '0') && (**(argv + 1) <= '9'))
    *inputs = atoi(*(argv + 1));
  else {
    fprintf(stderr, "Invalid argument: %s\n", *(argv + 1));
    fprintf(stderr, "Value should be an integer.\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<getCommandLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    115c <getCommandLine+0x2c>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
jmp    11e3 <getCommandLine+0xb3>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     119e <getCommandLine+0x6e>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     119e <getCommandLine+0x6e>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    11de <getCommandLine+0xae>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11e3 <getCommandLine+0xb3>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCommandLine>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%eax
cmp    $0x2,%esi
jl     1152 <getCommandLine+0x22>
mov    0x8(%rdx),%rdx
mov    (%rdx),%al
add    $0xd0,%al
cmp    $0x9,%al
ja     1156 <getCommandLine+0x26>
mov    %rdx,%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
pop    %rbx
ret
mov    0x2e83(%rip),%rbx
mov    (%rbx),%edi
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Invalid argument: %s\0A\00"
@.str.1 = [29 x i8] c"Value should be an integer.\0A\00"
define void @getCommandLine(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8**
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i32*, i32** %4
store i32 2, i32* %10
br label %41
11: ; preds = %3
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 48
br i1 %17, label %18, label %31
18: ; preds = %11
%19 = load i8**, i8*** %6
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp sle i32 %23, 57
br i1 %24, label %25, label %31
25: ; preds = %18
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = load i32*, i32** %4
store i32 %29, i32* %30
br label %40
31: ; preds = %18, %11
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %6
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %25
br label %41
41: ; preds = %40, %9
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Invalid argument: %s\0A\00"
@.str.1 = [29 x i8] c"Value should be an integer.\0A\00"
define void @getCommandLine(i32* nocapture writeonly %0, i32 %1, i8** nocapture %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %19, label %5
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = add i8 %8, -48
%10 = icmp ult i8 %9, 10
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = tail call i32 @atoi(i8* %7)
br label %19
13: ; preds = %5
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7)
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %3, %11
%20 = phi i32 [ %12, %11 ], [ 2, %3 ]
store i32 %20, i32* %0
ret void
}