#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*/ test_1(int);
int /*<<< orphan*/ test_2();
int /*<<< orphan*/ test_3(int, int);
int main(int argc, char *argv[]) {
  int i;
  if (argc == 1) {
    test_1(20);
  } else {
    switch (atoi(argv[1])) {
    case 1:
      test_1(20);
      break;
    case 2:
      test_2();
      break;
    case 3:
      test_3(20, 3);
      break;
    }
  }
  return 1;
}


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   $0x1,-0x8(%rbp)
jne    116f <main+0x2f>
mov    $0x14,%edi
call   1030 <test_1@plt>
jmp    11e0 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
sub    $0x1,%eax
je     11b1 <main+0x71>
jmp    118f <main+0x4f>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11c0 <main+0x80>
jmp    11a0 <main+0x60>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     11cc <main+0x8c>
jmp    11db <main+0x9b>
mov    $0x14,%edi
call   1030 <test_1@plt>
jmp    11db <main+0x9b>
mov    $0x0,%al
call   1040 <test_2@plt>
jmp    11db <main+0x9b>
mov    $0x14,%edi
mov    $0x3,%esi
call   1060 <test_3@plt>
jmp    11e0 <main+0xa0>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jne    1157 <main+0x17>
mov    $0x14,%edi
call   1030 <test_1@plt>
mov    $0x1,%eax
pop    %rcx
ret
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
cmp    $0x3,%eax
je     1171 <main+0x31>
cmp    $0x2,%eax
je     1182 <main+0x42>
cmp    $0x1,%eax
je     1146 <main+0x6>
jmp    1150 <main+0x10>
mov    $0x14,%edi
mov    $0x3,%esi
call   1060 <test_3@plt>
jmp    1150 <main+0x10>
xor    %eax,%eax
call   1040 <test_2@plt>
jmp    1150 <main+0x10>

LLVM IR (-O0):
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 eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @test_1(i32 20)
br label %23
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
switch i32 %15, label %22 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
]
16: ; preds = %11
%17 = call i32 @test_1(i32 20)
br label %22
18: ; preds = %11
%19 = call i32 (...) @test_2()
br label %22
20: ; preds = %11
%21 = call i32 @test_3(i32 20, i32 3)
br label %22
22: ; preds = %11, %20, %18, %16
br label %23
23: ; preds = %22, %9
ret i32 1
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @test_1(i32 20)
br label %16
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 @test_1(i32 20)
br label %16
12: ; preds = %6
%13 = tail call i32 (...) @test_2()
br label %16
14: ; preds = %6
%15 = tail call i32 @test_3(i32 20, i32 3)
br label %16
16: ; preds = %10, %12, %14, %6, %4
ret i32 1
}