#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);
int /*<<< orphan*/ scanf(char *, int *, char *, int *);
int main(void) {
  int a, b;
  char op;
  while (1) {
    scanf("%d %c %d", &a, &op, &b);
    if (op == '?')
      break;
    if (op == '+') {
      printf("%d\n", a + b);
    } else if (op == '-') {
      printf("%d\n", a - b);
    } else if (op == '*') {
      printf("%d\n", a * b);
    } else if (op == '/') {
      printf("%d\n", a / b);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xd(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x3f,%eax
jne    1159 <main+0x39>
jmp    11fc <main+0xdc>
movsbl -0xd(%rbp),%eax
cmp    $0x2b,%eax
jne    117d <main+0x5d>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
movsbl -0xd(%rbp),%eax
cmp    $0x2d,%eax
jne    11a1 <main+0x81>
mov    -0x8(%rbp),%esi
sub    -0xc(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
movsbl -0xd(%rbp),%eax
cmp    $0x2a,%eax
jne    11c6 <main+0xa6>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
movsbl -0xd(%rbp),%eax
cmp    $0x2f,%eax
jne    11e8 <main+0xc8>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%esi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
jmp    11f2 <main+0xd2>
jmp    11f7 <main+0xd7>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%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    0xf23(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xf(%rsp),%r12
lea    0x10(%rsp),%rbx
lea    0xeb5(%rip),%rbp
lea    0xf0f(%rip),%r13
jmp    1167 <main+0x47>
mov    0x14(%rsp),%eax
cltd
idivl  0x10(%rsp)
mov    %eax,%esi
mov    %r13,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1040 <scanf@plt>
movzbl 0xf(%rsp),%eax
add    $0xd6,%al
cmp    $0x15,%al
ja     1167 <main+0x47>
movzbl %al,%eax
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    0x10(%rsp),%esi
imul   0x14(%rsp),%esi
jmp    115f <main+0x3f>
mov    0x10(%rsp),%esi
add    0x14(%rsp),%esi
jmp    115f <main+0x3f>
mov    0x14(%rsp),%esi
sub    0x10(%rsp),%esi
jmp    115f <main+0x3f>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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