#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 /*<<< 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;
  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    0x2e53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    11a1 <main+0x41>
mov    $0x0,%al
call   1050 <usage@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     11d6 <main+0x76>
jmp    11c5 <main+0x65>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     11ea <main+0x8a>
jmp    11fe <main+0x9e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <t1@plt>
mov    %eax,-0x18(%rbp)
jmp    121b <main+0xbb>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <t2@plt>
mov    %eax,-0x18(%rbp)
jmp    121b <main+0xbb>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdea(%rip),%rsi
call   1040 <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    11de <main+0x7e>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e59(%rip),%rax
mov    (%rax),%r14d
mov    0x8(%rsi),%r15
mov    %r15,%rdi
call   1070 <atoi@plt>
cmp    $0x2,%eax
je     11a4 <main+0x44>
cmp    $0x1,%eax
jne    11b8 <main+0x58>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <t1@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <t2@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
mov    %r15,%rdx
call   1040 <fprintf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1050 <usage@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
call   1080 <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 %29 [
i32 1, label %21
i32 2, label %25
]
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 %35
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 %35
29: ; preds = %15
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %29, %25, %21
%36 = load i32, i32* %7
ret i32 %36
}

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 %17 [
i32 1, label %13
i32 2, label %15
]
13: ; preds = %9
%14 = tail call i32 @t1(i32 %0, i8** %1)
br label %20
15: ; preds = %9
%16 = tail call i32 @t2(i32 %0, i8** %1)
br label %20
17: ; preds = %9
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %20
20: ; preds = %17, %15, %13
%21 = phi i32 [ %3, %17 ], [ %16, %15 ], [ %14, %13 ]
ret i32 %21
}