#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*/ COLOR_PAIR(int);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ control();
int /*<<< orphan*/ mvprintw(int, int, char *);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scanf(char *, char *);
void menu(void) {
  char c = 'a';
  int i, j;
  while (c != 'q' && c != 'Q') {
    attron(COLOR_PAIR(7));
    for (i = 0; i < 31; i++) {
      for (j = 0; j < 55 + 7; j++) {
        printw(" ");
      }
      printw("\n");
    }
    mvprintw(0, 1,
             " ____                                                        ");
    mvprintw(
        1, 1,
        "/\\  _`\\                         /'\\_/`\\                      ");
    mvprintw(
        2, 1,
        "\\ \\ \\L\\ \\ __      ___          /\\      \\     __      ___     ");
    mvprintw(3, 1,
             " \\ \\ ,__/'__`\\   /'___\\ _______\\ \\ \\__\\ \\  /'__`\\  /' "
             "_ `\\   ");
    mvprintw(4, 1,
             "  \\ \\ \\/\\ \\L\\.\\_/\\ \\__//\\______\\\\ \\ \\_/\\ \\/\\ "
             "\\L\\.\\_/\\ \\/\\ \\  ");
    mvprintw(5, 1,
             "   \\ \\_\\ \\__/.\\_\\ \\____\\/______/ \\ \\_\\\\ \\_\\ "
             "\\__/.\\_\\ \\_\\ \\_\\ ");
    mvprintw(6, 1,
             "    \\/_/\\/__/\\/_/\\/____/          \\/_/ "
             "\\/_/\\/__/\\/_/\\/_/\\/_/ \n");
    mvprintw(10, 25, "BENVENUTO!");
    mvprintw(14, 16, "Scegli cosa fare:");
    mvprintw(16, 16, "[P] Gioca");
    mvprintw(17, 16, "[Q] Esci");
    attroff(COLOR_PAIR(7));
    refresh();
    scanf("%c", &c);
    switch (c) {
    case 'p':
    case 'P':
      clear();
      control();
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movb   $0x61,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x71,%ecx
mov    %al,-0xd(%rbp)
je     11bb <menu+0x2b>
movsbl -0x1(%rbp),%eax
cmp    $0x51,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    11cb <menu+0x3b>
jmp    136f <menu+0x1df>
mov    $0x7,%edi
call   1070 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1050 <attron@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f,-0x8(%rbp)
jge    1232 <menu+0xa2>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e,-0xc(%rbp)
jge    1218 <menu+0x88>
lea    0xe37(%rip),%rdi
call   1060 <printw@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f4 <menu+0x64>
lea    0xf92(%rip),%rdi
call   1060 <printw@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e3 <menu+0x53>
lea    0xdc7(%rip),%rdx
xor    %edi,%edi
mov    %edi,-0x14(%rbp)
mov    $0x1,%esi
mov    %esi,-0x1c(%rbp)
call   10b0 <mvprintw@plt>
mov    -0x1c(%rbp),%esi
lea    0xde9(%rip),%rdx
mov    %esi,%edi
call   10b0 <mvprintw@plt>
mov    -0x1c(%rbp),%esi
lea    0xe16(%rip),%rdx
mov    $0x2,%edi
call   10b0 <mvprintw@plt>
mov    -0x1c(%rbp),%esi
lea    0xe40(%rip),%rdx
mov    $0x3,%edi
call   10b0 <mvprintw@plt>
mov    -0x1c(%rbp),%esi
lea    0xe6a(%rip),%rdx
mov    $0x4,%edi
call   10b0 <mvprintw@plt>
mov    -0x1c(%rbp),%esi
lea    0xe94(%rip),%rdx
mov    $0x5,%edi
call   10b0 <mvprintw@plt>
mov    -0x1c(%rbp),%esi
lea    0xebe(%rip),%rdx
mov    $0x6,%edi
call   10b0 <mvprintw@plt>
lea    0xeec(%rip),%rdx
mov    $0xa,%edi
mov    $0x19,%esi
call   10b0 <mvprintw@plt>
lea    0xee1(%rip),%rdx
mov    $0xe,%edi
mov    $0x10,%esi
mov    %esi,-0x18(%rbp)
call   10b0 <mvprintw@plt>
mov    -0x18(%rbp),%esi
lea    0xed7(%rip),%rdx
mov    %esi,%edi
call   10b0 <mvprintw@plt>
mov    -0x18(%rbp),%esi
lea    0xed0(%rip),%rdx
mov    $0x11,%edi
call   10b0 <mvprintw@plt>
mov    $0x7,%edi
call   1070 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    -0x14(%rbp),%eax
call   1080 <refresh@plt>
lea    0xeaf(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1090 <scanf@plt>
movsbl -0x1(%rbp),%eax
or     $0x20,%eax
sub    $0x70,%eax
je     1352 <menu+0x1c2>
jmp    1365 <menu+0x1d5>
mov    $0x0,%al
call   10a0 <clear@plt>
mov    $0x0,%al
call   1040 <control@plt>
jmp    136a <menu+0x1da>
jmp    136a <menu+0x1da>
jmp    119c <menu+0xc>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x61,0x7(%rsp)
lea    0xe95(%rip),%rbx
lea    0x1003(%rip),%r14
lea    0x102e(%rip),%rbp
lea    0x7(%rsp),%r15
jmp    11ca <menu+0x3a>
nopl   0x0(%rax)
and    $0xdf,%al
cmp    $0x51,%al
je     134c <menu+0x1bc>
mov    $0x7,%edi
call   1070 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1050 <attron@plt>
xor    %r12d,%r12d
xchg   %ax,%ax
mov    $0x3e,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <printw@plt>
add    $0xffffffff,%r13d
jne    11f0 <menu+0x60>
mov    %r14,%rdi
call   1060 <printw@plt>
add    $0x1,%r12d
cmp    $0x1f,%r12d
jne    11e0 <menu+0x50>
xor    %edi,%edi
mov    $0x1,%esi
lea    0xde2(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x1,%edi
mov    $0x1,%esi
lea    0xe0a(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x2,%edi
mov    $0x1,%esi
lea    0xe32(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x3,%edi
mov    $0x1,%esi
lea    0xe5a(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x4,%edi
mov    $0x1,%esi
lea    0xe82(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x5,%edi
mov    $0x1,%esi
lea    0xeaa(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x6,%edi
mov    $0x1,%esi
lea    0xed2(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0xa,%edi
mov    $0x19,%esi
lea    0xefb(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0xe,%edi
mov    $0x10,%esi
lea    0xef0(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x10,%edi
mov    $0x10,%esi
lea    0xeec(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x11,%edi
mov    $0x10,%esi
lea    0xee0(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x7,%edi
call   1070 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1090 <scanf@plt>
movsbl 0x7(%rsp),%eax
mov    %eax,%ecx
or     $0x20,%ecx
cmp    $0x70,%ecx
jne    11c0 <menu+0x30>
xor    %eax,%eax
call   10a0 <clear@plt>
xor    %eax,%eax
call   1040 <control@plt>
mov    0x7(%rsp),%al
jmp    11c0 <menu+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [62 x i8] c" ____ \00"
@.str.3 = [62 x i8] c"/\\ _`\\ /'\\_/`\\ \00"
@.str.4 = [62 x i8] c"\\ \\ \\L\\ \\ __ ___ /\\ \\ __ ___ \00"
@.str.5 = [62 x i8] c" \\ \\ ,__/'__`\\ /'___\\ _______\\ \\ \\__\\ \\ /'__`\\ /' _ `\\ \00"
@.str.6 = [62 x i8] c" \\ \\ \\/\\ \\L\\.\\_/\\ \\__//\\______\\\\ \\ \\_/\\ \\/\\ \\L\\.\\_/\\ \\/\\ \\ \00"
@.str.7 = [62 x i8] c" \\ \\_\\ \\__/.\\_\\ \\____\\/______/ \\ \\_\\\\ \\_\\ \\__/.\\_\\ \\_\\ \\_\\ \00"
@.str.8 = [63 x i8] c" \\/_/\\/__/\\/_/\\/____/ \\/_/ \\/_/\\/__/\\/_/\\/_/\\/_/ \0A\00"
@.str.9 = [11 x i8] c"BENVENUTO!\00"
@.str.10 = [18 x i8] c"Scegli cosa fare:\00"
@.str.11 = [10 x i8] c"[P] Gioca\00"
@.str.12 = [9 x i8] c"[Q] Esci\00"
@.str.13 = [3 x i8] c"%c\00"
define void @menu() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
store i8 97, i8* %1
br label %4
4: ; preds = %56, %0
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 113
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 81
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ false, %4 ], [ %11, %8 ]
br i1 %13, label %14, label %57
14: ; preds = %12
%15 = call i32 @COLOR_PAIR(i32 7)
%16 = call i32 @attron(i32 %15)
store i32 0, i32* %2
br label %17
17: ; preds = %31, %14
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 31
br i1 %19, label %20, label %34
20: ; preds = %17
store i32 0, i32* %3
br label %21
21: ; preds = %26, %20
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 62
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %21
29: ; preds = %21
%30 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %17
34: ; preds = %17
%35 = call i32 @mvprintw(i32 0, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @mvprintw(i32 1, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @mvprintw(i32 2, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%38 = call i32 @mvprintw(i32 3, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @mvprintw(i32 4, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.6, i64 0, i64 0))
%40 = call i32 @mvprintw(i32 5, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
%41 = call i32 @mvprintw(i32 6, i32 1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
%42 = call i32 @mvprintw(i32 10, i32 25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%43 = call i32 @mvprintw(i32 14, i32 16, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%44 = call i32 @mvprintw(i32 16, i32 16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%45 = call i32 @mvprintw(i32 17, i32 16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%46 = call i32 @COLOR_PAIR(i32 7)
%47 = call i32 @attroff(i32 %46)
%48 = call i32 (...) @refresh()
%49 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %1)
%50 = load i8, i8* %1
%51 = sext i8 %50 to i32
switch i32 %51, label %55 [
i32 112, label %52
i32 80, label %52
]
52: ; preds = %34, %34
%53 = call i32 (...) @clear()
%54 = call i32 (...) @control()
br label %56
55: ; preds = %34
br label %56
56: ; preds = %55, %52
br label %4
57: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [62 x i8] c" ____ \00"
@.str.3 = [62 x i8] c"/\\ _`\\ /'\\_/`\\ \00"
@.str.4 = [62 x i8] c"\\ \\ \\L\\ \\ __ ___ /\\ \\ __ ___ \00"
@.str.5 = [62 x i8] c" \\ \\ ,__/'__`\\ /'___\\ _______\\ \\ \\__\\ \\ /'__`\\ /' _ `\\ \00"
@.str.6 = [62 x i8] c" \\ \\ \\/\\ \\L\\.\\_/\\ \\__//\\______\\\\ \\ \\_/\\ \\/\\ \\L\\.\\_/\\ \\/\\ \\ \00"
@.str.7 = [62 x i8] c" \\ \\_\\ \\__/.\\_\\ \\____\\/______/ \\ \\_\\\\ \\_\\ \\__/.\\_\\ \\_\\ \\_\\ \00"
@.str.8 = [63 x i8] c" \\/_/\\/__/\\/_/\\/____/ \\/_/ \\/_/\\/__/\\/_/\\/_/\\/_/ \0A\00"
@.str.9 = [11 x i8] c"BENVENUTO!\00"
@.str.10 = [18 x i8] c"Scegli cosa fare:\00"
@.str.11 = [10 x i8] c"[P] Gioca\00"
@.str.12 = [9 x i8] c"[Q] Esci\00"
@.str.13 = [3 x i8] c"%c\00"
define void @menu() {
%1 = alloca i8
store i8 97, i8* %1
br label %2
2: ; preds = %0, %38
%3 = call i32 @COLOR_PAIR(i32 7)
%4 = call i32 @attron(i32 %3)
br label %5
5: ; preds = %2, %12
%6 = phi i32 [ 0, %2 ], [ %14, %12 ]
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ 0, %5 ], [ %10, %7 ]
%9 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, 62
br i1 %11, label %12, label %7
12: ; preds = %7
%13 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = add nuw nsw i32 %6, 1
%15 = icmp eq i32 %14, 31
br i1 %15, label %16, label %5
16: ; preds = %12
%17 = call i32 @mvprintw(i32 0, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @mvprintw(i32 1, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @mvprintw(i32 2, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @mvprintw(i32 3, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @mvprintw(i32 4, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.6, i64 0, i64 0))
%22 = call i32 @mvprintw(i32 5, i32 1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
%23 = call i32 @mvprintw(i32 6, i32 1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
%24 = call i32 @mvprintw(i32 10, i32 25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%25 = call i32 @mvprintw(i32 14, i32 16, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%26 = call i32 @mvprintw(i32 16, i32 16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%27 = call i32 @mvprintw(i32 17, i32 16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%28 = call i32 @COLOR_PAIR(i32 7)
%29 = call i32 @attroff(i32 %28)
%30 = call i32 (...) @refresh()
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %1)
%32 = load i8, i8* %1
%33 = sext i8 %32 to i32
switch i32 %33, label %38 [
i32 112, label %34
i32 80, label %34
]
34: ; preds = %16, %16
%35 = call i32 (...) @clear()
%36 = call i32 (...) @control()
%37 = load i8, i8* %1
br label %38
38: ; preds = %16, %34
%39 = phi i8 [ %32, %16 ], [ %37, %34 ]
%40 = and i8 %39, -33
%41 = icmp eq i8 %40, 81
br i1 %41, label %42, label %2
42: ; preds = %38
ret void
}