#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*/ Div();
int /*<<< orphan*/ add();
int /*<<< orphan*/ arctg();
int /*<<< orphan*/ factorial();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ mod();
int /*<<< orphan*/ modul2();
int /*<<< orphan*/ multiplication();
int /*<<< orphan*/ my_cos();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sinus();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ sub_func();
int /*<<< orphan*/ sync();
int /*<<< orphan*/ tang();
int main() {
  int action = 0;
  char exitFlag = 0;
  while (exitFlag == 0) {
    printf("1) Add\n");
    printf("2) Sub\n");
    printf("3) Mul\n");
    printf("4) Div\n");
    printf("5) Mod\n");
    printf("6) AddMod2\n");
    printf("7) Sin\n");
    printf("8) Cos\n");
    printf("9) Tan\n");
    printf("10) ArcTan\n");
    printf("11) Factorial\n");
    printf("12) Exit\n");
    printf("Action: ");
    scanf("%d", &action);
    getchar();
    fflush(stdin);
    sync();
    switch (action) {
    case (1):
      add();
      break;
    case (2):
      sub_func();
      break;
    case (3):
      multiplication();
      break;
    case (4):
      Div();
      break;
    case (5):
      mod();
      break;
    case (6):
      modul2();
      break;
    case (7):
      sinus();
      break;
    case (8):
      my_cos();
      break;
    case (9):
      tang();
      break;
    case (10):
      arctg();
      break;
    case (11):
      factorial();
      break;
    case (12):
      exitFlag = 1;
      break;
    default:
      printf("Wrong index\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    13ba <main+0x1ba>
lea    0xe02(%rip),%rdi
call   1090 <printf@plt>
lea    0xdfe(%rip),%rdi
call   1090 <printf@plt>
lea    0xdfa(%rip),%rdi
call   1090 <printf@plt>
lea    0xdf6(%rip),%rdi
call   1090 <printf@plt>
lea    0xdf2(%rip),%rdi
call   1090 <printf@plt>
lea    0xdee(%rip),%rdi
call   1090 <printf@plt>
lea    0xdee(%rip),%rdi
call   1090 <printf@plt>
lea    0xdea(%rip),%rdi
call   1090 <printf@plt>
lea    0xde6(%rip),%rdi
call   1090 <printf@plt>
lea    0xde2(%rip),%rdi
call   1090 <printf@plt>
lea    0xde2(%rip),%rdi
call   1090 <printf@plt>
lea    0xde5(%rip),%rdi
call   1090 <printf@plt>
lea    0xde3(%rip),%rdi
call   1090 <printf@plt>
lea    0xde0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10e0 <scanf@plt>
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   10a0 <getchar@plt>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    -0x19(%rbp),%al
call   10b0 <sync@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xb,%eax
ja     13a9 <main+0x1a9>
mov    -0x18(%rbp),%rax
lea    0xced(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <add@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   10f0 <sub_func@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1080 <multiplication@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1070 <Div@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1030 <mod@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1060 <modul2@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1120 <sinus@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1110 <my_cos@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   10d0 <tang@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1100 <arctg@plt>
jmp    13b5 <main+0x1b5>
mov    $0x0,%al
call   1050 <factorial@plt>
jmp    13b5 <main+0x1b5>
movb   $0x1,-0x9(%rbp)
jmp    13b5 <main+0x1b5>
lea    0xcfd(%rip),%rdi
call   1090 <printf@plt>
jmp    121a <main+0x1a>
xor    %eax,%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
movl   $0x0,0x4(%rsp)
lea    0xe6e(%rip),%rbp
lea    0xdff(%rip),%r14
lea    0xe01(%rip),%r15
lea    0x4(%rsp),%r12
mov    0x2da4(%rip),%r13
lea    0xdb5(%rip),%rbx
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1060 <factorial@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xdd5(%rip),%rdi
call   1050 <puts@plt>
lea    0xdd0(%rip),%rdi
call   1050 <puts@plt>
lea    0xdcb(%rip),%rdi
call   1050 <puts@plt>
lea    0xdc6(%rip),%rdi
call   1050 <puts@plt>
lea    0xdc1(%rip),%rdi
call   1050 <puts@plt>
lea    0xdbc(%rip),%rdi
call   1050 <puts@plt>
lea    0xdbb(%rip),%rdi
call   1050 <puts@plt>
lea    0xdb6(%rip),%rdi
call   1050 <puts@plt>
lea    0xdb1(%rip),%rdi
call   1050 <puts@plt>
lea    0xdac(%rip),%rdi
call   1050 <puts@plt>
lea    0xdab(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   10a0 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10f0 <scanf@plt>
xor    %eax,%eax
call   10b0 <getchar@plt>
mov    0x0(%r13),%edi
call   10d0 <fflush@plt>
xor    %eax,%eax
call   10c0 <sync@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0xb,%eax
ja     1337 <main+0x127>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <add@plt>
jmp    1260 <main+0x50>
lea    0xd63(%rip),%rdi
call   1050 <puts@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1100 <sub_func@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1090 <multiplication@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1080 <Div@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1030 <mod@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1070 <modul2@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1130 <sinus@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1120 <my_cos@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   10e0 <tang@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
call   1110 <arctg@plt>
jmp    1260 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"1) Add\0A\00"
@.str.1 = [8 x i8] c"2) Sub\0A\00"
@.str.2 = [8 x i8] c"3) Mul\0A\00"
@.str.3 = [8 x i8] c"4) Div\0A\00"
@.str.4 = [8 x i8] c"5) Mod\0A\00"
@.str.5 = [12 x i8] c"6) AddMod2\0A\00"
@.str.6 = [8 x i8] c"7) Sin\0A\00"
@.str.7 = [8 x i8] c"8) Cos\0A\00"
@.str.8 = [8 x i8] c"9) Tan\0A\00"
@.str.9 = [12 x i8] c"10) ArcTan\0A\00"
@.str.10 = [15 x i8] c"11) Factorial\0A\00"
@.str.11 = [10 x i8] c"12) Exit\0A\00"
@.str.12 = [9 x i8] c"Action: \00"
@.str.13 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.14 = [13 x i8] c"Wrong index\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i8 0, i8* %3
br label %4
4: ; preds = %53, %0
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %54
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %2)
%23 = call i32 (...) @getchar()
%24 = load i32, i32* @stdin
%25 = call i32 @fflush(i32 %24)
%26 = call i32 (...) @sync()
%27 = load i32, i32* %2
switch i32 %27, label %51 [
i32 1, label %28
i32 2, label %30
i32 3, label %32
i32 4, label %34
i32 5, label %36
i32 6, label %38
i32 7, label %40
i32 8, label %42
i32 9, label %44
i32 10, label %46
i32 11, label %48
i32 12, label %50
]
28: ; preds = %8
%29 = call i32 (...) @add()
br label %53
30: ; preds = %8
%31 = call i32 (...) @sub_func()
br label %53
32: ; preds = %8
%33 = call i32 (...) @multiplication()
br label %53
34: ; preds = %8
%35 = call i32 (...) @Div()
br label %53
36: ; preds = %8
%37 = call i32 (...) @mod()
br label %53
38: ; preds = %8
%39 = call i32 (...) @modul2()
br label %53
40: ; preds = %8
%41 = call i32 (...) @sinus()
br label %53
42: ; preds = %8
%43 = call i32 (...) @my_cos()
br label %53
44: ; preds = %8
%45 = call i32 (...) @tang()
br label %53
46: ; preds = %8
%47 = call i32 (...) @arctg()
br label %53
48: ; preds = %8
%49 = call i32 (...) @factorial()
br label %53
50: ; preds = %8
store i8 1, i8* %3
br label %53
51: ; preds = %8
%52 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %53
53: ; preds = %51, %50, %48, %46, %44, %42, %40, %38, %36, %34, %32, %30, %28
br label %4
54: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str.12 = [9 x i8] c"Action: \00"
@.str.13 = [3 x i8] c"%d\00"
@stdin = global i32 0
@str = [7 x i8] c"1) Add\00"
@str.15 = [7 x i8] c"2) Sub\00"
@str.16 = [7 x i8] c"3) Mul\00"
@str.17 = [7 x i8] c"4) Div\00"
@str.18 = [7 x i8] c"5) Mod\00"
@str.19 = [11 x i8] c"6) AddMod2\00"
@str.20 = [7 x i8] c"7) Sin\00"
@str.21 = [7 x i8] c"8) Cos\00"
@str.22 = [7 x i8] c"9) Tan\00"
@str.23 = [11 x i8] c"10) ArcTan\00"
@str.24 = [14 x i8] c"11) Factorial\00"
@str.25 = [9 x i8] c"12) Exit\00"
@str.26 = [12 x i8] c"Wrong index\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %47, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.16, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.17, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.18, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.19, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.20, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.21, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.22, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.23, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.24, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.25, i64 0, i64 0))
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %1)
%18 = call i32 (...) @getchar()
%19 = load i32, i32* @stdin
%20 = call i32 @fflush(i32 %19)
%21 = call i32 (...) @sync()
%22 = load i32, i32* %1
switch i32 %22, label %45 [
i32 1, label %23
i32 2, label %25
i32 3, label %27
i32 4, label %29
i32 5, label %31
i32 6, label %33
i32 7, label %35
i32 8, label %37
i32 9, label %39
i32 10, label %41
i32 11, label %43
i32 12, label %48
]
23: ; preds = %3
%24 = call i32 (...) @add()
br label %47
25: ; preds = %3
%26 = call i32 (...) @sub_func()
br label %47
27: ; preds = %3
%28 = call i32 (...) @multiplication()
br label %47
29: ; preds = %3
%30 = call i32 (...) @Div()
br label %47
31: ; preds = %3
%32 = call i32 (...) @mod()
br label %47
33: ; preds = %3
%34 = call i32 (...) @modul2()
br label %47
35: ; preds = %3
%36 = call i32 (...) @sinus()
br label %47
37: ; preds = %3
%38 = call i32 (...) @my_cos()
br label %47
39: ; preds = %3
%40 = call i32 (...) @tang()
br label %47
41: ; preds = %3
%42 = call i32 (...) @arctg()
br label %47
43: ; preds = %3
%44 = call i32 (...) @factorial()
br label %47
45: ; preds = %3
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.26, i64 0, i64 0))
br label %47
47: ; preds = %45, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23
br label %3
48: ; preds = %3
ret i32 0
}