#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int displayMenu() {
  int menuOption, clean;
  printf("\nWELCOME TO RIFELI'S MUSIC STORE (RU 2136681). Our menu: \n");
  printf("***************************** \n");
  printf("[ 1 ] Add music \n");
  printf("[ 2 ] List musics \n");
  printf("[ 3 ] Exit \n");
  printf("***************************** \n");
  scanf("%d", &menuOption);
  while ((clean = getchar()) != '\n' && clean != EOF) {
  }
  return menuOption;
}


x86 assembly (clang, -O0):
<displayMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     11bc <displayMenu+0x8c>
mov    -0x8(%rbp),%eax
mov    0x2e34(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11cc <displayMenu+0x9c>
jmp    11d1 <displayMenu+0xa1>
jmp    1190 <displayMenu+0x60>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayMenu>:
push   %rbx
sub    $0x10,%rsp
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xf25(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e54(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     11b0 <displayMenu+0x80>
cmp    (%rbx),%eax
jne    11a0 <displayMenu+0x70>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [59 x i8] c"\0AWELCOME TO RIFELI'S MUSIC STORE (RU 2136681). Our menu: \0A\00"
@.str.1 = [32 x i8] c"***************************** \0A\00"
@.str.2 = [18 x i8] c"[ 1 ] Add music \0A\00"
@.str.3 = [20 x i8] c"[ 2 ] List musics \0A\00"
@.str.4 = [13 x i8] c"[ 3 ] Exit \0A\00"
@.str.5 = [3 x i8] c"%d\00"
@EOF = global i32 0
define i32 @displayMenu() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, 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 = %19, %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %2
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br label %17
17: ; preds = %13, %10
%18 = phi i1 [ false, %10 ], [ %16, %13 ]
br i1 %18, label %19, label %20
19: ; preds = %17
br label %10
20: ; preds = %17
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@EOF = global i32 0
@str = [58 x i8] c"\0AWELCOME TO RIFELI'S MUSIC STORE (RU 2136681). Our menu: \00"
@str.7 = [17 x i8] c"[ 1 ] Add music \00"
@str.8 = [19 x i8] c"[ 2 ] List musics \00"
@str.9 = [12 x i8] c"[ 3 ] Exit \00"
@str.10 = [31 x i8] c"***************************** \00"
define i32 @displayMenu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, 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 = %10, %0
%11 = call i32 (...) @getchar()
%12 = icmp ne i32 %11, 10
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %11, %13
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %10, label %16
16: ; preds = %10
%17 = load i32, i32* %1
ret i32 %17
}