#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int menu() {
  int choice = 0;
  printf("\n\n\e[0;36mHello and welcome to the Hangman  !!!\n\nPlease enter "
         "your choice\n");
  printf("1. Play\n");
  printf("2. See the gameboard\n");
  printf("3. Quit\n\nI wanna do : ");
  scanf("%d\n", &choice);
  if (choice == 1) {
    return 0;
  }
  if (choice == 2) {
    exit(0);
  } else {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1191 <menu+0x61>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
cmpl   $0x2,-0x4(%rbp)
jne    11a2 <menu+0x72>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<menu>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
jne    1197 <menu+0x57>
xor    %eax,%eax
pop    %rcx
ret
cmp    $0x2,%eax
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [74 x i8] c"\0A\0A\1B[0;36mHello and welcome to the Hangman !!!\0A\0APlease enter your choice\0A\00"
@.str.1 = [9 x i8] c"1. Play\0A\00"
@.str.2 = [22 x i8] c"2. See the gameboard\0A\00"
@.str.3 = [23 x i8] c"3. Quit\0A\0AI wanna do : \00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @menu() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %0
ret i32 0
10: ; preds = %0
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %10
%16 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.3 = [23 x i8] c"3. Quit\0A\0AI wanna do : \00"
@.str.4 = [4 x i8] c"%d\0A\00"
@str = [73 x i8] c"\0A\0A\1B[0;36mHello and welcome to the Hangman !!!\0A\0APlease enter your choice\00"
@str.5 = [8 x i8] c"1. Play\00"
@str.6 = [21 x i8] c"2. See the gameboard\00"
define i32 @menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %12 [
i32 1, label %9
i32 2, label %10
]
9: ; preds = %0
ret i32 0
10: ; preds = %0
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %0
%13 = call i32 @exit(i32 0)
unreachable
}