#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 /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int t1(int, char **);
int t2(int, char **);
int t3(int, char **);
int t4(int, char **);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int test_no;
  int rc = EXIT_SUCCESS;
  if (argc < 1) {
    usage();
    exit(EXIT_FAILURE);
  }
  test_no = atoi(argv[1]);
  switch (test_no) {
  case 1:
    rc = t1(argc, argv);
    break;
  case 2:
    rc = t2(argc, argv);
    break;
  case 3:
    rc = t3(argc, argv);
    break;
  case 4:
    rc = t4(argc, argv);
    break;
  default:
    fprintf(stderr, "unknow test number %s\n", argv[1]);
    break;
  }
  return rc;
}


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)
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    11c1 <main+0x41>
mov    $0x0,%al
call   1060 <usage@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
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    $0x3,%eax
ja     124a <main+0xca>
mov    -0x20(%rbp),%rax
lea    0xe0f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <t1@plt>
mov    %eax,-0x18(%rbp)
jmp    1267 <main+0xe7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <t2@plt>
mov    %eax,-0x18(%rbp)
jmp    1267 <main+0xe7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <t3@plt>
mov    %eax,-0x18(%rbp)
jmp    1267 <main+0xe7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <t4@plt>
mov    %eax,-0x18(%rbp)
jmp    1267 <main+0xe7>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdae(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1238 <main+0xb8>
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x2e35(%rip),%rax
mov    (%rax),%r14d
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1090 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1212 <main+0x92>
lea    0xe47(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <t1@plt>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <t2@plt>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <t3@plt>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <t4@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1060 <usage@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"unknow test number %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @EXIT_SUCCESS
store i32 %8, i32* %7
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = call i32 (...) @usage()
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
switch i32 %20, label %37 [
i32 1, label %21
i32 2, label %25
i32 3, label %29
i32 4, label %33
]
21: ; preds = %15
%22 = load i32, i32* %4
%23 = load i8**, i8*** %5
%24 = call i32 @t1(i32 %22, i8** %23)
store i32 %24, i32* %7
br label %43
25: ; preds = %15
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @t2(i32 %26, i8** %27)
store i32 %28, i32* %7
br label %43
29: ; preds = %15
%30 = load i32, i32* %4
%31 = load i8**, i8*** %5
%32 = call i32 @t3(i32 %30, i8** %31)
store i32 %32, i32* %7
br label %43
33: ; preds = %15
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = call i32 @t4(i32 %34, i8** %35)
store i32 %36, i32* %7
br label %43
37: ; preds = %15
%38 = load i32, i32* @stderr
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %37, %33, %29, %25, %21
%44 = load i32, i32* %7
ret i32 %44
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"unknow test number %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp slt i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 (...) @usage()
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
switch i32 %12, label %21 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
]
13: ; preds = %9
%14 = tail call i32 @t1(i32 %0, i8** %1)
br label %24
15: ; preds = %9
%16 = tail call i32 @t2(i32 %0, i8** %1)
br label %24
17: ; preds = %9
%18 = tail call i32 @t3(i32 %0, i8** %1)
br label %24
19: ; preds = %9
%20 = tail call i32 @t4(i32 %0, i8** %1)
br label %24
21: ; preds = %9
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %24
24: ; preds = %21, %19, %17, %15, %13
%25 = phi i32 [ %3, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ]
ret i32 %25
}