#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. 12x12 Highscores");
    printf("\n(Choose an option and press enter).\nInsert 0 to return to main "
           "menu: ");
    scanf("%d", &option);
  } while (option < 0 || option > 3);
  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    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     11a4 <highscore_menu+0x74>
cmpl   $0x3,-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    0xea7(%rip),%r15
lea    0xeb3(%rip),%r12
lea    0xebf(%rip),%r13
lea    0xecd(%rip),%rbx
lea    0xf0d(%rip),%rbp
lea    0x4(%rsp),%r14
nopw   0x0(%rax,%rax,1)
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%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
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%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 = [21 x i8] c"\0A3. 12x12 Highscores\00"
@.str.4 = [71 x i8] c"\0A(Choose an option and press enter).\0AInsert 0 to return to main menu: \00"
@.str.5 = [3 x i8] c"%d\00"
define i32 @highscore_menu() {
%1 = alloca i32
%2 = call i32 (...) @clearscr()
br label %3
3: ; preds = %16, %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 ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
br label %10
10: ; preds = %3
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 3
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ true, %10 ], [ %15, %13 ]
br i1 %17, label %3, label %18
18: ; preds = %16
%19 = load i32, i32* %1
ret i32 %19
}

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 = [21 x i8] c"\0A3. 12x12 Highscores\00"
@.str.4 = [71 x i8] c"\0A(Choose an option and press enter).\0AInsert 0 to return to main menu: \00"
@.str.5 = [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 ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp ugt i32 %11, 3
br i1 %12, label %4, label %13
13: ; preds = %4
ret i32 %11
}