#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 rankingMenu(int);
int secondMenu(int);
int startingMenu(int);
int main() {
  int choice = 0;
  while (1) {
    switch (choice) {
    case 0:
      choice = startingMenu(1);
      break;
    case 1:
      choice = secondMenu(4);
      break;
    case 2:
      choice = rankingMenu(8);
      break;
    case 3:
      return 0;
    case 4:
    case 5:
    case 6:
    case 7:
      choice = 0;
      break;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
      choice = 0;
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0xc,%rax
ja     11bc <main+0x8c>
mov    -0x10(%rbp),%rax
lea    0xe9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x1,%edi
call   1030 <startingMenu@plt>
mov    %eax,-0x8(%rbp)
jmp    11bc <main+0x8c>
mov    $0x4,%edi
call   1040 <secondMenu@plt>
mov    %eax,-0x8(%rbp)
jmp    11bc <main+0x8c>
mov    $0x8,%edi
call   1050 <rankingMenu@plt>
mov    %eax,-0x8(%rbp)
jmp    11bc <main+0x8c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
movl   $0x0,-0x8(%rbp)
jmp    11bc <main+0x8c>
movl   $0x0,-0x8(%rbp)
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
lea    0xec6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
cmp    $0xc,%eax
ja     1140 <main+0x10>
mov    %eax,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
jmp    1140 <main+0x10>
mov    $0x8,%edi
call   1050 <rankingMenu@plt>
jmp    1140 <main+0x10>
mov    $0x1,%edi
call   1030 <startingMenu@plt>
jmp    1140 <main+0x10>
mov    $0x4,%edi
call   1040 <secondMenu@plt>
jmp    1140 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %0, %14
%4 = load i32, i32* %2
switch i32 %4, label %14 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %12
i32 5, label %12
i32 6, label %12
i32 7, label %12
i32 8, label %13
i32 9, label %13
i32 10, label %13
i32 11, label %13
i32 12, label %13
]
5: ; preds = %3
%6 = call i32 @startingMenu(i32 1)
store i32 %6, i32* %2
br label %14
7: ; preds = %3
%8 = call i32 @secondMenu(i32 4)
store i32 %8, i32* %2
br label %14
9: ; preds = %3
%10 = call i32 @rankingMenu(i32 8)
store i32 %10, i32* %2
br label %14
11: ; preds = %3
ret i32 0
12: ; preds = %3, %3, %3, %3
store i32 0, i32* %2
br label %14
13: ; preds = %3, %3, %3, %3, %3
store i32 0, i32* %2
br label %14
14: ; preds = %3, %13, %12, %9, %7, %5
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %11, %0
%2 = phi i32 [ 0, %0 ], [ %12, %11 ]
br label %3
3: ; preds = %1, %3
switch i32 %2, label %3 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %11
i32 5, label %11
i32 6, label %11
i32 7, label %11
i32 8, label %11
i32 9, label %11
i32 10, label %11
i32 11, label %11
i32 12, label %11
]
4: ; preds = %3
%5 = tail call i32 @startingMenu(i32 1)
br label %11
6: ; preds = %3
%7 = tail call i32 @secondMenu(i32 4)
br label %11
8: ; preds = %3
%9 = tail call i32 @rankingMenu(i32 8)
br label %11
10: ; preds = %3
ret i32 0
11: ; preds = %3, %3, %3, %3, %3, %3, %3, %3, %3, %8, %6, %4
%12 = phi i32 [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ], [ 0, %3 ]
br label %1
}