#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
char MainMenu(void) {
  char buffer[100];
  printf("1) Exit\n");
  printf("2) Build Database from File\n");
  printf("3) Add Item \n");
  printf("4) Find Item by Name \n");
  printf("5) Find Item by Number \n");
  printf("6) Write Database to File\n");
  printf("7) Delete movie \n");
  printf("\n");
  printf("Enter selection: ");
  scanf("%s", buffer);
  return buffer[0];
}


x86 assembly (clang, -O0):
<MainMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xf04(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x70(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MainMenu>:
sub    $0x68,%rsp
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xed7(%rip),%rdi
call   1040 <puts@plt>
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
lea    0xeed(%rip),%rdi
call   1040 <puts@plt>
lea    0xefb(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%al
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"1) Exit\0A\00"
@.str.1 = [29 x i8] c"2) Build Database from File\0A\00"
@.str.2 = [14 x i8] c"3) Add Item \0A\00"
@.str.3 = [23 x i8] c"4) Find Item by Name \0A\00"
@.str.4 = [25 x i8] c"5) Find Item by Number \0A\00"
@.str.5 = [27 x i8] c"6) Write Database to File\0A\00"
@.str.6 = [18 x i8] c"7) Delete movie \0A\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [18 x i8] c"Enter selection: \00"
@.str.9 = [3 x i8] c"%s\00"
define signext i8 @MainMenu() {
%1 = alloca [100 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 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 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%14 = load i8, i8* %13
ret i8 %14
}

LLVM IR (-O2):
@.str.8 = [18 x i8] c"Enter selection: \00"
@.str.9 = [3 x i8] c"%s\00"
@str = [8 x i8] c"1) Exit\00"
@str.10 = [28 x i8] c"2) Build Database from File\00"
@str.11 = [13 x i8] c"3) Add Item \00"
@str.12 = [22 x i8] c"4) Find Item by Name \00"
@str.13 = [24 x i8] c"5) Find Item by Number \00"
@str.14 = [26 x i8] c"6) Write Database to File\00"
@str.15 = [17 x i8] c"7) Delete movie \00"
define signext i8 @MainMenu() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.10, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.12, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.13, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.14, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %2)
%13 = load i8, i8* %2
ret i8 %13
}