#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*/ displayDescription();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ loadgame();
int /*<<< orphan*/ playgame();
int /*<<< orphan*/ playmultiplayer();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int input;
  displayDescription();
  printf("\n1. Play game\n");
  printf("2. Load game\n");
  printf("3. Play multiplayer\n");
  printf("4. Exit\n");
  scanf("%d", &input);
  switch (input) {
  case 1:
    playgame();
    break;
  case 2:
    loadgame();
    break;
  case 3:
    playmultiplayer();
    break;
  case 4:
    printf("Thanks for playing!\n");
    break;
  default:
    printf("Bad input, exiting...");
    break;
  }
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1030 <displayDescription@plt>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1224 <main+0xb4>
mov    -0x10(%rbp),%rax
lea    0xe1a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <playgame@plt>
jmp    1230 <main+0xc0>
mov    $0x0,%al
call   1090 <loadgame@plt>
jmp    1230 <main+0xc0>
mov    $0x0,%al
call   1060 <playmultiplayer@plt>
jmp    1230 <main+0xc0>
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
jmp    1230 <main+0xc0>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <displayDescription@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe51(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11ee <main+0x6e>
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <playgame@plt>
jmp    121a <main+0x9a>
lea    0xe1e(%rip),%rdi
call   1050 <printf@plt>
jmp    121a <main+0x9a>
xor    %eax,%eax
call   10a0 <loadgame@plt>
jmp    121a <main+0x9a>
xor    %eax,%eax
call   1070 <playmultiplayer@plt>
jmp    121a <main+0x9a>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0A1. Play game\0A\00"
@.str.1 = [14 x i8] c"2. Load game\0A\00"
@.str.2 = [21 x i8] c"3. Play multiplayer\0A\00"
@.str.3 = [9 x i8] c"4. Exit\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [21 x i8] c"Thanks for playing!\0A\00"
@.str.6 = [22 x i8] c"Bad input, exiting...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @displayDescription()
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %18 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
]
10: ; preds = %0
%11 = call i32 (...) @playgame()
br label %20
12: ; preds = %0
%13 = call i32 (...) @loadgame()
br label %20
14: ; preds = %0
%15 = call i32 (...) @playmultiplayer()
br label %20
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %20
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %14, %12, %10
%21 = call i32 (...) @getchar()
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [22 x i8] c"Bad input, exiting...\00"
@str = [14 x i8] c"\0A1. Play game\00"
@str.7 = [13 x i8] c"2. Load game\00"
@str.8 = [20 x i8] c"3. Play multiplayer\00"
@str.9 = [8 x i8] c"4. Exit\00"
@str.10 = [20 x i8] c"Thanks for playing!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @displayDescription()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %18 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
]
10: ; preds = %0
%11 = call i32 (...) @playgame()
br label %20
12: ; preds = %0
%13 = call i32 (...) @loadgame()
br label %20
14: ; preds = %0
%15 = call i32 (...) @playmultiplayer()
br label %20
16: ; preds = %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0))
br label %20
18: ; preds = %0
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %14, %12, %10
%21 = call i32 (...) @getchar()
ret i32 0
}