#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  float x = 0, y = 0, result = 0;
  int op = 0;
  do {
    printf("\n\t1 - sum\n\t2 - sub\n\t3 - mult\n\t4 - div\n");
    printf("\n Write the number corresponding to its operation: ");
    scanf("%i", &op);
    printf("\n Set The Fist Number ");
    scanf("%f", &x);
    printf("\n Set The Second Number ");
    scanf("%f", &y);
    switch (op) {
    case 1:
      result = x + y;
      break;
    case 2:
      result = x - y;
      break;
    case 3:
      result = x * y;
      break;
    case 4:
      result = x / y;
      break;
    default:
      printf("\n Set a valid char\n");
      break;
    }
    if (op == 4 && y == 0) {
      printf("\n\t Is not possible a division for zero");
      printf("\n Set the button 1 for try again...");
      scanf("%i", &op);
    }
    printf("\n\t The result is: %0.2f", result);
    printf("\n Set the button 1 for try again...");
    scanf("%i", &op);
  } while (op == 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebb(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xef3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x21(%rbp),%al
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xeeb(%rip),%rdi
mov    %rdi,-0x30(%rbp)
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x21(%rbp),%al
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     123f <main+0x11f>
mov    -0x20(%rbp),%rax
lea    0xe1a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    124d <main+0x12d>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    124d <main+0x12d>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    124d <main+0x12d>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    124d <main+0x12d>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0x14(%rbp)
jne    129c <main+0x17c>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    129c <main+0x17c>
jp     129c <main+0x17c>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdda(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda3(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
je     114e <main+0x2e>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xeeb(%rip),%r12
lea    0x14(%rsp),%rbx
lea    0xef9(%rip),%rbp
lea    0xf35(%rip),%r14
lea    0xf52(%rip),%r15
lea    0xe86(%rip),%r13
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
jmp    11cc <main+0x9c>
nopl   0x0(%rax)
movss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,0x14(%rsp)
jne    1321 <main+0x1f1>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1260 <main+0x130>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
movss  0x10(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
jmp    1196 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    0x14(%rsp),%eax
movss  0x8(%rsp),%xmm0
cmp    $0x4,%eax
je     12e4 <main+0x1b4>
jmp    1190 <main+0x60>
movss  0x10(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
jmp    1196 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  0x10(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
jmp    1196 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  0x10(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
mov    $0x4,%eax
cmp    $0x4,%eax
jne    1190 <main+0x60>
ucomiss 0xd15(%rip),%xmm0
jne    1190 <main+0x60>
jp     1190 <main+0x60>
lea    0xd80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0A\091 - sum\0A\092 - sub\0A\093 - mult\0A\094 - div\0A\00"
@.str.1 = [52 x i8] c"\0A Write the number corresponding to its operation: \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [23 x i8] c"\0A Set The Fist Number \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [25 x i8] c"\0A Set The Second Number \00"
@.str.6 = [20 x i8] c"\0A Set a valid char\0A\00"
@.str.7 = [39 x i8] c"\0A\09 Is not possible a division for zero\00"
@.str.8 = [36 x i8] c"\0A Set the button 1 for try again...\00"
@.str.9 = [24 x i8] c"\0A\09 The result is: %0.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store i32 0, i32* %5
br label %6
6: ; preds = %49, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%14 = load i32, i32* %5
switch i32 %14, label %31 [
i32 1, label %15
i32 2, label %19
i32 3, label %23
i32 4, label %27
]
15: ; preds = %6
%16 = load float, float* %2
%17 = load float, float* %3
%18 = fadd float %16, %17
store float %18, float* %4
br label %33
19: ; preds = %6
%20 = load float, float* %2
%21 = load float, float* %3
%22 = fsub float %20, %21
store float %22, float* %4
br label %33
23: ; preds = %6
%24 = load float, float* %2
%25 = load float, float* %3
%26 = fmul float %24, %25
store float %26, float* %4
br label %33
27: ; preds = %6
%28 = load float, float* %2
%29 = load float, float* %3
%30 = fdiv float %28, %29
store float %30, float* %4
br label %33
31: ; preds = %6
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %33
33: ; preds = %31, %27, %23, %19, %15
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load float, float* %3
%38 = fcmp oeq float %37, 0.000000e+00
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
br label %43
43: ; preds = %39, %36, %33
%44 = load float, float* %4
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), double %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
br label %49
49: ; preds = %43
%50 = load i32, i32* %5
%51 = icmp eq i32 %50, 1
br i1 %51, label %6, label %52
52: ; preds = %49
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str.1 = [52 x i8] c"\0A Write the number corresponding to its operation: \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [23 x i8] c"\0A Set The Fist Number \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [25 x i8] c"\0A Set The Second Number \00"
@.str.7 = [39 x i8] c"\0A\09 Is not possible a division for zero\00"
@.str.8 = [36 x i8] c"\0A Set the button 1 for try again...\00"
@.str.9 = [24 x i8] c"\0A\09 The result is: %0.2f\00"
@str = [38 x i8] c"\0A\091 - sum\0A\092 - sub\0A\093 - mult\0A\094 - div\00"
@str.10 = [19 x i8] c"\0A Set a valid char\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%5 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %7
7: ; preds = %48, %0
%8 = phi float [ 0.000000e+00, %0 ], [ %49, %48 ]
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %1)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%16 = load i32, i32* %3
switch i32 %16, label %33 [
i32 1, label %17
i32 2, label %21
i32 3, label %25
i32 4, label %29
]
17: ; preds = %7
%18 = load float, float* %1
%19 = load float, float* %2
%20 = fadd float %18, %19
br label %48
21: ; preds = %7
%22 = load float, float* %1
%23 = load float, float* %2
%24 = fsub float %22, %23
br label %48
25: ; preds = %7
%26 = load float, float* %1
%27 = load float, float* %2
%28 = fmul float %26, %27
br label %48
29: ; preds = %7
%30 = load float, float* %1
%31 = load float, float* %2
%32 = fdiv float %30, %31
br label %37
33: ; preds = %7
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%35 = load i32, i32* %3
%36 = load float, float* %2
br label %37
37: ; preds = %33, %29
%38 = phi float [ %36, %33 ], [ %31, %29 ]
%39 = phi i32 [ %35, %33 ], [ 4, %29 ]
%40 = phi float [ %8, %33 ], [ %32, %29 ]
%41 = icmp eq i32 %39, 4
%42 = fcmp oeq float %38, 0.000000e+00
%43 = select i1 %41, i1 %42, i1 false
br i1 %43, label %44, label %48
44: ; preds = %37
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %48
48: ; preds = %17, %21, %25, %44, %37
%49 = phi float [ %40, %44 ], [ %40, %37 ], [ %20, %17 ], [ %24, %21 ], [ %28, %25 ]
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), double %50)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%53 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 1
br i1 %55, label %7, label %56
56: ; preds = %48
ret i32 0
}