#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 *, float);
int /*<<< orphan*/ scanf(char *, float *, char *, float *);
int main(void) {
  float a, b, res;
  char op;
  scanf("%f %c %", &a, &op, &b);
  switch (op) {
  case '+':
    res = a + b;
    break;
  case '-':
    res = a - b;
    break;
  case '*':
    res = a * b;
    break;
  case '/':
    res = a / b;
    break;
  }
  printf("%f\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x11(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     11bc <main+0x9c>
mov    -0x20(%rbp),%rax
lea    0xe98(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11bc <main+0x9c>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11bc <main+0x9c>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11bc <main+0x9c>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xeed(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <scanf@plt>
movsbl 0xf(%rsp),%eax
add    $0xffffffd6,%eax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x14(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
jmp    118d <main+0x6d>
movss  0x14(%rsp),%xmm0
divss  0x10(%rsp),%xmm0
jmp    118d <main+0x6d>
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
jmp    118d <main+0x6d>
movss  0x14(%rsp),%xmm0
subss  0x10(%rsp),%xmm0
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%f %c %\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float* %2, i8* %5, float* %3)
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
switch i32 %8, label %25 [
i32 43, label %9
i32 45, label %13
i32 42, label %17
i32 47, label %21
]
9: ; preds = %0
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fadd float %10, %11
store float %12, float* %4
br label %25
13: ; preds = %0
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fsub float %14, %15
store float %16, float* %4
br label %25
17: ; preds = %0
%18 = load float, float* %2
%19 = load float, float* %3
%20 = fmul float %18, %19
store float %20, float* %4
br label %25
21: ; preds = %0
%22 = load float, float* %2
%23 = load float, float* %3
%24 = fdiv float %22, %23
store float %24, float* %4
br label %25
25: ; preds = %0, %21, %17, %13, %9
%26 = load float, float* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %26)
ret i32 0
}

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