#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 *);
unsigned int get_menu_choice(void) {
  int selection;
  do {
    system("clear");
    printf("\n\t\t\t\033[40;34;01mWelcome to LCalc\n");
    printf("\t\t\t\033[40;35m**********************");
    printf("\t\t\t\n");
    printf("\t\t\t\033[40;32m1-aDD");
    printf("\n\t\t\t\033[40;33m2-SuBtRacT");
    printf("\n\t\t\t\033[40;35m3-MulTiplY");
    printf("\n\t\t\t\033[40;37m4-DiViDE");
    printf("\n\t\t\t\033[40;32m5-QuiT\n");
    printf("\t\t\t\033[40;35m**********************");
    printf("\n");
    printf("\n\t\t\033[40;31m Please Enter your SelectioN: ");
    scanf("%d", &selection);
  } while (selection < 1 || selection > 5);
  return selection;
}


x86 assembly (clang, -O0):
<get_menu_choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <system@plt>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
call   1040 <printf@plt>
lea    0xefa(%rip),%rdi
call   1040 <printf@plt>
lea    0xf03(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
call   1040 <printf@plt>
lea    0xf11(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     11f1 <get_menu_choice+0xc1>
cmpl   $0x5,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1138 <get_menu_choice+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_menu_choice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xea4(%rip),%rbx
lea    0xefe(%rip),%r15
lea    0xf5d(%rip),%r12
lea    0xf05(%rip),%r13
lea    0xf28(%rip),%rbp
lea    0x4(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe69(%rip),%rdi
call   1050 <system@plt>
lea    0xf06(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <printf@plt>
lea    0xf12(%rip),%rdi
call   1040 <puts@plt>
lea    0xe65(%rip),%rdi
call   1060 <printf@plt>
lea    0xe6a(%rip),%rdi
call   1060 <printf@plt>
lea    0xe75(%rip),%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1060 <printf@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x6(%rax),%ecx
cmp    $0xfffffffb,%ecx
jb     1190 <get_menu_choice+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [33 x i8] c"\0A\09\09\09\1B[40;34;01mWelcome to LCalc\0A\00"
@.str.2 = [34 x i8] c"\09\09\09\1B[40;35m**********************\00"
@.str.3 = [5 x i8] c"\09\09\09\0A\00"
@.str.4 = [17 x i8] c"\09\09\09\1B[40;32m1-aDD\00"
@.str.5 = [23 x i8] c"\0A\09\09\09\1B[40;33m2-SuBtRacT\00"
@.str.6 = [23 x i8] c"\0A\09\09\09\1B[40;35m3-MulTiplY\00"
@.str.7 = [21 x i8] c"\0A\09\09\09\1B[40;37m4-DiViDE\00"
@.str.8 = [20 x i8] c"\0A\09\09\09\1B[40;32m5-QuiT\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [42 x i8] c"\0A\09\09\1B[40;31m Please Enter your SelectioN: \00"
@.str.11 = [3 x i8] c"%d\00"
define i32 @get_menu_choice() {
%1 = alloca i32
br label %2
2: ; preds = %22, %0
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %1)
br label %16
16: ; preds = %2
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 1
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 5
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ true, %16 ], [ %21, %19 ]
br i1 %23, label %2, label %24
24: ; preds = %22
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.2 = [34 x i8] c"\09\09\09\1B[40;35m**********************\00"
@.str.4 = [17 x i8] c"\09\09\09\1B[40;32m1-aDD\00"
@.str.5 = [23 x i8] c"\0A\09\09\09\1B[40;33m2-SuBtRacT\00"
@.str.6 = [23 x i8] c"\0A\09\09\09\1B[40;35m3-MulTiplY\00"
@.str.7 = [21 x i8] c"\0A\09\09\09\1B[40;37m4-DiViDE\00"
@.str.10 = [42 x i8] c"\0A\09\09\1B[40;31m Please Enter your SelectioN: \00"
@.str.11 = [3 x i8] c"%d\00"
@str = [32 x i8] c"\0A\09\09\09\1B[40;34;01mWelcome to LCalc\00"
@str.12 = [4 x i8] c"\09\09\09\00"
@str.13 = [19 x i8] c"\0A\09\09\09\1B[40;32m5-QuiT\00"
define i32 @get_menu_choice() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.12, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @putchar(i32 10)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = add i32 %17, -6
%19 = icmp ult i32 %18, -5
br i1 %19, label %3, label %20
20: ; preds = %3
ret i32 %17
}