#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*/ display_error_scanf();
int /*<<< orphan*/ display_level();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ select_save_to_load();
int /*<<< orphan*/ shell_clear();
void display_menu() {
  int choix;
  shell_clear();
  printf("1 - Jouer\n");
  printf("2 - Charger une partie existante\n");
  printf("3 - Options\n");
  scanf("%d", &choix);
  shell_clear();
  switch (choix) {
  case 1:
    display_level();
    break;
  case 2:
    select_save_to_load();
    break;
  default:
    display_error_scanf();
    display_menu();
    break;
  }
}


x86 assembly (clang, -O0):
<display_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %al,-0x9(%rbp)
call   1060 <shell_clear@plt>
lea    0xe77(%rip),%rdi
call   1070 <printf@plt>
lea    0xe76(%rip),%rdi
call   1070 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1070 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x9(%rbp),%al
call   1060 <shell_clear@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     11e3 <display_menu+0x73>
jmp    11d2 <display_menu+0x62>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11ef <display_menu+0x7f>
jmp    11fb <display_menu+0x8b>
mov    $0x0,%al
call   1040 <display_level@plt>
jmp    1207 <display_menu+0x97>
mov    $0x0,%al
call   1090 <select_save_to_load@plt>
jmp    1207 <display_menu+0x97>
mov    $0x0,%al
call   1030 <display_error_scanf@plt>
call   1050 <display_menu@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_menu>:
push   %rax
xor    %eax,%eax
call   1070 <shell_clear@plt>
lea    0xe84(%rip),%rdi
call   1050 <puts@plt>
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
lea    0xe97(%rip),%rdi
call   1050 <puts@plt>
lea    0xe5d(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1070 <shell_clear@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     11cb <display_menu+0x5b>
cmp    $0x1,%eax
jne    11d4 <display_menu+0x64>
xor    %eax,%eax
call   1040 <display_level@plt>
pop    %rax
ret
xor    %eax,%eax
call   1090 <select_save_to_load@plt>
pop    %rax
ret
xor    %eax,%eax
call   1030 <display_error_scanf@plt>
call   1060 <display_menu@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"1 - Jouer\0A\00"
@.str.1 = [34 x i8] c"2 - Charger une partie existante\0A\00"
@.str.2 = [13 x i8] c"3 - Options\0A\00"
@.str.3 = [3 x i8] c"%d\00"
define void @display_menu() {
%1 = alloca i32
%2 = call i32 (...) @shell_clear()
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%7 = call i32 (...) @shell_clear()
%8 = load i32, i32* %1
switch i32 %8, label %13 [
i32 1, label %9
i32 2, label %11
]
9: ; preds = %0
%10 = call i32 (...) @display_level()
br label %15
11: ; preds = %0
%12 = call i32 (...) @select_save_to_load()
br label %15
13: ; preds = %0
%14 = call i32 (...) @display_error_scanf()
br label %15
15: ; preds = %13, %11, %9
ret void
}

LLVM IR (-O2):
@.str.3 = [3 x i8] c"%d\00"
@str = [10 x i8] c"1 - Jouer\00"
@str.4 = [33 x i8] c"2 - Charger une partie existante\00"
@str.5 = [12 x i8] c"3 - Options\00"
define void @display_menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @shell_clear()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%8 = call i32 (...) @shell_clear()
%9 = load i32, i32* %1
switch i32 %9, label %14 [
i32 1, label %10
i32 2, label %12
]
10: ; preds = %0
%11 = call i32 (...) @display_level()
br label %16
12: ; preds = %0
%13 = call i32 (...) @select_save_to_load()
br label %16
14: ; preds = %0
%15 = call i32 (...) @display_error_scanf()
br label %16
16: ; preds = %14, %12, %10
ret void
}