#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*/ ComputeFactorial();
int /*<<< orphan*/ ComputeFibonacci();
int /*<<< orphan*/ ComputePi();
int /*<<< orphan*/ Logarithm();
int /*<<< orphan*/ QuadraticEquation();
int /*<<< orphan*/ checkDivisbility();
int /*<<< orphan*/ checkGoldenRatio();
int /*<<< orphan*/ checkOddOrEven();
int /*<<< orphan*/ checkPrime();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int choice, i, output;
  while (1) {
    printf("\n             ~~~~~~~~~~~~~~~~~~~~~~~~ \n        Welcome to "
           "CMaths (Ultimate C Maths App)\n\n         ");
    printf("    ~~~~~~~~~~~~~~~~~~~~~~~~");
    printf("\n     Would you like to do..?\n\n\t");
    printf("1-check even or odd      2-check prime number or not\n\t");
    printf("3-Check Divisbility      4-Check golden ratio\n\t");
    printf("5-Compute Factorial      6-Compute Fibonacci series\n\t");
    printf("7-Compute Pi             8-Solve a quadratic equation \n\t");
    printf("9-Logarithms Calculator       10-Compute Pascal's Triangle\n\t");
    printf("Choose an option :\n\n>>");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      checkOddOrEven();
      break;
    case 2:
      checkPrime();
      break;
    case 3:
      checkDivisbility();
      break;
    case 4:
      checkGoldenRatio();
      break;
    case 5:
      ComputeFactorial();
      break;
    case 6:
      ComputeFibonacci();
      break;
    case 7:
      ComputePi();
      break;
    case 8:
      QuadraticEquation();
      break;
    case 9:
      Logarithm();
      break;
    case 10:
      printf("Work in progress..");
      break;
    default:
      printf("Error!!");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
call   1040 <printf@plt>
lea    0xf28(%rip),%rdi
call   1040 <printf@plt>
lea    0xf52(%rip),%rdi
call   1040 <printf@plt>
lea    0xf7f(%rip),%rdi
call   1040 <printf@plt>
lea    0xfb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xfbb(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x9,%eax
ja     12e8 <main+0x138>
mov    -0x28(%rbp),%rax
lea    0xd9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <checkOddOrEven@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   1030 <checkPrime@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   10c0 <checkDivisbility@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   10b0 <checkGoldenRatio@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   1050 <ComputeFactorial@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   1070 <ComputeFibonacci@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   1060 <ComputePi@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   1080 <QuadraticEquation@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   10d0 <Logarithm@plt>
jmp    12f4 <main+0x144>
lea    0xf19(%rip),%rdi
call   1040 <printf@plt>
jmp    12f4 <main+0x144>
lea    0xf1b(%rip),%rdi
call   1040 <printf@plt>
jmp    11c6 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xfa5(%rip),%r14
lea    0xfd7(%rip),%r15
lea    0x100d(%rip),%r12
lea    0x101d(%rip),%r13
lea    0x4(%rsp),%rbx
lea    0xe1d(%rip),%rbp
jmp    1200 <main+0x50>
lea    0x100b(%rip),%rdi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     128d <main+0xdd>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <checkOddOrEven@plt>
jmp    1200 <main+0x50>
lea    0xf76(%rip),%rdi
call   1040 <printf@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   1030 <checkPrime@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   10c0 <checkDivisbility@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   10b0 <checkGoldenRatio@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   1050 <ComputeFactorial@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   1070 <ComputeFibonacci@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   1060 <ComputePi@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   1080 <QuadraticEquation@plt>
jmp    1200 <main+0x50>
xor    %eax,%eax
call   10d0 <Logarithm@plt>
jmp    1200 <main+0x50>

LLVM IR (-O0):
@.str = [100 x i8] c"\0A ~~~~~~~~~~~~~~~~~~~~~~~~ \0A Welcome to CMaths (Ultimate C Maths App)\0A\0A \00"
@.str.1 = [29 x i8] c" ~~~~~~~~~~~~~~~~~~~~~~~~\00"
@.str.2 = [33 x i8] c"\0A Would you like to do..?\0A\0A\09\00"
@.str.3 = [55 x i8] c"1-check even or odd 2-check prime number or not\0A\09\00"
@.str.4 = [48 x i8] c"3-Check Divisbility 4-Check golden ratio\0A\09\00"
@.str.5 = [54 x i8] c"5-Compute Factorial 6-Compute Fibonacci series\0A\09\00"
@.str.6 = [57 x i8] c"7-Compute Pi 8-Solve a quadratic equation \0A\09\00"
@.str.7 = [61 x i8] c"9-Logarithms Calculator 10-Compute Pascal's Triangle\0A\09\00"
@.str.8 = [23 x i8] c"Choose an option :\0A\0A>>\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [19 x i8] c"Work in progress..\00"
@.str.11 = [8 x i8] c"Error!!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %2, %43
%10 = call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%20 = load i32, i32* %6
switch i32 %20, label %41 [
i32 1, label %21
i32 2, label %23
i32 3, label %25
i32 4, label %27
i32 5, label %29
i32 6, label %31
i32 7, label %33
i32 8, label %35
i32 9, label %37
i32 10, label %39
]
21: ; preds = %9
%22 = call i32 (...) @checkOddOrEven()
br label %43
23: ; preds = %9
%24 = call i32 (...) @checkPrime()
br label %43
25: ; preds = %9
%26 = call i32 (...) @checkDivisbility()
br label %43
27: ; preds = %9
%28 = call i32 (...) @checkGoldenRatio()
br label %43
29: ; preds = %9
%30 = call i32 (...) @ComputeFactorial()
br label %43
31: ; preds = %9
%32 = call i32 (...) @ComputeFibonacci()
br label %43
33: ; preds = %9
%34 = call i32 (...) @ComputePi()
br label %43
35: ; preds = %9
%36 = call i32 (...) @QuadraticEquation()
br label %43
37: ; preds = %9
%38 = call i32 (...) @Logarithm()
br label %43
39: ; preds = %9
%40 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %43
41: ; preds = %9
%42 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %43
43: ; preds = %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21
br label %9
}

LLVM IR (-O2):
@.str = [100 x i8] c"\0A ~~~~~~~~~~~~~~~~~~~~~~~~ \0A Welcome to CMaths (Ultimate C Maths App)\0A\0A \00"
@.str.1 = [29 x i8] c" ~~~~~~~~~~~~~~~~~~~~~~~~\00"
@.str.2 = [33 x i8] c"\0A Would you like to do..?\0A\0A\09\00"
@.str.3 = [55 x i8] c"1-check even or odd 2-check prime number or not\0A\09\00"
@.str.4 = [48 x i8] c"3-Check Divisbility 4-Check golden ratio\0A\09\00"
@.str.5 = [54 x i8] c"5-Compute Factorial 6-Compute Fibonacci series\0A\09\00"
@.str.6 = [57 x i8] c"7-Compute Pi 8-Solve a quadratic equation \0A\09\00"
@.str.7 = [61 x i8] c"9-Logarithms Calculator 10-Compute Pascal's Triangle\0A\09\00"
@.str.8 = [23 x i8] c"Choose an option :\0A\0A>>\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [19 x i8] c"Work in progress..\00"
@.str.11 = [8 x i8] c"Error!!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %39, %2
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
switch i32 %16, label %37 [
i32 1, label %17
i32 2, label %19
i32 3, label %21
i32 4, label %23
i32 5, label %25
i32 6, label %27
i32 7, label %29
i32 8, label %31
i32 9, label %33
i32 10, label %35
]
17: ; preds = %5
%18 = call i32 (...) @checkOddOrEven()
br label %39
19: ; preds = %5
%20 = call i32 (...) @checkPrime()
br label %39
21: ; preds = %5
%22 = call i32 (...) @checkDivisbility()
br label %39
23: ; preds = %5
%24 = call i32 (...) @checkGoldenRatio()
br label %39
25: ; preds = %5
%26 = call i32 (...) @ComputeFactorial()
br label %39
27: ; preds = %5
%28 = call i32 (...) @ComputeFibonacci()
br label %39
29: ; preds = %5
%30 = call i32 (...) @ComputePi()
br label %39
31: ; preds = %5
%32 = call i32 (...) @QuadraticEquation()
br label %39
33: ; preds = %5
%34 = call i32 (...) @Logarithm()
br label %39
35: ; preds = %5
%36 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %39
37: ; preds = %5
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %39
39: ; preds = %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17
br label %5
}