#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() {
  char worker;
  long long int storage = 0, in;
  while (1) {
    scanf(" %c", &worker);
    if (worker == '.') {
      break;
    }
    scanf("%lld", &in);
    if (worker == '+') {
      storage += in;
    } else if (worker == '-') {
      storage -= in;
    } else if (worker == '*') {
      storage *= in;
    } else if (worker == '/') {
      storage /= in;
    }
    printf("%lld\n", storage);
  }
  printf("Goodbye!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2e,%eax
jne    115b <main+0x3b>
jmp    120f <main+0xef>
lea    0xea2(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    118b <main+0x6b>
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    11f8 <main+0xd8>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    11ac <main+0x8c>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    11f3 <main+0xd3>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
jne    11cb <main+0xab>
mov    -0x18(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    11ee <main+0xce>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    11e9 <main+0xc9>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
jmp    11ee <main+0xce>
jmp    11f3 <main+0xd3>
jmp    11f8 <main+0xd8>
mov    -0x10(%rbp),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1137 <main+0x17>
lea    0xdf9(%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    0xee3(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x2e,0xf(%rsp)
jne    1167 <main+0x47>
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r15
lea    0xeae(%rip),%r12
lea    0xe9e(%rip),%r13
lea    0xf(%rsp),%rbx
lea    0xe7a(%rip),%r14
xor    %ebp,%ebp
jmp    11c1 <main+0xa1>
nopw   0x0(%rax,%rax,1)
imul   0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x2e,0xf(%rsp)
je     1148 <main+0x28>
lea    0xe54(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movzbl 0xf(%rsp),%eax
add    $0xd6,%al
cmp    $0x5,%al
ja     11a0 <main+0x80>
movzbl %al,%eax
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    0x10(%rsp),%rbp
jmp    11a0 <main+0x80>
sub    0x10(%rsp),%rbp
jmp    11a0 <main+0x80>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rcx
mov    %rbp,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     121e <main+0xfe>
mov    %rbp,%rax
cqto
idiv   %rcx
mov    %rax,%rbp
jmp    11a0 <main+0x80>
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ebp
jmp    11a0 <main+0x80>

LLVM IR (-O0):
@.str = [4 x i8] c" %c\00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
@.str.3 = [9 x i8] c"Goodbye!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
br label %5
5: ; preds = %0, %47
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 46
br i1 %9, label %10, label %11
10: ; preds = %5
br label %50
11: ; preds = %5
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 43
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i64, i64* %4
%18 = load i64, i64* %3
%19 = add nsw i64 %18, %17
store i64 %19, i64* %3
br label %47
20: ; preds = %11
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i64, i64* %4
%26 = load i64, i64* %3
%27 = sub nsw i64 %26, %25
store i64 %27, i64* %3
br label %46
28: ; preds = %20
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 42
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i64, i64* %4
%34 = load i64, i64* %3
%35 = mul nsw i64 %34, %33
store i64 %35, i64* %3
br label %45
36: ; preds = %28
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 47
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = load i64, i64* %4
%42 = load i64, i64* %3
%43 = sdiv i64 %42, %41
store i64 %43, i64* %3
br label %44
44: ; preds = %40, %36
br label %45
45: ; preds = %44, %32
br label %46
46: ; preds = %45, %24
br label %47
47: ; preds = %46, %16
%48 = load i64, i64* %3
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %48)
br label %5
50: ; preds = %10
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" %c\00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
@.str.3 = [9 x i8] c"Goodbye!\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 46
br i1 %6, label %29, label %7
7: ; preds = %0, %23
%8 = phi i64 [ %24, %23 ], [ 0, %0 ]
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%10 = load i8, i8* %1
switch i8 %10, label %23 [
i8 43, label %11
i8 45, label %14
i8 42, label %17
i8 47, label %20
]
11: ; preds = %7
%12 = load i64, i64* %2
%13 = add nsw i64 %12, %8
br label %23
14: ; preds = %7
%15 = load i64, i64* %2
%16 = sub nsw i64 %8, %15
br label %23
17: ; preds = %7
%18 = load i64, i64* %2
%19 = mul nsw i64 %18, %8
br label %23
20: ; preds = %7
%21 = load i64, i64* %2
%22 = sdiv i64 %8, %21
br label %23
23: ; preds = %7, %14, %20, %17, %11
%24 = phi i64 [ %13, %11 ], [ %16, %14 ], [ %19, %17 ], [ %22, %20 ], [ %8, %7 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %24)
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%27 = load i8, i8* %1
%28 = icmp eq i8 %27, 46
br i1 %28, label %29, label %7
29: ; preds = %23, %0
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}