#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 */
double pow(double, double);
double operation(char c, double x, double y) {
  if (c == '+')
    return (x + y);
  if (c == '-')
    return (x - y);
  if (c == '*')
    return (x * y);
  if (c == '/')
    return (x / y);
  if (c == '^')
    return pow(x, y);
}


x86 assembly (clang, -O0):
<operation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x2b,%eax
jne    1149 <operation+0x39>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cd <operation+0xbd>
movsbl -0x9(%rbp),%eax
cmp    $0x2d,%eax
jne    116a <operation+0x5a>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cd <operation+0xbd>
movsbl -0x9(%rbp),%eax
cmp    $0x2a,%eax
jne    118b <operation+0x7b>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cd <operation+0xbd>
movsbl -0x9(%rbp),%eax
cmp    $0x2f,%eax
jne    11ac <operation+0x9c>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cd <operation+0xbd>
movsbl -0x9(%rbp),%eax
cmp    $0x5e,%eax
jne    11cd <operation+0xbd>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation>:
lea    -0x2a(%rdi),%eax
cmp    $0x5,%al
ja     112f <operation+0x1f>
movzbl %al,%eax
lea    0xedf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mulsd  %xmm1,%xmm0
ret
cmp    $0x5e,%dil
jne    113e <operation+0x2e>
jmp    1030 <pow@plt>
addsd  %xmm1,%xmm0
ret
subsd  %xmm1,%xmm0
ret
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @operation(i8 signext %0, double %1, double %2) {
%4 = alloca double
%5 = alloca i8
%6 = alloca double
%7 = alloca double
store i8 %0, i8* %5
store double %1, double* %6
store double %2, double* %7
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 43
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load double, double* %6
%13 = load double, double* %7
%14 = fadd double %12, %13
store double %14, double* %4
br label %47
15: ; preds = %3
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 45
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load double, double* %6
%21 = load double, double* %7
%22 = fsub double %20, %21
store double %22, double* %4
br label %47
23: ; preds = %15
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 42
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load double, double* %6
%29 = load double, double* %7
%30 = fmul double %28, %29
store double %30, double* %4
br label %47
31: ; preds = %23
%32 = load i8, i8* %5
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 47
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load double, double* %6
%37 = load double, double* %7
%38 = fdiv double %36, %37
store double %38, double* %4
br label %47
39: ; preds = %31
%40 = load i8, i8* %5
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 94
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load double, double* %6
%45 = load double, double* %7
%46 = call double @pow(double %44, double %45)
store double %46, double* %4
br label %47
47: ; preds = %11, %19, %27, %35, %43, %39
%48 = load double, double* %4
ret double %48
}

LLVM IR (-O2):
define double @operation(i8 signext %0, double %1, double %2) {
switch i8 %0, label %14 [
i8 43, label %4
i8 45, label %6
i8 42, label %8
i8 47, label %10
i8 94, label %12
]
4: ; preds = %3
%5 = fadd double %1, %2
br label %14
6: ; preds = %3
%7 = fsub double %1, %2
br label %14
8: ; preds = %3
%9 = fmul double %1, %2
br label %14
10: ; preds = %3
%11 = fdiv double %1, %2
br label %14
12: ; preds = %3
%13 = tail call double @pow(double %1, double %2)
br label %14
14: ; preds = %3, %4, %6, %8, %10, %12
%15 = phi double [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ %11, %10 ], [ %13, %12 ], [ undef, %3 ]
ret double %15
}