#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, float *, char *, float *);
int main() {
  float val1, val2;
  char opp;
  puts("Please enter your expression: \n");
  scanf("%f %c %f", &val1, &opp, &val2);
  switch (opp) {
  case '+':
    printf("%.2f\n", val1 + val2);
    break;
  case '-':
    printf("%.2f\n", val1 - val2);
    break;
  case '/':
    if (val1 == 0 || val2 == 0) {
      printf("You can't divide by zero, yo!\n");
      printf(
          "What're ya tryin' ta do, break the universe!?\nSheeesh....\n\n\n");
    } else {
      printf("%.2f\n", val1 / val2);
    }
    break;
  case '*':
    printf("%.2f\n", val1 * val2);
    break;
  default:
    printf("Not sure what ya mean there, pardner....\n\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xd(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
movsbl -0xd(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1265 <main+0x135>
mov    -0x18(%rbp),%rax
lea    0xe7c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11eb <main+0xbb>
jp     11eb <main+0xbb>
jmp    1202 <main+0xd2>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1223 <main+0xf3>
jp     1223 <main+0xf3>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123f <main+0x10f>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe09(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%eax
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     11d7 <main+0xa7>
lea    0xe91(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x14(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
jmp    11c3 <main+0x93>
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
jmp    11c3 <main+0x93>
movss  0x14(%rsp),%xmm0
subss  0x10(%rsp),%xmm0
jmp    11c3 <main+0x93>
movss  0x14(%rsp),%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jne    11b2 <main+0x82>
jnp    11e0 <main+0xb0>
movss  0x10(%rsp),%xmm1
ucomiss %xmm2,%xmm1
jne    11bf <main+0x8f>
jnp    11e0 <main+0xb0>
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11f8 <main+0xc8>
lea    0xec3(%rip),%rdi
jmp    11f3 <main+0xc3>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Please enter your expression: \0A\00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
@.str.3 = [31 x i8] c"You can't divide by zero, yo!\0A\00"
@.str.4 = [61 x i8] c"What're ya tryin' ta do, break the universe!?\0ASheeesh....\0A\0A\0A\00"
@.str.5 = [44 x i8] c"Not sure what ya mean there, pardner....\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, i8* %4, float* %3)
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
switch i32 %8, label %43 [
i32 43, label %9
i32 45, label %15
i32 47, label %21
i32 42, label %37
]
9: ; preds = %0
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fadd float %10, %11
%13 = fpext float %12 to double
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %13)
br label %45
15: ; preds = %0
%16 = load float, float* %2
%17 = load float, float* %3
%18 = fsub float %16, %17
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %19)
br label %45
21: ; preds = %0
%22 = load float, float* %2
%23 = fcmp oeq float %22, 0.000000e+00
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load float, float* %3
%26 = fcmp oeq float %25, 0.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %24, %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
br label %36
30: ; preds = %24
%31 = load float, float* %2
%32 = load float, float* %3
%33 = fdiv float %31, %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %36
36: ; preds = %30, %27
br label %45
37: ; preds = %0
%38 = load float, float* %2
%39 = load float, float* %3
%40 = fmul float %38, %39
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %41)
br label %45
43: ; preds = %0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
br label %45
45: ; preds = %43, %37, %36, %15, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Please enter your expression: \0A\00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
@str = [30 x i8] c"You can't divide by zero, yo!\00"
@str.6 = [60 x i8] c"What're ya tryin' ta do, break the universe!?\0ASheeesh....\0A\0A\00"
@str.7 = [43 x i8] c"Not sure what ya mean there, pardner....\0A\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 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, i8* %3, float* %2)
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
switch i32 %9, label %41 [
i32 43, label %10
i32 45, label %16
i32 47, label %22
i32 42, label %35
]
10: ; preds = %0
%11 = load float, float* %1
%12 = load float, float* %2
%13 = fadd float %11, %12
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %43
16: ; preds = %0
%17 = load float, float* %1
%18 = load float, float* %2
%19 = fsub float %17, %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %43
22: ; preds = %0
%23 = load float, float* %1
%24 = fcmp oeq float %23, 0.000000e+00
%25 = load float, float* %2
%26 = fcmp oeq float %25, 0.000000e+00
%27 = select i1 %24, i1 true, i1 %26
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.6, i64 0, i64 0))
br label %43
31: ; preds = %22
%32 = fdiv float %23, %25
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %33)
br label %43
35: ; preds = %0
%36 = load float, float* %1
%37 = load float, float* %2
%38 = fmul float %36, %37
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %39)
br label %43
41: ; preds = %0
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.7, i64 0, i64 0))
br label %43
43: ; preds = %28, %31, %41, %35, %16, %10
ret i32 0
}