#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*/ printf(char *, ...);
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int /*<<< orphan*/ test4();
int /*<<< orphan*/ test5();
int main(int argc, char *argv[]) {
  int n;
  if (argc != 2) {
    printf("Usage: %s <number>\n", argv[0]);
  } else {
    n = atoi(argv[1]);
    switch (n) {
    case 1:
      test1();
      break;
    case 2:
      test2();
      break;
    case 3:
      test3();
      break;
    case 4:
      test4();
      break;
    case 5:
      test5();
      break;
    default:
      printf("Choose a number from 1 to 5\n");
    }
  }
  return 0;
}


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)
je     11aa <main+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1232 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4,%eax
ja     121f <main+0xaf>
mov    -0x20(%rbp),%rax
lea    0xe26(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <test1@plt>
jmp    122d <main+0xbd>
mov    $0x0,%al
call   1080 <test2@plt>
jmp    122d <main+0xbd>
mov    $0x0,%al
call   1040 <test3@plt>
jmp    122d <main+0xbd>
mov    $0x0,%al
call   1070 <test4@plt>
jmp    122d <main+0xbd>
mov    $0x0,%al
call   1030 <test5@plt>
jmp    122d <main+0xbd>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1232 <main+0xc2>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    11b0 <main+0x30>
mov    0x8(%rsi),%rdi
call   10a0 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11c5 <main+0x45>
lea    0xe62(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <test1@plt>
jmp    11c1 <main+0x41>
mov    (%rsi),%rsi
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
jmp    11c1 <main+0x41>
xor    %eax,%eax
call   1090 <test2@plt>
jmp    11c1 <main+0x41>
xor    %eax,%eax
call   1050 <test3@plt>
jmp    11c1 <main+0x41>
xor    %eax,%eax
call   1080 <test4@plt>
jmp    11c1 <main+0x41>
xor    %eax,%eax
call   1040 <test5@plt>
jmp    11c1 <main+0x41>

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@.str.1 = [29 x i8] c"Choose a number from 1 to 5\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %33
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
switch i32 %19, label %30 [
i32 1, label %20
i32 2, label %22
i32 3, label %24
i32 4, label %26
i32 5, label %28
]
20: ; preds = %14
%21 = call i32 (...) @test1()
br label %32
22: ; preds = %14
%23 = call i32 (...) @test2()
br label %32
24: ; preds = %14
%25 = call i32 (...) @test3()
br label %32
26: ; preds = %14
%27 = call i32 (...) @test4()
br label %32
28: ; preds = %14
%29 = call i32 (...) @test5()
br label %32
30: ; preds = %14
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %28, %26, %24, %22, %20
br label %33
33: ; preds = %32, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@str = [28 x i8] c"Choose a number from 1 to 5\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %23
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
switch i32 %10, label %21 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
i32 5, label %19
]
11: ; preds = %7
%12 = tail call i32 (...) @test1()
br label %23
13: ; preds = %7
%14 = tail call i32 (...) @test2()
br label %23
15: ; preds = %7
%16 = tail call i32 (...) @test3()
br label %23
17: ; preds = %7
%18 = tail call i32 (...) @test4()
br label %23
19: ; preds = %7
%20 = tail call i32 (...) @test5()
br label %23
21: ; preds = %7
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %11, %13, %15, %17, %19, %21, %4
ret i32 0
}