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


x86 assembly (clang, -O0):
<g>:
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     11de <g+0x9e>
mov    -0x8(%rbp),%rax
lea    0xe97(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <h@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1060 <i@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1040 <j@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1050 <h@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1060 <i@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1040 <j@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1050 <h@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1060 <i@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1040 <j@plt>
jmp    11e5 <g+0xa5>
mov    $0x0,%al
call   1050 <h@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @g() {
%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 (...) @h()
br label %22
4: ; preds = %0
%5 = call i32 (...) @i()
br label %22
6: ; preds = %0
%7 = call i32 (...) @j()
br label %22
8: ; preds = %0
%9 = call i32 (...) @h()
br label %22
10: ; preds = %0
%11 = call i32 (...) @i()
br label %22
12: ; preds = %0
%13 = call i32 (...) @j()
br label %22
14: ; preds = %0
%15 = call i32 (...) @h()
br label %22
16: ; preds = %0
%17 = call i32 (...) @i()
br label %22
18: ; preds = %0
%19 = call i32 (...) @j()
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 @g() {
%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 (...) @h()
br label %22
4: ; preds = %0
%5 = tail call i32 (...) @i()
br label %22
6: ; preds = %0
%7 = tail call i32 (...) @j()
br label %22
8: ; preds = %0
%9 = tail call i32 (...) @h()
br label %22
10: ; preds = %0
%11 = tail call i32 (...) @i()
br label %22
12: ; preds = %0
%13 = tail call i32 (...) @j()
br label %22
14: ; preds = %0
%15 = tail call i32 (...) @h()
br label %22
16: ; preds = %0
%17 = tail call i32 (...) @i()
br label %22
18: ; preds = %0
%19 = tail call i32 (...) @j()
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
}