#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 *, double *, ...);
int main(int argc, char const *argv[]) {
  double a, b;
  char c = '#';
  scanf("%lf", &a);
  do {
    scanf("%lf %c", &b, &c);
    if (c == '+') {
      a += b;
      printf("%.3lf\n", a);
    } else if (c == '-') {
      a -= b;
      printf("%.3lf\n", a);
    } else if (c == '*') {
      a *= b;
      printf("%.3lf\n", a);
    } else if (c == '/') {
      if (b == 0) {
        printf("operacao nao pode ser realizada");
      } else {
        a /= b;
        printf("%.3lf\n", a);
      }
    }
  } while (c != '&');
  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)
movb   $0x23,-0x21(%rbp)
lea    0xebf(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x21(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x2b,%eax
jne    1196 <main+0x76>
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1274 <main+0x154>
movsbl -0x21(%rbp),%eax
cmp    $0x2d,%eax
jne    11ce <main+0xae>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe49(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126f <main+0x14f>
movsbl -0x21(%rbp),%eax
cmp    $0x2a,%eax
jne    1202 <main+0xe2>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe15(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126a <main+0x14a>
movsbl -0x21(%rbp),%eax
cmp    $0x2f,%eax
jne    1265 <main+0x145>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    123a <main+0x11a>
jp     123a <main+0x11a>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1260 <main+0x140>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xdb2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1265 <main+0x145>
jmp    126a <main+0x14a>
jmp    126f <main+0x14f>
jmp    1274 <main+0x154>
jmp    1279 <main+0x159>
movsbl -0x21(%rbp),%eax
cmp    $0x26,%eax
jne    114c <main+0x2c>
xor    %eax,%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
movb   $0x23,0x7(%rsp)
lea    0xee6(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xed7(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x7(%rsp),%rbx
lea    0xeaa(%rip),%rbp
lea    0xec6(%rip),%r12
lea    0xec6(%rip),%r13
jmp    1195 <main+0x75>
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x26,%al
je     120d <main+0xed>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movzbl 0x7(%rsp),%eax
lea    -0x2a(%rax),%ecx
cmp    $0x5,%cl
ja     1191 <main+0x71>
movzbl %cl,%ecx
movslq 0x0(%rbp,%rcx,4),%rcx
add    %rbp,%rcx
jmp    *%rcx
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
jmp    117c <main+0x5c>
nopl   (%rax)
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
jmp    117c <main+0x5c>
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm1
ucomisd 0xe12(%rip),%xmm1
jne    11fe <main+0xde>
jp     11fe <main+0xde>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    118c <main+0x6c>
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
jmp    117c <main+0x5c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%lf %c\00"
@.str.2 = [7 x i8] c"%.3lf\0A\00"
@.str.3 = [32 x i8] c"operacao nao pode ser realizada\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 35, i8* %8
%9 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %6)
br label %10
10: ; preds = %61, %2
%11 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %7, i8* %8)
%12 = load i8, i8* %8
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 43
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load double, double* %7
%17 = load double, double* %6
%18 = fadd double %17, %16
store double %18, double* %6
%19 = load double, double* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %19)
br label %60
21: ; preds = %10
%22 = load i8, i8* %8
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 45
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = load double, double* %7
%27 = load double, double* %6
%28 = fsub double %27, %26
store double %28, double* %6
%29 = load double, double* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %29)
br label %59
31: ; preds = %21
%32 = load i8, i8* %8
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 42
br i1 %34, label %35, label %41
35: ; preds = %31
%36 = load double, double* %7
%37 = load double, double* %6
%38 = fmul double %37, %36
store double %38, double* %6
%39 = load double, double* %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %39)
br label %58
41: ; preds = %31
%42 = load i8, i8* %8
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 47
br i1 %44, label %45, label %57
45: ; preds = %41
%46 = load double, double* %7
%47 = fcmp oeq double %46, 0.000000e+00
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %56
50: ; preds = %45
%51 = load double, double* %7
%52 = load double, double* %6
%53 = fdiv double %52, %51
store double %53, double* %6
%54 = load double, double* %6
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %54)
br label %56
56: ; preds = %50, %48
br label %57
57: ; preds = %56, %41
br label %58
58: ; preds = %57, %35
br label %59
59: ; preds = %58, %25
br label %60
60: ; preds = %59, %15
br label %61
61: ; preds = %60
%62 = load i8, i8* %8
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 38
br i1 %64, label %10, label %65
65: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%lf %c\00"
@.str.2 = [7 x i8] c"%.3lf\0A\00"
@.str.3 = [32 x i8] c"operacao nao pode ser realizada\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i8
%6 = bitcast double* %3 to i8*
%7 = bitcast double* %4 to i8*
store i8 35, i8* %5
%8 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
br label %9
9: ; preds = %38, %2
%10 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %4, i8* %5)
%11 = load i8, i8* %5
switch i8 %11, label %38 [
i8 43, label %12
i8 45, label %17
i8 42, label %22
i8 47, label %27
]
12: ; preds = %9
%13 = load double, double* %4
%14 = load double, double* %3
%15 = fadd double %13, %14
store double %15, double* %3
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %15)
br label %36
17: ; preds = %9
%18 = load double, double* %4
%19 = load double, double* %3
%20 = fsub double %19, %18
store double %20, double* %3
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %36
22: ; preds = %9
%23 = load double, double* %4
%24 = load double, double* %3
%25 = fmul double %23, %24
store double %25, double* %3
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %25)
br label %36
27: ; preds = %9
%28 = load double, double* %4
%29 = fcmp oeq double %28, 0.000000e+00
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %36
32: ; preds = %27
%33 = load double, double* %3
%34 = fdiv double %33, %28
store double %34, double* %3
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %36
36: ; preds = %17, %32, %30, %22, %12
%37 = load i8, i8* %5
br label %38
38: ; preds = %36, %9
%39 = phi i8 [ %37, %36 ], [ %11, %9 ]
%40 = icmp eq i8 %39, 38
br i1 %40, label %41, label %9
41: ; preds = %38
ret i32 0
}