#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*/ assert(int);
int atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ test_1();
int /*<<< orphan*/ test_2();
int main(int argc, char *argv[]) {
  char *choice = NULL;
  int rc = 0, arg = 0;
  int test_num = 0;
  if (argc < 2) {
    printf("usage: %s <test_number> \n", argv[0]);
    goto out;
  }
  choice = argv[++arg];
  test_num = atoi(choice);
  switch (test_num) {
  case 1:
    test_1();
    break;
  case 2:
    test_2();
    break;
  default:
    assert(2 == 1);
    return -1;
  }
out:
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a5 <main+0x55>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
jmp    121f <main+0xcf>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
mov    0x8(%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     11ef <main+0x9f>
jmp    11de <main+0x8e>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     11fb <main+0xab>
jmp    1207 <main+0xb7>
mov    $0x0,%al
call   1030 <test_1@plt>
jmp    121a <main+0xca>
mov    $0x0,%al
call   1060 <test_2@plt>
jmp    121a <main+0xca>
xor    %edi,%edi
call   1050 <assert@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1225 <main+0xd5>
jmp    121f <main+0xcf>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     1169 <main+0x19>
mov    (%rsi),%rsi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
jmp    119e <main+0x4e>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
cmp    $0x2,%eax
je     1187 <main+0x37>
cmp    $0x1,%eax
jne    1192 <main+0x42>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <test_1@plt>
jmp    119e <main+0x4e>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <test_2@plt>
jmp    119e <main+0x4e>
xor    %edi,%edi
call   1050 <assert@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"usage: %s <test_number> \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %34
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = load i32, i32* %8
%20 = add nsw i32 %19, 1
store i32 %20, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %9
%26 = load i32, i32* %9
switch i32 %26, label %31 [
i32 1, label %27
i32 2, label %29
]
27: ; preds = %17
%28 = call i32 (...) @test_1()
br label %33
29: ; preds = %17
%30 = call i32 (...) @test_2()
br label %33
31: ; preds = %17
%32 = call i32 @assert(i32 0)
store i32 -1, i32* %3
br label %36
33: ; preds = %29, %27
br label %34
34: ; preds = %33, %12
%35 = load i32, i32* %7
store i32 %35, i32* %3
br label %36
36: ; preds = %34, %31
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [26 x i8] c"usage: %s <test_number> \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %17
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 %15 [
i32 1, label %11
i32 2, label %13
]
11: ; preds = %7
%12 = tail call i32 (...) @test_1()
br label %17
13: ; preds = %7
%14 = tail call i32 (...) @test_2()
br label %17
15: ; preds = %7
%16 = tail call i32 @assert(i32 0)
br label %17
17: ; preds = %4, %13, %11, %15
%18 = phi i32 [ -1, %15 ], [ 0, %11 ], [ 0, %13 ], [ 0, %4 ]
ret i32 %18
}