#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 */
typedef int /*<<< orphan*/ choices;

/* Variables and functions */
int grid_get_data_from_id(int *, int *, int *, int);
int /*<<< orphan*/ highscore_get_id(int *, int, int);
int interface_screen_choices(int *, char **, int, char *);
int /*<<< orphan*/ print_highscores(int);
int menu_highscores(void) {
  char *(choices[]) = {"Small", "Medium", "Large"};
  int number_of_choices = sizeof(choices) / sizeof(*choices);
  char *title = "Choose the size";
  int retval;
  int result;
  int row_dim, col_dim, bombs;
  int score_id;
  retval = interface_screen_choices(&result, choices, number_of_choices, title);
  if (((retval) == (!(0))))
    return (!(0));
  retval = grid_get_data_from_id(&row_dim, &col_dim, &bombs, result);
  if (((retval) == (!(0))))
    return (!(0));
  highscore_get_id(&score_id, row_dim, col_dim);
  print_highscores(score_id);
  return (0);
}


x86 assembly (clang, -O0):
<menu_highscores>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x2cb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cab(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x3,-0x24(%rbp)
lea    0xe9c(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%rcx
lea    -0x38(%rbp),%rdi
call   1040 <interface_screen_choices@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    11a8 <menu_highscores+0x68>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <menu_highscores+0xb3>
mov    -0x38(%rbp),%ecx
lea    -0x3c(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
call   1050 <grid_get_data_from_id@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    11d5 <menu_highscores+0x95>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <menu_highscores+0xb3>
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
lea    -0x48(%rbp),%rdi
call   1060 <highscore_get_id@plt>
mov    -0x48(%rbp),%edi
call   1030 <print_highscores@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_highscores>:
push   %rbx
sub    $0x40,%rsp
mov    0x2cc4(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0x2ca8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xeaf(%rip),%rcx
lea    0x18(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    $0x3,%edx
call   1040 <interface_screen_choices@plt>
mov    $0x1,%ebx
cmp    $0x1,%eax
je     11bc <menu_highscores+0x7c>
mov    0x18(%rsp),%ecx
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x1c(%rsp),%rdx
call   1050 <grid_get_data_from_id@plt>
cmp    $0x1,%eax
je     11bc <menu_highscores+0x7c>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xc(%rsp),%rdi
call   1060 <highscore_get_id@plt>
mov    0xc(%rsp),%edi
call   1030 <print_highscores@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Small\00"
@.str.1 = [7 x i8] c"Medium\00"
@.str.2 = [6 x i8] c"Large\00"
@__const.menu_highscores.choices = [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [16 x i8] c"Choose the size\00"
define i32 @menu_highscores() {
%1 = alloca i32
%2 = alloca [3 x i8*]
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = bitcast [3 x i8*]* %2 to i8*
store i32 3, i32* %3
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %4
%12 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = load i8*, i8** %4
%15 = call i32 @interface_screen_choices(i32* %6, i8** %12, i32 %13, i8* %14)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %19
18: ; preds = %0
store i32 1, i32* %1
br label %31
19: ; preds = %0
%20 = load i32, i32* %6
%21 = call i32 @grid_get_data_from_id(i32* %7, i32* %8, i32* %9, i32 %20)
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 1, i32* %1
br label %31
25: ; preds = %19
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = call i32 @highscore_get_id(i32* %10, i32 %26, i32 %27)
%29 = load i32, i32* %10
%30 = call i32 @print_highscores(i32 %29)
store i32 0, i32* %1
br label %31
31: ; preds = %25, %24, %18
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [6 x i8] c"Small\00"
@.str.1 = [7 x i8] c"Medium\00"
@.str.2 = [6 x i8] c"Large\00"
@__const.menu_highscores.choices = [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [16 x i8] c"Choose the size\00"
define i32 @menu_highscores() {
%1 = alloca [3 x i8*]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [3 x i8*]* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%14 = call i32 @interface_screen_choices(i32* %2, i8** %13, i32 3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i32 %14, 1
br i1 %15, label %26, label %16
16: ; preds = %0
%17 = load i32, i32* %2
%18 = call i32 @grid_get_data_from_id(i32* %3, i32* %4, i32* %5, i32 %17)
%19 = icmp eq i32 %18, 1
br i1 %19, label %26, label %20
20: ; preds = %16
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @highscore_get_id(i32* %6, i32 %21, i32 %22)
%24 = load i32, i32* %6
%25 = call i32 @print_highscores(i32 %24)
br label %26
26: ; preds = %16, %0, %20
%27 = phi i32 [ 0, %20 ], [ 1, %0 ], [ 1, %16 ]
ret i32 %27
}