#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*/ func_0(int);
int /*<<< orphan*/ func_1(int, int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  puts("Switch table test.");
  switch (argc) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 9:
    func_0(argc);
    break;
  case 2:
    func_1(2, 2);
    break;
  case 4:
    func_1(4, 4);
    break;
  case 6:
    func_1(6, 6);
    break;
  case 8:
    func_1(8, 8);
    break;
  case 10:
    func_1(10, 10);
    break;
  case 45:
    func_0(45);
    break;
  default:
    break;
  }
  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)
lea    0xf67(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x2c,%eax
ja     11ec <main+0xbc>
mov    -0x18(%rbp),%rax
lea    0xe8e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
call   1040 <func_0@plt>
jmp    11f1 <main+0xc1>
mov    $0x2,%esi
mov    %esi,%edi
call   1050 <func_1@plt>
jmp    11f1 <main+0xc1>
mov    $0x4,%esi
mov    %esi,%edi
call   1050 <func_1@plt>
jmp    11f1 <main+0xc1>
mov    $0x6,%esi
mov    %esi,%edi
call   1050 <func_1@plt>
jmp    11f1 <main+0xc1>
mov    $0x8,%esi
mov    %esi,%edi
call   1050 <func_1@plt>
jmp    11f1 <main+0xc1>
mov    $0xa,%esi
mov    %esi,%edi
call   1050 <func_1@plt>
jmp    11f1 <main+0xc1>
mov    $0x2d,%edi
call   1040 <func_0@plt>
jmp    11f1 <main+0xc1>
jmp    11f1 <main+0xc1>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
lea    0xf7a(%rip),%rdi
call   1030 <puts@plt>
lea    -0x1(%rbx),%eax
cmp    $0x2c,%eax
ja     115e <main+0x2e>
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebx,%edi
call   1040 <func_0@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x2,%edi
mov    $0x2,%esi
call   1050 <func_1@plt>
jmp    115e <main+0x2e>
mov    $0x4,%edi
mov    $0x4,%esi
call   1050 <func_1@plt>
jmp    115e <main+0x2e>
mov    $0x6,%edi
mov    $0x6,%esi
call   1050 <func_1@plt>
jmp    115e <main+0x2e>
mov    $0x8,%edi
mov    $0x8,%esi
call   1050 <func_1@plt>
jmp    115e <main+0x2e>
mov    $0xa,%edi
mov    $0xa,%esi
call   1050 <func_1@plt>
jmp    115e <main+0x2e>
mov    $0x2d,%edi
jmp    1159 <main+0x29>

LLVM IR (-O0):
@.str = [19 x i8] c"Switch table test.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
switch i32 %7, label %23 [
i32 1, label %8
i32 3, label %8
i32 5, label %8
i32 7, label %8
i32 9, label %8
i32 2, label %11
i32 4, label %13
i32 6, label %15
i32 8, label %17
i32 10, label %19
i32 45, label %21
]
8: ; preds = %2, %2, %2, %2, %2
%9 = load i32, i32* %4
%10 = call i32 @func_0(i32 %9)
br label %24
11: ; preds = %2
%12 = call i32 @func_1(i32 2, i32 2)
br label %24
13: ; preds = %2
%14 = call i32 @func_1(i32 4, i32 4)
br label %24
15: ; preds = %2
%16 = call i32 @func_1(i32 6, i32 6)
br label %24
17: ; preds = %2
%18 = call i32 @func_1(i32 8, i32 8)
br label %24
19: ; preds = %2
%20 = call i32 @func_1(i32 10, i32 10)
br label %24
21: ; preds = %2
%22 = call i32 @func_0(i32 45)
br label %24
23: ; preds = %2
br label %24
24: ; preds = %23, %21, %19, %17, %15, %13, %11, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Switch table test.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %18 [
i32 1, label %4
i32 3, label %4
i32 5, label %4
i32 7, label %4
i32 9, label %4
i32 2, label %6
i32 4, label %8
i32 6, label %10
i32 8, label %12
i32 10, label %14
i32 45, label %16
]
4: ; preds = %2, %2, %2, %2, %2
%5 = tail call i32 @func_0(i32 %0)
br label %18
6: ; preds = %2
%7 = tail call i32 @func_1(i32 2, i32 2)
br label %18
8: ; preds = %2
%9 = tail call i32 @func_1(i32 4, i32 4)
br label %18
10: ; preds = %2
%11 = tail call i32 @func_1(i32 6, i32 6)
br label %18
12: ; preds = %2
%13 = tail call i32 @func_1(i32 8, i32 8)
br label %18
14: ; preds = %2
%15 = tail call i32 @func_1(i32 10, i32 10)
br label %18
16: ; preds = %2
%17 = tail call i32 @func_0(i32 45)
br label %18
18: ; preds = %2, %16, %14, %12, %10, %8, %6, %4
ret i32 0
}