int main() {
  int numberPrimary;
  int numberSecondary;
  int option;
  float result;
  printf("\n---------------------------------\n");
  printf("Please, choose an option of operation: \n");
  printf("* 1 = Addition \n");
  printf("* 2 = Subtraction \n");
  printf("* 3 = Multiplication \n");
  printf("* 4 = Division \n");
  printf("* 5 = MOD \n");
  printf("* 6 = Exit \n");
  scanf("%d", &option);
  if (option == 6) {
    printf("-----BYE----- \n");
    exit(0);
  }
  printf("Please, insert the number primary: ");
  scanf("%d", &numberPrimary);
  printf("\nPlease, insert the number secondary: ");
  scanf("%d", &numberSecondary);
  switch (option) {
  case 1:
    result = ((numberPrimary) + (numberSecondary));
    printf("Result addition is: %.2f \n", result);
    break;
  case 2:
    result = ((numberPrimary) - (numberSecondary));
    printf("Result subtraction is: %.2f \n", result);
    break;
  case 3:
    result = ((numberPrimary) * (numberSecondary));
    printf("Result multiplication is: %.2f \n", result);
    break;
  case 4:
    result = ((numberPrimary) / (numberSecondary));
    printf("Result division is: %.2f \n", result);
    break;
  case 5:
    result = (numberPrimary % numberSecondary);
    printf("Result the mod is: %.2f \n", result);
    break;
  }
  printf("\n---------------------------------\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x6,-0x10(%rbp)
jne    11e0 <main+0xb0>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xef3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xecc(%rip),%rdi
mov    %rdi,-0x30(%rbp)
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x21(%rbp),%al
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4,%eax
ja     1325 <main+0x1f5>
mov    -0x20(%rbp),%rax
lea    0xdb9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1325 <main+0x1f5>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1325 <main+0x1f5>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1325 <main+0x1f5>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1325 <main+0x1f5>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %edx,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xce8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x102d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf99(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xfc0(%rip),%rdi
call   1030 <puts@plt>
lea    0xfca(%rip),%rdi
call   1030 <puts@plt>
lea    0xfce(%rip),%rdi
call   1030 <puts@plt>
lea    0xfcd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe68(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x6,0xc(%rsp)
je     129b <main+0x15b>
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3c(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1287 <main+0x147>
lea    0xde9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x4(%rsp),%edx
add    0x8(%rsp),%edx
lea    0xe33(%rip),%rdi
jmp    1278 <main+0x138>
mov    0x4(%rsp),%edx
imul   0x8(%rsp),%edx
lea    0xe5a(%rip),%rdi
jmp    1278 <main+0x138>
mov    0x8(%rsp),%eax
cltd
idivl  0x4(%rsp)
lea    0xe84(%rip),%rdi
jmp    1278 <main+0x138>
mov    0x8(%rsp),%edx
sub    0x4(%rsp),%edx
lea    0xe19(%rip),%rdi
jmp    1278 <main+0x138>
mov    0x8(%rsp),%eax
cltd
idivl  0x4(%rsp)
mov    %eax,%edx
lea    0xe44(%rip),%rdi
cvtsi2ss %edx,%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"\0A---------------------------------\0A\00"
@.str.1 = [41 x i8] c"Please, choose an option of operation: \0A\00"
@.str.2 = [17 x i8] c"* 1 = Addition \0A\00"
@.str.3 = [20 x i8] c"* 2 = Subtraction \0A\00"
@.str.4 = [23 x i8] c"* 3 = Multiplication \0A\00"
@.str.5 = [17 x i8] c"* 4 = Division \0A\00"
@.str.6 = [12 x i8] c"* 5 = MOD \0A\00"
@.str.7 = [13 x i8] c"* 6 = Exit \0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [16 x i8] c"-----BYE----- \0A\00"
@.str.10 = [36 x i8] c"Please, insert the number primary: \00"
@.str.11 = [39 x i8] c"\0APlease, insert the number secondary: \00"
@.str.12 = [27 x i8] c"Result addition is: %.2f \0A\00"
@.str.13 = [30 x i8] c"Result subtraction is: %.2f \0A\00"
@.str.14 = [33 x i8] c"Result multiplication is: %.2f \0A\00"
@.str.15 = [27 x i8] c"Result division is: %.2f \0A\00"
@.str.16 = [26 x i8] c"Result the mod is: %.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 6
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
unreachable
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%24 = load i32, i32* %4
switch i32 %24, label %65 [
i32 1, label %25
i32 2, label %33
i32 3, label %41
i32 4, label %49
i32 5, label %57
]
25: ; preds = %19
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = add nsw i32 %26, %27
%29 = sitofp i32 %28 to float
store float %29, float* %5
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), double %31)
br label %65
33: ; preds = %19
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = sub nsw i32 %34, %35
%37 = sitofp i32 %36 to float
store float %37, float* %5
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0), double %39)
br label %65
41: ; preds = %19
%42 = load i32, i32* %2
%43 = load i32, i32* %3
%44 = mul nsw i32 %42, %43
%45 = sitofp i32 %44 to float
store float %45, float* %5
%46 = load float, float* %5
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0), double %47)
br label %65
49: ; preds = %19
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = sdiv i32 %50, %51
%53 = sitofp i32 %52 to float
store float %53, float* %5
%54 = load float, float* %5
%55 = fpext float %54 to double
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), double %55)
br label %65
57: ; preds = %19
%58 = load i32, i32* %2
%59 = load i32, i32* %3
%60 = srem i32 %58, %59
%61 = sitofp i32 %60 to float
store float %61, float* %5
%62 = load float, float* %5
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), double %63)
br label %65
65: ; preds = %19, %57, %49, %41, %33, %25
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@.str.8 = [3 x i8] c"%d\00"
@.str.10 = [36 x i8] c"Please, insert the number primary: \00"
@.str.11 = [39 x i8] c"\0APlease, insert the number secondary: \00"
@.str.12 = [27 x i8] c"Result addition is: %.2f \0A\00"
@.str.13 = [30 x i8] c"Result subtraction is: %.2f \0A\00"
@.str.14 = [33 x i8] c"Result multiplication is: %.2f \0A\00"
@.str.15 = [27 x i8] c"Result division is: %.2f \0A\00"
@.str.16 = [26 x i8] c"Result the mod is: %.2f \0A\00"
@str.17 = [40 x i8] c"Please, choose an option of operation: \00"
@str.18 = [16 x i8] c"* 1 = Addition \00"
@str.19 = [19 x i8] c"* 2 = Subtraction \00"
@str.20 = [22 x i8] c"* 3 = Multiplication \00"
@str.21 = [16 x i8] c"* 4 = Division \00"
@str.22 = [11 x i8] c"* 5 = MOD \00"
@str.23 = [12 x i8] c"* 6 = Exit \00"
@str.24 = [35 x i8] c"\0A---------------------------------\00"
@str.25 = [15 x i8] c"-----BYE----- \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.24, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.17, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.18, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.20, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.21, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.22, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.23, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 6
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0))
unreachable
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%25 = load i32, i32* %3
switch i32 %25, label %52 [
i32 1, label %26
i32 2, label %30
i32 3, label %34
i32 4, label %38
i32 5, label %42
]
26: ; preds = %20
%27 = load i32, i32* %1
%28 = load i32, i32* %2
%29 = add nsw i32 %28, %27
br label %46
30: ; preds = %20
%31 = load i32, i32* %1
%32 = load i32, i32* %2
%33 = sub nsw i32 %31, %32
br label %46
34: ; preds = %20
%35 = load i32, i32* %1
%36 = load i32, i32* %2
%37 = mul nsw i32 %36, %35
br label %46
38: ; preds = %20
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = sdiv i32 %39, %40
br label %46
42: ; preds = %20
%43 = load i32, i32* %1
%44 = load i32, i32* %2
%45 = srem i32 %43, %44
br label %46
46: ; preds = %26, %30, %34, %38, %42
%47 = phi i32 [ %45, %42 ], [ %41, %38 ], [ %37, %34 ], [ %33, %30 ], [ %29, %26 ]
%48 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), %42 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), %38 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0), %34 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0), %30 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), %26 ]
%49 = sitofp i32 %47 to float
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %48, double %50)
br label %52
52: ; preds = %46, %20
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.24, i64 0, i64 0))
ret i32 0
}