#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 *);
displayMenu() {
  int menuOption, clean;
  printf("\nWELCOME TO RIFELI'S MUSIC STORE (RU 2136681). Our menu: \n");
  printf("***************************** \n");
  printf("[ 1 ] Search Student \n");
  printf("[ 2 ] 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    0xf0f(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%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     11b0 <displayMenu+0x80>
mov    -0x8(%rbp),%eax
mov    0x2e40(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11c0 <displayMenu+0x90>
jmp    11c5 <displayMenu+0x95>
jmp    1184 <displayMenu+0x54>
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    0xf17(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e60(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     11a0 <displayMenu+0x70>
cmp    (%rbx),%eax
jne    1190 <displayMenu+0x60>
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 = [23 x i8] c"[ 1 ] Search Student \0A\00"
@.str.3 = [13 x i8] c"[ 2 ] Exit \0A\00"
@.str.4 = [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 ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
br label %9
9: ; preds = %18, %0
%10 = call i32 (...) @getchar()
store i32 %10, i32* %2
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br label %16
16: ; preds = %12, %9
%17 = phi i1 [ false, %9 ], [ %15, %12 ]
br i1 %17, label %18, label %19
18: ; preds = %16
br label %9
19: ; preds = %16
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str.4 = [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.6 = [22 x i8] c"[ 1 ] Search Student \00"
@str.7 = [12 x i8] c"[ 2 ] Exit \00"
@str.8 = [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.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
br label %9
9: ; preds = %9, %0
%10 = call i32 (...) @getchar()
%11 = icmp ne i32 %10, 10
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %10, %12
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %9, label %15
15: ; preds = %9
%16 = load i32, i32* %1
ret i32 %16
}