#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*/ p1();
int /*<<< orphan*/ p2();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Expecting at least one argument. Please try again\n");
  } else if (argc == 2) {
    if (atoi(argv[1]) == 1) {
      p1();
    } else if (atoi(argv[1]) == 2) {
      p2();
    } else {
      printf("Incorrect argument supplied.\n");
    }
  } else {
    printf("Expecting only one argument\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1171 <main+0x31>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    11e6 <main+0xa6>
cmpl   $0x2,-0x8(%rbp)
jne    11d5 <main+0x95>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
cmp    $0x1,%eax
jne    119d <main+0x5d>
mov    $0x0,%al
call   1050 <p1@plt>
jmp    11d0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
cmp    $0x2,%eax
jne    11bf <main+0x7f>
mov    $0x0,%al
call   1030 <p2@plt>
jmp    11cb <main+0x8b>
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
jmp    11d0 <main+0x90>
jmp    11e1 <main+0xa1>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
jmp    11e6 <main+0xa6>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     114f <main+0xf>
lea    0xeec(%rip),%rdi
jmp    1189 <main+0x49>
cmp    $0x2,%edi
jne    1170 <main+0x30>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
cmp    $0x2,%eax
je     1179 <main+0x39>
cmp    $0x1,%eax
jne    1182 <main+0x42>
xor    %eax,%eax
call   1050 <p1@plt>
jmp    118e <main+0x4e>
lea    0xe89(%rip),%rdi
jmp    1189 <main+0x49>
xor    %eax,%eax
call   1040 <p2@plt>
jmp    118e <main+0x4e>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Expecting at least one argument. Please try again\0A\00"
@.str.1 = [30 x i8] c"Incorrect argument supplied.\0A\00"
@.str.2 = [29 x i8] c"Expecting only one argument\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %36
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 (...) @p1()
br label %32
21: ; preds = %13
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i32 (...) @p2()
br label %31
29: ; preds = %21
%30 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
br label %32
32: ; preds = %31, %19
br label %35
33: ; preds = %10
%34 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %32
br label %36
36: ; preds = %35, %8
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@str = [28 x i8] c"Expecting only one argument\00"
@str.3 = [29 x i8] c"Incorrect argument supplied.\00"
@str.4 = [50 x i8] c"Expecting at least one argument. Please try again\00"
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 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.4, i64 0, i64 0))
br label %20
6: ; preds = %2
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %18
8: ; preds = %6
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
switch i32 %11, label %16 [
i32 1, label %12
i32 2, label %14
]
12: ; preds = %8
%13 = tail call i32 (...) @p1()
br label %20
14: ; preds = %8
%15 = tail call i32 (...) @p2()
br label %20
16: ; preds = %8
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
br label %20
18: ; preds = %6
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %18, %14, %16, %12, %4
ret i32 0
}