#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 printf(char *, int, char, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, char *);
int main() {
  int a, b, o;
  char c;
  scanf("%d %d %c", &a, &b, &c);
  switch (c) {
  case '+':
    o = a + b;
    break;
  case '-':
    o = a - b;
    break;
  case '*':
    o = a * b;
    break;
  case '/':
    o = a / b;
    break;
  case '%':
    o = a % b;
    break;
  default:
    return 0;
  }
  return 0 * printf("%d %c %d = %d", a, c, b, o);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x11(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xa,%eax
ja     11ba <main+0x9a>
mov    -0x20(%rbp),%rax
lea    0xe98(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
jmp    11c6 <main+0xa6>
movl   $0x0,-0x4(%rbp)
jmp    11e8 <main+0xc8>
mov    -0x8(%rbp),%esi
mov    -0x11(%rbp),%al
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe5b(%rip),%rdi
movsbl %al,%edx
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf01(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xf(%rsp),%rcx
call   1040 <scanf@plt>
movsbl 0xf(%rsp),%edi
lea    -0x25(%rdi),%eax
cmp    $0xa,%eax
ja     11bd <main+0x9d>
lea    0xead(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
mov    %esi,%eax
cltd
idiv   %ecx
mov    %edx,%r8d
jmp    11ad <main+0x8d>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
mov    %ecx,%r8d
imul   %esi,%r8d
jmp    11ad <main+0x8d>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
lea    (%rcx,%rsi,1),%r8d
jmp    11ad <main+0x8d>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
mov    %esi,%r8d
sub    %ecx,%r8d
jmp    11ad <main+0x8d>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
mov    %esi,%eax
cltd
idiv   %ecx
mov    %eax,%r8d
movsbl %dil,%edx
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %c\00"
@.str.1 = [14 x i8] c"%d %c %d = %d\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*
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i8* %3)
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
switch i32 %8, label %34 [
i32 43, label %9
i32 45, label %13
i32 42, label %17
i32 47, label %21
i32 37, label %25
]
9: ; preds = %0
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = add nsw i32 %11, %10
br label %29
13: ; preds = %0
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = sub nsw i32 %14, %15
br label %29
17: ; preds = %0
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = mul nsw i32 %19, %18
br label %29
21: ; preds = %0
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = sdiv i32 %22, %23
br label %29
25: ; preds = %0
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = srem i32 %26, %27
br label %29
29: ; preds = %25, %21, %17, %13, %9
%30 = phi i32 [ %27, %25 ], [ %23, %21 ], [ %19, %17 ], [ %15, %13 ], [ %11, %9 ]
%31 = phi i32 [ %26, %25 ], [ %22, %21 ], [ %18, %17 ], [ %14, %13 ], [ %10, %9 ]
%32 = phi i32 [ %28, %25 ], [ %24, %21 ], [ %20, %17 ], [ %16, %13 ], [ %12, %9 ]
%33 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %31, i8 signext %7, i32 %30, i32 %32)
br label %34
34: ; preds = %0, %29
ret i32 0
}