#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 *, float *, char *);
int main(void) {
  float a;
  float remNumber;
  char operator;
  printf("Begin Calculations \n");
  while (operator!= 'E') {
    scanf("%f %c", &a, &operator);
    switch (operator) {
    case 'S':
      remNumber = a;
      printf("%f \n", remNumber);
      break;
    case '/':
      if (a == 0)
        printf("³ýÊý²»ÄÜÎª0");
      else
        remNumber /= a;
      printf("%f \n", remNumber);
      break;
    case '*':
      remNumber *= a;
      printf("%f \n", remNumber);
      break;
    case '-':
      remNumber -= a;
      printf("%f \n", remNumber);
      break;
    case '+':
      remNumber += a;
      printf("%f \n", remNumber);
      break;
    case 'E':
      break;
    default:
      printf("Î´ÖªµÄ²Ù×÷·û!");
      break;
    }
  }
  printf("End of Calculations. \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x45,%eax
je     12a4 <main+0x184>
lea    0xf6c(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xd(%rbp),%rdx
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x29,%eax
ja     1291 <main+0x171>
mov    -0x18(%rbp),%rax
lea    0xe81(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129f <main+0x17f>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11d8 <main+0xb8>
jp     11d8 <main+0xb8>
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <main+0xcb>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129f <main+0x17f>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129f <main+0x17f>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129f <main+0x17f>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129f <main+0x17f>
jmp    129f <main+0x17f>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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
sub    $0x18,%rsp
lea    0xfa2(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5b(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xf(%rsp),%rbx
lea    0xf6b(%rip),%r12
lea    0xe9b(%rip),%rbp
lea    0xf42(%rip),%r13
jmp    11a1 <main+0x71>
movss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
xchg   %ax,%ax
movss  %xmm0,0x10(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x45,%al
je     1235 <main+0x105>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%eax
lea    -0x2a(%rax),%ecx
cmp    $0x29,%ecx
ja     11d4 <main+0xa4>
movslq 0x0(%rbp,%rcx,4),%rcx
add    %rbp,%rcx
jmp    *%rcx
movss  0x10(%rsp),%xmm0
mulss  0x14(%rsp),%xmm0
jmp    1180 <main+0x50>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1194 <main+0x64>
movss  0x10(%rsp),%xmm0
subss  0x14(%rsp),%xmm0
jmp    1180 <main+0x50>
movss  0x14(%rsp),%xmm0
ucomiss 0xe05(%rip),%xmm0
jne    1223 <main+0xf3>
jp     1223 <main+0xf3>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
jmp    1180 <main+0x50>
movss  0x14(%rsp),%xmm0
jmp    1180 <main+0x50>
movss  0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
jmp    1180 <main+0x50>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Begin Calculations \0A\00"
@.str.1 = [6 x i8] c"%f %c\00"
@.str.2 = [5 x i8] c"%f \0A\00"
@.str.3 = [22 x i8] c"\C2\B3\C3\BD\C3\8A\C3\BD\C2\B2\C2\BB\C3\84\C3\9C\C3\8E\C2\AA0\00"
@.str.4 = [26 x i8] c"\C3\8E\C2\B4\C3\96\C2\AA\C2\B5\C3\84\C2\B2\C3\99\C3\97\C3\B7\C2\B7\C3\BB!\00"
@.str.5 = [23 x i8] c"End of Calculations. \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %56, %0
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 69
br i1 %9, label %10, label %57
10: ; preds = %6
%11 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, i8* %4)
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
switch i32 %13, label %54 [
i32 83, label %14
i32 47, label %19
i32 42, label %32
i32 45, label %39
i32 43, label %46
i32 69, label %53
]
14: ; preds = %10
%15 = load float, float* %2
store float %15, float* %3
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %17)
br label %56
19: ; preds = %10
%20 = load float, float* %2
%21 = fcmp oeq float %20, 0.000000e+00
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %28
24: ; preds = %19
%25 = load float, float* %2
%26 = load float, float* %3
%27 = fdiv float %26, %25
store float %27, float* %3
br label %28
28: ; preds = %24, %22
%29 = load float, float* %3
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %30)
br label %56
32: ; preds = %10
%33 = load float, float* %2
%34 = load float, float* %3
%35 = fmul float %34, %33
store float %35, float* %3
%36 = load float, float* %3
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %37)
br label %56
39: ; preds = %10
%40 = load float, float* %2
%41 = load float, float* %3
%42 = fsub float %41, %40
store float %42, float* %3
%43 = load float, float* %3
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %44)
br label %56
46: ; preds = %10
%47 = load float, float* %2
%48 = load float, float* %3
%49 = fadd float %48, %47
store float %49, float* %3
%50 = load float, float* %3
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %51)
br label %56
53: ; preds = %10
br label %56
54: ; preds = %10
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %54, %53, %46, %39, %32, %28, %14
br label %6
57: ; preds = %6
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%f %c\00"
@.str.2 = [5 x i8] c"%f \0A\00"
@.str.3 = [22 x i8] c"\C2\B3\C3\BD\C3\8A\C3\BD\C2\B2\C2\BB\C3\84\C3\9C\C3\8E\C2\AA0\00"
@.str.4 = [26 x i8] c"\C3\8E\C2\B4\C3\96\C2\AA\C2\B5\C3\84\C2\B2\C3\99\C3\97\C3\B7\C2\B7\C3\BB!\00"
@str = [20 x i8] c"Begin Calculations \00"
@str.6 = [22 x i8] c"End of Calculations. \00"
define i32 @main() {
%1 = alloca float
%2 = alloca i8
%3 = bitcast float* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %0, %45
%6 = phi float [ %47, %45 ], [ undef, %0 ]
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, i8* %2)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
switch i32 %9, label %40 [
i32 83, label %10
i32 47, label %14
i32 42, label %25
i32 45, label %30
i32 43, label %35
i32 69, label %45
]
10: ; preds = %5
%11 = load float, float* %1
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %12)
br label %42
14: ; preds = %5
%15 = load float, float* %1
%16 = fcmp oeq float %15, 0.000000e+00
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %21
19: ; preds = %14
%20 = fdiv float %6, %15
br label %21
21: ; preds = %19, %17
%22 = phi float [ %6, %17 ], [ %20, %19 ]
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %23)
br label %42
25: ; preds = %5
%26 = load float, float* %1
%27 = fmul float %6, %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %28)
br label %42
30: ; preds = %5
%31 = load float, float* %1
%32 = fsub float %6, %31
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %33)
br label %42
35: ; preds = %5
%36 = load float, float* %1
%37 = fadd float %6, %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %38)
br label %42
40: ; preds = %5
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %10, %21, %25, %30, %35, %40
%43 = phi float [ %11, %10 ], [ %22, %21 ], [ %27, %25 ], [ %32, %30 ], [ %37, %35 ], [ %6, %40 ]
%44 = load i8, i8* %2
br label %45
45: ; preds = %42, %5
%46 = phi i8 [ %44, %42 ], [ %8, %5 ]
%47 = phi float [ %43, %42 ], [ %6, %5 ]
%48 = icmp eq i8 %46, 69
br i1 %48, label %49, label %5
49: ; preds = %45
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}