#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 EOF;
int getchar();
double pop();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ push(int);
int main(void) {
  int c, i, temp;
  char s[1000];
  while ((c = getchar()) != EOF) {
    if (c >= '0' && c <= '9') {
      push(c - '0');
    } else if (c == '+') {
      push(pop() + pop());
    } else if (c == '-') {
      temp = pop();
      push(pop() - temp);
    } else if (c == '*') {
      push(pop() * pop());
    } else if (c == '/') {
      temp = pop();
      push(pop() / temp);
    } else if (c == '\n')
      printf("%.2f\n", pop());
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
je     12b0 <main+0x170>
cmpl   $0x30,-0x8(%rbp)
jl     118f <main+0x4f>
cmpl   $0x39,-0x8(%rbp)
jg     118f <main+0x4f>
mov    -0x8(%rbp),%edi
sub    $0x30,%edi
call   1060 <push@plt>
jmp    12ab <main+0x16b>
cmpl   $0x2b,-0x8(%rbp)
jne    11cc <main+0x8c>
mov    $0x0,%al
call   1040 <pop@plt>
movsd  %xmm0,-0x408(%rbp)
ff
mov    $0x0,%al
call   1040 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x408(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <push@plt>
jmp    12a6 <main+0x166>
cmpl   $0x2d,-0x8(%rbp)
jne    1202 <main+0xc2>
mov    $0x0,%al
call   1040 <pop@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pop@plt>
cvtsi2sdl -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <push@plt>
jmp    12a1 <main+0x161>
cmpl   $0x2a,-0x8(%rbp)
jne    123f <main+0xff>
mov    $0x0,%al
call   1040 <pop@plt>
movsd  %xmm0,-0x410(%rbp)
ff
mov    $0x0,%al
call   1040 <pop@plt>
movaps %xmm0,%xmm1
movsd  -0x410(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <push@plt>
jmp    129c <main+0x15c>
cmpl   $0x2f,-0x8(%rbp)
jne    1275 <main+0x135>
mov    $0x0,%al
call   1040 <pop@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pop@plt>
cvtsi2sdl -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <push@plt>
jmp    1297 <main+0x157>
cmpl   $0xa,-0x8(%rbp)
jne    1292 <main+0x152>
mov    $0x0,%al
call   1040 <pop@plt>
lea    0xd73(%rip),%rdi
call   1030 <printf@plt>
jmp    1297 <main+0x157>
jmp    129c <main+0x15c>
jmp    12a1 <main+0x161>
jmp    12a6 <main+0x166>
jmp    12ab <main+0x16b>
jmp    1152 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e91(%rip),%rbx
cmp    (%rbx),%eax
jne    1167 <main+0x27>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe92(%rip),%r15
lea    0xf23(%rip),%r14
jmp    11ab <main+0x6b>
xor    %eax,%eax
call   1040 <pop@plt>
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <pop@plt>
cvttpd2dq (%rsp),%xmm1
cvtdq2pd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     115b <main+0x1b>
lea    -0x30(%rax),%edi
cmp    $0x9,%edi
jbe    119b <main+0x5b>
add    $0xfffffff6,%eax
cmp    $0x25,%eax
ja     11a0 <main+0x60>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <pop@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    11a0 <main+0x60>
xor    %eax,%eax
call   1040 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <pop@plt>
mulsd  (%rsp),%xmm0
jmp    1197 <main+0x57>
xor    %eax,%eax
call   1040 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <pop@plt>
addsd  (%rsp),%xmm0
jmp    1197 <main+0x57>
xor    %eax,%eax
call   1040 <pop@plt>
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <pop@plt>
cvttpd2dq (%rsp),%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
jmp    1197 <main+0x57>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %73, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %2
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %74
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 48
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp sle i32 %14, 57
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 48
%19 = call i32 @push(i32 %18)
br label %73
20: ; preds = %13, %10
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 43
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = call double (...) @pop()
%25 = call double (...) @pop()
%26 = fadd double %24, %25
%27 = fptosi double %26 to i32
%28 = call i32 @push(i32 %27)
br label %72
29: ; preds = %20
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 45
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = call double (...) @pop()
%34 = fptosi double %33 to i32
store i32 %34, i32* %4
%35 = call double (...) @pop()
%36 = load i32, i32* %4
%37 = sitofp i32 %36 to double
%38 = fsub double %35, %37
%39 = fptosi double %38 to i32
%40 = call i32 @push(i32 %39)
br label %71
41: ; preds = %29
%42 = load i32, i32* %2
%43 = icmp eq i32 %42, 42
br i1 %43, label %44, label %50
44: ; preds = %41
%45 = call double (...) @pop()
%46 = call double (...) @pop()
%47 = fmul double %45, %46
%48 = fptosi double %47 to i32
%49 = call i32 @push(i32 %48)
br label %70
50: ; preds = %41
%51 = load i32, i32* %2
%52 = icmp eq i32 %51, 47
br i1 %52, label %53, label %62
53: ; preds = %50
%54 = call double (...) @pop()
%55 = fptosi double %54 to i32
store i32 %55, i32* %4
%56 = call double (...) @pop()
%57 = load i32, i32* %4
%58 = sitofp i32 %57 to double
%59 = fdiv double %56, %58
%60 = fptosi double %59 to i32
%61 = call i32 @push(i32 %60)
br label %69
62: ; preds = %50
%63 = load i32, i32* %2
%64 = icmp eq i32 %63, 10
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call double (...) @pop()
%67 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %66)
br label %68
68: ; preds = %65, %62
br label %69
69: ; preds = %68, %53
br label %70
70: ; preds = %69, %44
br label %71
71: ; preds = %70, %32
br label %72
72: ; preds = %71, %23
br label %73
73: ; preds = %72, %16
br label %6
74: ; preds = %6
%75 = load i32, i32* %1
ret i32 %75
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %46, label %4
4: ; preds = %0, %42
%5 = phi i32 [ %43, %42 ], [ %1, %0 ]
%6 = add i32 %5, -48
%7 = icmp ult i32 %6, 10
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @push(i32 %6)
br label %42
10: ; preds = %4
switch i32 %5, label %42 [
i32 43, label %11
i32 45, label %17
i32 42, label %25
i32 47, label %31
i32 10, label %39
]
11: ; preds = %10
%12 = tail call double (...) @pop()
%13 = tail call double (...) @pop()
%14 = fadd double %12, %13
%15 = fptosi double %14 to i32
%16 = tail call i32 @push(i32 %15)
br label %42
17: ; preds = %10
%18 = tail call double (...) @pop()
%19 = fptosi double %18 to i32
%20 = tail call double (...) @pop()
%21 = sitofp i32 %19 to double
%22 = fsub double %20, %21
%23 = fptosi double %22 to i32
%24 = tail call i32 @push(i32 %23)
br label %42
25: ; preds = %10
%26 = tail call double (...) @pop()
%27 = tail call double (...) @pop()
%28 = fmul double %26, %27
%29 = fptosi double %28 to i32
%30 = tail call i32 @push(i32 %29)
br label %42
31: ; preds = %10
%32 = tail call double (...) @pop()
%33 = fptosi double %32 to i32
%34 = tail call double (...) @pop()
%35 = sitofp i32 %33 to double
%36 = fdiv double %34, %35
%37 = fptosi double %36 to i32
%38 = tail call i32 @push(i32 %37)
br label %42
39: ; preds = %10
%40 = tail call double (...) @pop()
%41 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %40)
br label %42
42: ; preds = %10, %11, %25, %39, %31, %17, %8
%43 = tail call i32 (...) @getchar()
%44 = load i32, i32* @EOF
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %4
46: ; preds = %42, %0
ret i32 0
}