#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*/ addition();
int calculator_operations();
int /*<<< orphan*/ division();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ factorial();
char getch();
int /*<<< orphan*/ modulus();
int /*<<< orphan*/ multiplication();
int /*<<< orphan*/ power();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ subtraction();
int /*<<< orphan*/ system(char *);
int main() {
  int X = 1;
  char Calc_oprn;
  int pid = calculator_operations();
  while (X) {
    printf("\n");
    printf("%s : ", "Enter the calculator Operation you want to do:");
    Calc_oprn = getch();
    switch (Calc_oprn) {
    case '+':
      addition();
      break;
    case '-':
      subtraction();
      break;
    case '*':
      multiplication();
      break;
    case '/':
      division();
      break;
    case '?':
      modulus();
      break;
    case '!':
      factorial();
      break;
    case '^':
      power();
      break;
    case 'H':
    case 'h':
      calculator_operations();
      break;
    case 'Q':
    case 'q':
      exit(0);
      break;
    case 'c':
    case 'C':
      system("cls");
      calculator_operations();
      break;
    default:
      system("cls");
      printf("\n**********You have entered unavailable option");
      printf("***********\n");
      printf("\n*****Please Enter any one of below available ");
      printf("options****\n");
      calculator_operations();
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1060 <calculator_operations@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1315 <main+0x155>
lea    0xfc6(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1090 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf3f(%rip),%rdi
lea    0xf3e(%rip),%rsi
call   1090 <printf@plt>
mov    -0x19(%rbp),%al
call   10d0 <getch@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffdf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x50,%eax
ja     12c5 <main+0x105>
mov    -0x18(%rbp),%rax
lea    0xdc3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <addition@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   10c0 <subtraction@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   1080 <multiplication@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   10b0 <division@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   10a0 <modulus@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   1050 <factorial@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   1040 <power@plt>
jmp    1310 <main+0x150>
mov    $0x0,%al
call   1060 <calculator_operations@plt>
jmp    1310 <main+0x150>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xec5(%rip),%rdi
call   1070 <system@plt>
mov    $0x0,%al
call   1060 <calculator_operations@plt>
jmp    1310 <main+0x150>
lea    0xead(%rip),%rdi
call   1070 <system@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x0,%al
call   1060 <calculator_operations@plt>
jmp    11e0 <main+0x20>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1080 <calculator_operations@plt>
lea    0xf4b(%rip),%r14
lea    0xf4a(%rip),%rbx
lea    0xf72(%rip),%r15
lea    0xf9e(%rip),%rbp
lea    0xfd2(%rip),%r12
lea    0xde4(%rip),%r13
jmp    1267 <main+0x87>
mov    %r15,%rdi
call   1090 <system@plt>
lea    0xf50(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0xfa0(%rip),%rdi
call   1060 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %r12,%rdi
call   1060 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <calculator_operations@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
xor    %eax,%eax
call   10f0 <getch@plt>
movsbl %al,%eax
add    $0xffffffdf,%eax
cmp    $0x50,%eax
ja     121e <main+0x3e>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
mov    %r15,%rdi
call   1090 <system@plt>
jmp    1260 <main+0x80>
xor    %eax,%eax
call   1070 <factorial@plt>
jmp    1267 <main+0x87>
xor    %eax,%eax
call   10a0 <multiplication@plt>
jmp    1267 <main+0x87>
xor    %eax,%eax
call   1040 <addition@plt>
jmp    1267 <main+0x87>
xor    %eax,%eax
call   10e0 <subtraction@plt>
jmp    1267 <main+0x87>
xor    %eax,%eax
call   10d0 <division@plt>
jmp    1267 <main+0x87>
xor    %eax,%eax
call   10c0 <modulus@plt>
jmp    1267 <main+0x87>
xor    %eax,%eax
call   1050 <power@plt>
jmp    1267 <main+0x87>
xor    %edi,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [6 x i8] c"%s : \00"
@.str.2 = [47 x i8] c"Enter the calculator Operation you want to do:\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [47 x i8] c"\0A**********You have entered unavailable option\00"
@.str.5 = [13 x i8] c"***********\0A\00"
@.str.6 = [47 x i8] c"\0A*****Please Enter any one of below available \00"
@.str.7 = [13 x i8] c"options****\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%5 = call i32 (...) @calculator_operations()
store i32 %5, i32* %4
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %44
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%12 = call signext i8 (...) @getch()
store i8 %12, i8* %3
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
switch i32 %14, label %36 [
i32 43, label %15
i32 45, label %17
i32 42, label %19
i32 47, label %21
i32 63, label %23
i32 33, label %25
i32 94, label %27
i32 72, label %29
i32 104, label %29
i32 81, label %31
i32 113, label %31
i32 99, label %33
i32 67, label %33
]
15: ; preds = %9
%16 = call i32 (...) @addition()
br label %43
17: ; preds = %9
%18 = call i32 (...) @subtraction()
br label %43
19: ; preds = %9
%20 = call i32 (...) @multiplication()
br label %43
21: ; preds = %9
%22 = call i32 (...) @division()
br label %43
23: ; preds = %9
%24 = call i32 (...) @modulus()
br label %43
25: ; preds = %9
%26 = call i32 (...) @factorial()
br label %43
27: ; preds = %9
%28 = call i32 (...) @power()
br label %43
29: ; preds = %9, %9
%30 = call i32 (...) @calculator_operations()
br label %43
31: ; preds = %9, %9
%32 = call i32 @exit(i32 0)
unreachable
33: ; preds = %9, %9
%34 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 (...) @calculator_operations()
br label %43
36: ; preds = %9
%37 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%42 = call i32 (...) @calculator_operations()
br label %43
43: ; preds = %36, %33, %29, %27, %25, %23, %21, %19, %17, %15
br label %6
44: ; preds = %6
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%s : \00"
@.str.2 = [47 x i8] c"Enter the calculator Operation you want to do:\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [47 x i8] c"\0A**********You have entered unavailable option\00"
@.str.6 = [47 x i8] c"\0A*****Please Enter any one of below available \00"
@str = [12 x i8] c"***********\00"
@str.8 = [12 x i8] c"options****\00"
define i32 @main() {
%1 = tail call i32 (...) @calculator_operations()
br label %2
2: ; preds = %35, %0
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call signext i8 (...) @getch()
%6 = sext i8 %5 to i32
switch i32 %6, label %28 [
i32 43, label %7
i32 45, label %9
i32 42, label %11
i32 47, label %13
i32 63, label %15
i32 33, label %17
i32 94, label %19
i32 72, label %21
i32 104, label %21
i32 81, label %23
i32 113, label %23
i32 99, label %25
i32 67, label %25
]
7: ; preds = %2
%8 = tail call i32 (...) @addition()
br label %35
9: ; preds = %2
%10 = tail call i32 (...) @subtraction()
br label %35
11: ; preds = %2
%12 = tail call i32 (...) @multiplication()
br label %35
13: ; preds = %2
%14 = tail call i32 (...) @division()
br label %35
15: ; preds = %2
%16 = tail call i32 (...) @modulus()
br label %35
17: ; preds = %2
%18 = tail call i32 (...) @factorial()
br label %35
19: ; preds = %2
%20 = tail call i32 (...) @power()
br label %35
21: ; preds = %2, %2
%22 = tail call i32 (...) @calculator_operations()
br label %35
23: ; preds = %2, %2
%24 = tail call i32 @exit(i32 0)
unreachable
25: ; preds = %2, %2
%26 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = tail call i32 (...) @calculator_operations()
br label %35
28: ; preds = %2
%29 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0))
%34 = tail call i32 (...) @calculator_operations()
br label %35
35: ; preds = %28, %25, %21, %19, %17, %15, %13, %11, %9, %7
br label %2
}