#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*/ g();
int /*<<< orphan*/ h();
int /*<<< orphan*/ i();
int /*<<< orphan*/ j();
int num();
void f() {
  switch (num()) {
  case 0:
    g();
    break;
  case 1:
    h();
    break;
  case 2:
    i();
    break;
  case 3:
    j();
    break;
  case 4:
    g();
    break;
  case 5:
    h();
    break;
  case 6:
    i();
    break;
  case 7:
    j();
    break;
  case 8:
    g();
    break;
  default:
    h();
    break;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <num@plt>
mov    %eax,%ecx
mov    %rcx,-0x8(%rbp)
sub    $0x8,%eax
ja     11ee <f+0x9e>
mov    -0x8(%rbp),%rax
lea    0xe87(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <g@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1050 <h@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1070 <i@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1040 <j@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1060 <g@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1050 <h@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1070 <i@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1040 <j@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1060 <g@plt>
jmp    11f5 <f+0xa5>
mov    $0x0,%al
call   1050 <h@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
xor    %eax,%eax
call   1030 <num@plt>
cmp    $0x8,%eax
ja     1177 <f+0x27>
mov    %eax,%eax
lea    0xe9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
pop    %rcx
jmp    1060 <g@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <h@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <i@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <j@plt>

LLVM IR (-O0):
define void @f() {
%1 = call i32 (...) @num()
switch i32 %1, label %20 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %18
]
2: ; preds = %0
%3 = call i32 (...) @g()
br label %22
4: ; preds = %0
%5 = call i32 (...) @h()
br label %22
6: ; preds = %0
%7 = call i32 (...) @i()
br label %22
8: ; preds = %0
%9 = call i32 (...) @j()
br label %22
10: ; preds = %0
%11 = call i32 (...) @g()
br label %22
12: ; preds = %0
%13 = call i32 (...) @h()
br label %22
14: ; preds = %0
%15 = call i32 (...) @i()
br label %22
16: ; preds = %0
%17 = call i32 (...) @j()
br label %22
18: ; preds = %0
%19 = call i32 (...) @g()
br label %22
20: ; preds = %0
%21 = call i32 (...) @h()
br label %22
22: ; preds = %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = tail call i32 (...) @num()
switch i32 %1, label %20 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %18
]
2: ; preds = %0
%3 = tail call i32 (...) @g()
br label %22
4: ; preds = %0
%5 = tail call i32 (...) @h()
br label %22
6: ; preds = %0
%7 = tail call i32 (...) @i()
br label %22
8: ; preds = %0
%9 = tail call i32 (...) @j()
br label %22
10: ; preds = %0
%11 = tail call i32 (...) @g()
br label %22
12: ; preds = %0
%13 = tail call i32 (...) @h()
br label %22
14: ; preds = %0
%15 = tail call i32 (...) @i()
br label %22
16: ; preds = %0
%17 = tail call i32 (...) @j()
br label %22
18: ; preds = %0
%19 = tail call i32 (...) @g()
br label %22
20: ; preds = %0
%21 = tail call i32 (...) @h()
br label %22
22: ; preds = %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
ret void
}