#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 EXIT_SUCCESS;
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int order;
  double coef[10];
  double x;
  int count;
  double data[10];
  int statOption;
  int firstRows, firstCols;
  int secondRows, secondCols;
  int matrixOption;
  int option;
  double first[3][3];
  double second[3][3];
  double result[3][3];
  char choice;
  while (1) {
    puts("\n");
    puts("=====================================================");
    puts(" Main Menu:");
    puts("=====================================================");
    puts(" a: Polynomial Evaluation");
    puts(" b: Basic Statistics");
    puts(" c: Matrix Operations");
    puts(" e: Exit \n");
    printf(">> ");
    scanf(" %c", &choice);
    if (choice == 'a' || choice == 'A') {
      puts("You chose Polynomial Evaluation ...\n");
    } else if (choice == 'b' || choice == 'B') {
      puts("You chose Basic Statistics ...\n");
    } else if (choice == 'c' || choice == 'C') {
      puts("You chose Matrix Operations ...\n");
    } else if (choice == 'e' || choice == 'E' || choice == 'q' ||
               choice == 'Q') {
      puts("Exiting now...");
      break;
    } else {
      puts("Invalid Input... Please try again! (Type 'e' or 'q' to quit)");
    }
    getchar();
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf37(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x1d1(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x1d1(%rbp),%eax
cmp    $0x61,%eax
je     11f1 <main+0xb1>
movsbl -0x1d1(%rbp),%eax
cmp    $0x41,%eax
jne    1202 <main+0xc2>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
jmp    12d0 <main+0x190>
movsbl -0x1d1(%rbp),%eax
cmp    $0x62,%eax
je     1222 <main+0xe2>
movsbl -0x1d1(%rbp),%eax
cmp    $0x42,%eax
jne    1233 <main+0xf3>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
jmp    12cb <main+0x18b>
movsbl -0x1d1(%rbp),%eax
cmp    $0x63,%eax
je     1253 <main+0x113>
movsbl -0x1d1(%rbp),%eax
cmp    $0x43,%eax
jne    1264 <main+0x124>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
jmp    12c6 <main+0x186>
movsbl -0x1d1(%rbp),%eax
cmp    $0x65,%eax
je     12a4 <main+0x164>
movsbl -0x1d1(%rbp),%eax
cmp    $0x45,%eax
je     12a4 <main+0x164>
movsbl -0x1d1(%rbp),%eax
cmp    $0x71,%eax
je     12a4 <main+0x164>
movsbl -0x1d1(%rbp),%eax
cmp    $0x51,%eax
jne    12b5 <main+0x175>
lea    0xe55(%rip),%rdi
call   1030 <puts@plt>
jmp    12dc <main+0x19c>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
jmp    12c6 <main+0x186>
jmp    12cb <main+0x18b>
jmp    12d0 <main+0x190>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    1152 <main+0x12>
mov    0x2cfd(%rip),%rax
mov    (%rax),%eax
add    $0x1e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rbx
lea    0xf2e(%rip),%r14
lea    0xf32(%rip),%r15
lea    0xf2f(%rip),%r12
lea    0x7(%rsp),%r13
lea    0xfd9(%rip),%rbp
jmp    1198 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nop
movsbq %cl,%rax
movslq 0x0(%rbp,%rax,4),%rdi
add    %rbp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
movzbl 0x7(%rsp),%eax
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x3,%cl
jb     1180 <main+0x40>
add    $0xbb,%al
lea    0xef1(%rip),%rdi
cmp    $0x2c,%al
ja     118c <main+0x4c>
movzbl %al,%eax
movabs $0x100100001001,%rcx
bt     %rax,%rcx
lea    0xed1(%rip),%rdi
jae    118c <main+0x4c>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [54 x i8] c"=====================================================\00"
@.str.2 = [12 x i8] c" Main Menu:\00"
@.str.3 = [26 x i8] c" a: Polynomial Evaluation\00"
@.str.4 = [21 x i8] c" b: Basic Statistics\00"
@.str.5 = [22 x i8] c" c: Matrix Operations\00"
@.str.6 = [11 x i8] c" e: Exit \0A\00"
@.str.7 = [4 x i8] c">> \00"
@.str.8 = [4 x i8] c" %c\00"
@.str.9 = [37 x i8] c"You chose Polynomial Evaluation ...\0A\00"
@.str.10 = [32 x i8] c"You chose Basic Statistics ...\0A\00"
@.str.11 = [33 x i8] c"You chose Matrix Operations ...\0A\00"
@.str.12 = [15 x i8] c"Exiting now...\00"
@.str.13 = [61 x i8] c"Invalid Input... Please try again! (Type 'e' or 'q' to quit)\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x double]
%4 = alloca double
%5 = alloca i32
%6 = alloca [10 x double]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [3 x [3 x double]]
%15 = alloca [3 x [3 x double]]
%16 = alloca [3 x [3 x double]]
%17 = alloca i8
store i32 0, i32* %1
br label %18
18: ; preds = %0, %81
%19 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %17)
%29 = load i8, i8* %17
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 97
br i1 %31, label %36, label %32
32: ; preds = %18
%33 = load i8, i8* %17
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 65
br i1 %35, label %36, label %38
36: ; preds = %32, %18
%37 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0))
br label %81
38: ; preds = %32
%39 = load i8, i8* %17
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 98
br i1 %41, label %46, label %42
42: ; preds = %38
%43 = load i8, i8* %17
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 66
br i1 %45, label %46, label %48
46: ; preds = %42, %38
%47 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0))
br label %80
48: ; preds = %42
%49 = load i8, i8* %17
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 99
br i1 %51, label %56, label %52
52: ; preds = %48
%53 = load i8, i8* %17
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 67
br i1 %55, label %56, label %58
56: ; preds = %52, %48
%57 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
br label %79
58: ; preds = %52
%59 = load i8, i8* %17
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 101
br i1 %61, label %74, label %62
62: ; preds = %58
%63 = load i8, i8* %17
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 69
br i1 %65, label %74, label %66
66: ; preds = %62
%67 = load i8, i8* %17
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 113
br i1 %69, label %74, label %70
70: ; preds = %66
%71 = load i8, i8* %17
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 81
br i1 %73, label %74, label %76
74: ; preds = %70, %66, %62, %58
%75 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
br label %83
76: ; preds = %70
%77 = call i32 @puts(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.13, i64 0, i64 0))
br label %78
78: ; preds = %76
br label %79
79: ; preds = %78, %56
br label %80
80: ; preds = %79, %46
br label %81
81: ; preds = %80, %36
%82 = call i32 (...) @getchar()
br label %18
83: ; preds = %74
%84 = load i32, i32* @EXIT_SUCCESS
ret i32 %84
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [54 x i8] c"=====================================================\00"
@.str.2 = [12 x i8] c" Main Menu:\00"
@.str.3 = [26 x i8] c" a: Polynomial Evaluation\00"
@.str.4 = [21 x i8] c" b: Basic Statistics\00"
@.str.5 = [22 x i8] c" c: Matrix Operations\00"
@.str.6 = [11 x i8] c" e: Exit \0A\00"
@.str.7 = [4 x i8] c">> \00"
@.str.8 = [4 x i8] c" %c\00"
@.str.9 = [37 x i8] c"You chose Polynomial Evaluation ...\0A\00"
@.str.10 = [32 x i8] c"You chose Basic Statistics ...\0A\00"
@.str.11 = [33 x i8] c"You chose Matrix Operations ...\0A\00"
@.str.12 = [15 x i8] c"Exiting now...\00"
@.str.13 = [61 x i8] c"Invalid Input... Please try again! (Type 'e' or 'q' to quit)\00"
@EXIT_SUCCESS = global i32 0
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @.str.9 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([32 x i8]* @.str.10 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.11 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i8
br label %2
2: ; preds = %25, %0
%3 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %1)
%13 = load i8, i8* %1
%14 = and i8 %13, -33
%15 = add i8 %14, -65
%16 = icmp ult i8 %15, 3
br i1 %16, label %21, label %17
17: ; preds = %2
switch i8 %13, label %25 [
i8 113, label %18
i8 101, label %18
i8 81, label %18
i8 69, label %18
]
18: ; preds = %17, %17, %17, %17
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
21: ; preds = %2
%22 = sext i8 %15 to i64
%23 = shl i64 %22, 2
%24 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %23)
br label %25
25: ; preds = %21, %17
%26 = phi i8* [ getelementptr inbounds ([61 x i8], [61 x i8]* @.str.13, i64 0, i64 0), %17 ], [ %24, %21 ]
%27 = call i32 @puts(i8* dereferenceable(1) %26)
%28 = call i32 (...) @getchar()
br label %2
}