#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 *, int *);
int /*<<< orphan*/ system(char *);
int MenuSelection() {
  int selection;
  system("cls");
  printf("******************** MAIN MENU ***********************\n");
  printf("*                                                    *\n");
  printf("* 1 --> Display Array                                *\n");
  printf("* 2 --> Display Linked List                          *\n");
  printf("* 3 --> Reverse procedure                            *\n");
  printf("* 4 --> Quit                                         *\n");
  printf("*                                                    *\n");
  printf("******************************************************\n\n");
  do {
    printf("Enter your choice >");
    scanf("%d", &selection);
  } while (selection < 1 || selection > 4);
  printf("\n");
  return selection;
}


x86 assembly (clang, -O0):
<MenuSelection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <system@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xee5(%rip),%rdi
call   1040 <printf@plt>
lea    0xf11(%rip),%rdi
call   1040 <printf@plt>
lea    0xf3d(%rip),%rdi
call   1040 <printf@plt>
lea    0xf69(%rip),%rdi
call   1040 <printf@plt>
lea    0xf95(%rip),%rdi
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
lea    0xfb5(%rip),%rdi
call   1040 <printf@plt>
lea    0xfe2(%rip),%rdi
call   1040 <printf@plt>
lea    0xfea(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     11d9 <MenuSelection+0xa9>
cmpl   $0x4,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    11a4 <MenuSelection+0x74>
lea    0xfa0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MenuSelection>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea0(%rip),%rdi
call   1050 <system@plt>
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
lea    0xfb6(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xef6(%rip),%rdi
call   1040 <puts@plt>
lea    0xf21(%rip),%rdi
call   1040 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xfa6(%rip),%rdi
call   1040 <puts@plt>
lea    0xe39(%rip),%r14
lea    0xe46(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xfffffffb,%eax
cmp    $0xfffffffc,%eax
jb     11e0 <MenuSelection+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [56 x i8] c"******************** MAIN MENU ***********************\0A\00"
@.str.2 = [56 x i8] c"* *\0A\00"
@.str.3 = [56 x i8] c"* 1 --> Display Array *\0A\00"
@.str.4 = [56 x i8] c"* 2 --> Display Linked List *\0A\00"
@.str.5 = [56 x i8] c"* 3 --> Reverse procedure *\0A\00"
@.str.6 = [56 x i8] c"* 4 --> Quit *\0A\00"
@.str.7 = [57 x i8] c"******************************************************\0A\0A\00"
@.str.8 = [20 x i8] c"Enter your choice >\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @MenuSelection() {
%1 = alloca i32
%2 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
br label %11
11: ; preds = %20, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
br label %14
14: ; preds = %11
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, 4
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ true, %14 ], [ %19, %17 ]
br i1 %21, label %11, label %22
22: ; preds = %20
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.8 = [20 x i8] c"Enter your choice >\00"
@.str.9 = [3 x i8] c"%d\00"
@str = [55 x i8] c"******************** MAIN MENU ***********************\00"
@str.12 = [55 x i8] c"* 1 --> Display Array *\00"
@str.13 = [55 x i8] c"* 2 --> Display Linked List *\00"
@str.14 = [55 x i8] c"* 3 --> Reverse procedure *\00"
@str.15 = [55 x i8] c"* 4 --> Quit *\00"
@str.16 = [55 x i8] c"* *\00"
@str.17 = [56 x i8] c"******************************************************\0A\00"
define i32 @MenuSelection() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.12, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.13, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.14, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.15, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.16, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.17, i64 0, i64 0))
br label %12
12: ; preds = %12, %0
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = add i32 %15, -5
%17 = icmp ult i32 %16, -4
br i1 %17, label %12, label %18
18: ; preds = %12
%19 = call i32 @putchar(i32 10)
%20 = load i32, i32* %1
ret i32 %20
}