#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*/ clearscr();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int highscore_menu() {
  int option;
  clearscr();
  do {
    printf("Triplets - Highscores\n");
    printf("\n1. 3x3 Highscores");
    printf("\n2. 6x6 Highscores");
    printf("\n3. 9x9 Highscores");
    printf("\n4. 12x12 Highscores");
    printf("\n(Choose an option and press enter).\nInsert 0 to return to main "
           "menu: ");
    scanf("%d", &option);
  } while (option < 0 || option > 4);
  return option;
}


x86 assembly (clang, -O0):
<highscore_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <clearscr@plt>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     11b0 <highscore_menu+0x80>
cmpl   $0x4,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    113f <highscore_menu+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<highscore_menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <clearscr@plt>
lea    0xeba(%rip),%r12
lea    0xec6(%rip),%r13
lea    0xed2(%rip),%rbx
lea    0xee0(%rip),%rbp
lea    0xf20(%rip),%r14
lea    0x4(%rsp),%r15
nopw   0x0(%rax,%rax,1)
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x4,%eax
ja     1180 <highscore_menu+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Triplets - Highscores\0A\00"
@.str.1 = [19 x i8] c"\0A1. 3x3 Highscores\00"
@.str.2 = [19 x i8] c"\0A2. 6x6 Highscores\00"
@.str.3 = [19 x i8] c"\0A3. 9x9 Highscores\00"
@.str.4 = [21 x i8] c"\0A4. 12x12 Highscores\00"
@.str.5 = [71 x i8] c"\0A(Choose an option and press enter).\0AInsert 0 to return to main menu: \00"
@.str.6 = [3 x i8] c"%d\00"
define i32 @highscore_menu() {
%1 = alloca i32
%2 = call i32 (...) @clearscr()
br label %3
3: ; preds = %17, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
br label %11
11: ; preds = %3
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 4
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ true, %11 ], [ %16, %14 ]
br i1 %18, label %3, label %19
19: ; preds = %17
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"\0A1. 3x3 Highscores\00"
@.str.2 = [19 x i8] c"\0A2. 6x6 Highscores\00"
@.str.3 = [19 x i8] c"\0A3. 9x9 Highscores\00"
@.str.4 = [21 x i8] c"\0A4. 12x12 Highscores\00"
@.str.5 = [71 x i8] c"\0A(Choose an option and press enter).\0AInsert 0 to return to main menu: \00"
@.str.6 = [3 x i8] c"%d\00"
@str = [22 x i8] c"Triplets - Highscores\00"
define i32 @highscore_menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @clearscr()
br label %4
4: ; preds = %4, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp ugt i32 %12, 4
br i1 %13, label %4, label %14
14: ; preds = %4
ret i32 %12
}