#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*/ clear_highscore();
int clear_score_dialog();
int /*<<< orphan*/ display_controls();
int /*<<< orphan*/ display_help();
int display_menu();
int /*<<< orphan*/ run();
int /*<<< orphan*/ show_highscores();
void main_menu() {
  int selected_menu_entry;
  do {
    selected_menu_entry = display_menu();
    if (selected_menu_entry == 1) {
      run();
    } else if (selected_menu_entry == 2) {
      show_highscores();
    } else if (selected_menu_entry == 3) {
      display_controls();
    } else if (selected_menu_entry == 4) {
      display_help();
    } else if (selected_menu_entry == 5) {
      if (clear_score_dialog() == 1) {
        clear_highscore();
      }
    }
  } while (selected_menu_entry != 6);
}


x86 assembly (clang, -O0):
<main_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <display_menu@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1198 <main_menu+0x28>
mov    $0x0,%al
call   1060 <run@plt>
jmp    1214 <main_menu+0xa4>
cmpl   $0x2,-0x4(%rbp)
jne    11ae <main_menu+0x3e>
mov    $0x0,%al
call   1040 <show_highscores@plt>
jmp    120f <main_menu+0x9f>
cmpl   $0x3,-0x4(%rbp)
jne    11c4 <main_menu+0x54>
mov    $0x0,%al
call   1030 <display_controls@plt>
jmp    120a <main_menu+0x9a>
cmpl   $0x4,-0x4(%rbp)
jne    11da <main_menu+0x6a>
mov    $0x0,%al
call   1070 <display_help@plt>
jmp    1205 <main_menu+0x95>
cmpl   $0x5,-0x4(%rbp)
jne    1200 <main_menu+0x90>
mov    $0x0,%al
call   1090 <clear_score_dialog@plt>
cmp    $0x1,%eax
jne    11fb <main_menu+0x8b>
mov    $0x0,%al
call   1080 <clear_highscore@plt>
jmp    1200 <main_menu+0x90>
jmp    1205 <main_menu+0x95>
jmp    120a <main_menu+0x9a>
jmp    120f <main_menu+0x9f>
jmp    1214 <main_menu+0xa4>
jmp    1219 <main_menu+0xa9>
cmpl   $0x6,-0x4(%rbp)
jne    1178 <main_menu+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_menu>:
push   %rbx
lea    0xe88(%rip),%rbx
jmp    1190 <main_menu+0x20>
xor    %eax,%eax
call   1070 <display_help@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <display_menu@plt>
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     1190 <main_menu+0x20>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <run@plt>
jmp    1190 <main_menu+0x20>
xor    %eax,%eax
call   1040 <show_highscores@plt>
jmp    1190 <main_menu+0x20>
xor    %eax,%eax
call   1030 <display_controls@plt>
jmp    1190 <main_menu+0x20>
xor    %eax,%eax
call   1090 <clear_score_dialog@plt>
cmp    $0x1,%eax
jne    1190 <main_menu+0x20>
xor    %eax,%eax
call   1080 <clear_highscore@plt>
jmp    1190 <main_menu+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @main_menu() {
%1 = alloca i32
br label %2
2: ; preds = %37, %0
%3 = call i32 (...) @display_menu()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 (...) @run()
br label %36
8: ; preds = %2
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (...) @show_highscores()
br label %35
13: ; preds = %8
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @display_controls()
br label %34
18: ; preds = %13
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (...) @display_help()
br label %33
23: ; preds = %18
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, 5
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = call i32 (...) @clear_score_dialog()
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @clear_highscore()
br label %31
31: ; preds = %29, %26
br label %32
32: ; preds = %31, %23
br label %33
33: ; preds = %32, %21
br label %34
34: ; preds = %33, %16
br label %35
35: ; preds = %34, %11
br label %36
36: ; preds = %35, %6
br label %37
37: ; preds = %36
%38 = load i32, i32* %1
%39 = icmp ne i32 %38, 6
br i1 %39, label %2, label %40
40: ; preds = %37
ret void
}

LLVM IR (-O2):
define void @main_menu() {
br label %1
1: ; preds = %7, %0
%2 = tail call i32 (...) @display_menu()
switch i32 %2, label %7 [
i32 1, label %3
i32 2, label %5
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %17
]
3: ; preds = %1
%4 = tail call i32 (...) @run()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @show_highscores()
br label %7
7: ; preds = %5, %10, %12, %15, %8, %3, %1
br label %1
8: ; preds = %1
%9 = tail call i32 (...) @display_controls()
br label %7
10: ; preds = %1
%11 = tail call i32 (...) @display_help()
br label %7
12: ; preds = %1
%13 = tail call i32 (...) @clear_score_dialog()
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %7
15: ; preds = %12
%16 = tail call i32 (...) @clear_highscore()
br label %7
17: ; preds = %1
ret void
}