#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, char *, double *);
int main(int argc, const char *argv[]) {
  double positive_integer_A, positive_integer_B, result;
  char operator;
  scanf("%lf %c %lf", &positive_integer_A, &operator, & positive_integer_B);
  switch (operator) {
  case '+':
    result = positive_integer_A + positive_integer_B;
    break;
  case '-':
    result = positive_integer_A - positive_integer_B;
    break;
  case '*':
    result = positive_integer_A * positive_integer_B;
    break;
  default:
    printf("Wrong operator: %s, valid operators are +, -, *", &operator);
    exit(1);
  }
  printf("%.0lf\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x29(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x29(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x2a,%eax
je     11bd <main+0x8d>
jmp    1173 <main+0x43>
mov    -0x30(%rbp),%eax
sub    $0x2b,%eax
je     1195 <main+0x65>
jmp    1184 <main+0x54>
mov    -0x30(%rbp),%eax
sub    $0x2d,%eax
je     11a9 <main+0x79>
jmp    11d1 <main+0xa1>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11ed <main+0xbd>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11ed <main+0xbd>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11ed <main+0xbd>
lea    0xe33(%rip),%rdi
lea    -0x29(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe42(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x7(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%eax
cmp    $0x2a,%eax
je     1171 <main+0x41>
cmp    $0x2d,%eax
je     117f <main+0x4f>
cmp    $0x2b,%eax
jne    11a0 <main+0x70>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
jmp    118b <main+0x5b>
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
jmp    118b <main+0x5b>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe64(%rip),%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

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