#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*/ p3();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Expecting only one argument. Please try again\n");
  } else {
    if (atoi(argv[1]) == 1) {
      p1();
    } else if (atoi(argv[1]) == 2) {
      p2();
    } else if (atoi(argv[1]) == 3) {
      p3();
    } else {
      printf("Incorrect argument supplied.\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)
je     1181 <main+0x31>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
jmp    1202 <main+0xb2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
cmp    $0x1,%eax
jne    11a3 <main+0x53>
mov    $0x0,%al
call   1050 <p1@plt>
jmp    11fd <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
cmp    $0x2,%eax
jne    11c5 <main+0x75>
mov    $0x0,%al
call   1030 <p2@plt>
jmp    11f8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
cmp    $0x3,%eax
jne    11e7 <main+0x97>
mov    $0x0,%al
call   1060 <p3@plt>
jmp    11f3 <main+0xa3>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
jmp    11f8 <main+0xa8>
jmp    11fd <main+0xad>
jmp    1202 <main+0xb2>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1177 <main+0x27>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
cmp    $0x3,%eax
je     1187 <main+0x37>
cmp    $0x2,%eax
je     1190 <main+0x40>
cmp    $0x1,%eax
jne    1199 <main+0x49>
xor    %eax,%eax
call   1050 <p1@plt>
jmp    1183 <main+0x33>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1060 <p3@plt>
jmp    1183 <main+0x33>
xor    %eax,%eax
call   1040 <p2@plt>
jmp    1183 <main+0x33>
lea    0xe60(%rip),%rdi
jmp    117e <main+0x2e>

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

LLVM IR (-O2):
@str = [29 x i8] c"Incorrect argument supplied.\00"
@str.2 = [46 x i8] c"Expecting only one argument. Please try again\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.2, i64 0, i64 0))
br label %18
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
10: ; preds = %6
%11 = tail call i32 (...) @p1()
br label %18
12: ; preds = %6
%13 = tail call i32 (...) @p2()
br label %18
14: ; preds = %6
%15 = tail call i32 (...) @p3()
br label %18
16: ; preds = %6
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %10, %14, %16, %12, %4
ret i32 0
}