#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 floor(double);
double fmod(double, double);
double pow(double, double);
scalar_t__ strcmp(char const *, char *);
double calc_operation(const char *oper, double value1, double value2) {
  if (!oper)
    return 0;
  if (strcmp(oper, "+") == 0)
    return value1 + value2;
  if (strcmp(oper, "-") == 0)
    return value1 - value2;
  if (strcmp(oper, "*") == 0)
    return value1 * value2;
  if (strcmp(oper, "/") == 0)
    return (value2 != 0) ? value1 / value2 : 0;
  if (strcmp(oper, "//") == 0)
    return (value2 != 0) ? floor(value1 / value2) : 0;
  if (strcmp(oper, "%") == 0)
    return (value2 != 0) ? fmod(value1, value2) : 0;
  if (strcmp(oper, "**") == 0)
    return pow(value1, value2);
  return 0;
}


x86 assembly (clang, -O0):
<calc_operation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <calc_operation+0x2e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119c <calc_operation+0x5c>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ca <calc_operation+0x8a>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f8 <calc_operation+0xb8>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xe02(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    125f <calc_operation+0x11f>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    122f <calc_operation+0xef>
jp     122f <calc_operation+0xef>
jmp    1243 <calc_operation+0x103>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1250 <calc_operation+0x110>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1250 <calc_operation+0x110>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12cb <calc_operation+0x18b>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1296 <calc_operation+0x156>
jp     1296 <calc_operation+0x156>
jmp    12af <calc_operation+0x16f>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1060 <floor@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    12bc <calc_operation+0x17c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12bc <calc_operation+0x17c>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1337 <calc_operation+0x1f7>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1302 <calc_operation+0x1c2>
jp     1302 <calc_operation+0x1c2>
jmp    131b <calc_operation+0x1db>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    1328 <calc_operation+0x1e8>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1328 <calc_operation+0x1e8>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
mov    -0x10(%rbp),%rdi
lea    0xcc7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    136a <calc_operation+0x22a>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <calc_operation+0x232>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_operation>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm2,%xmm2
test   %rdi,%rdi
je     12a8 <calc_operation+0x168>
mov    %rdi,%rbx
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
lea    0xe99(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121e <calc_operation+0xde>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     122b <calc_operation+0xeb>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1238 <calc_operation+0xf8>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1245 <calc_operation+0x105>
lea    0xe40(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1262 <calc_operation+0x122>
lea    0xe2b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1287 <calc_operation+0x147>
lea    0xe15(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
movsd  0x8(%rsp),%xmm1
xorpd  %xmm2,%xmm2
jne    12a8 <calc_operation+0x168>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1050 <pow@plt>
movsd  (%rsp),%xmm2
addsd  0x8(%rsp),%xmm2
jmp    12a8 <calc_operation+0x168>
movsd  (%rsp),%xmm2
subsd  0x8(%rsp),%xmm2
jmp    12a8 <calc_operation+0x168>
movsd  (%rsp),%xmm2
mulsd  0x8(%rsp),%xmm2
jmp    12a8 <calc_operation+0x168>
xorpd  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd %xmm2,%xmm1
jne    1257 <calc_operation+0x117>
jnp    12a8 <calc_operation+0x168>
movsd  (%rsp),%xmm2
divsd  %xmm1,%xmm2
jmp    12a8 <calc_operation+0x168>
xorpd  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd %xmm2,%xmm1
jne    1274 <calc_operation+0x134>
jnp    12a8 <calc_operation+0x168>
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1060 <floor@plt>
xorpd  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd %xmm2,%xmm1
jne    1299 <calc_operation+0x159>
jnp    12a8 <calc_operation+0x168>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1030 <fmod@plt>
movapd %xmm2,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [3 x i8] c"//\00"
@.str.5 = [2 x i8] c"%\00"
@.str.6 = [3 x i8] c"**\00"
define double @calc_operation(i8* %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 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %3
store double 0.000000e+00, double* %4
br label %87
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load double, double* %6
%17 = load double, double* %7
%18 = fadd double %16, %17
store double %18, double* %4
br label %87
19: ; preds = %11
%20 = load i8*, i8** %5
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load double, double* %6
%25 = load double, double* %7
%26 = fsub double %24, %25
store double %26, double* %4
br label %87
27: ; preds = %19
%28 = load i8*, i8** %5
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = load double, double* %6
%33 = load double, double* %7
%34 = fmul double %32, %33
store double %34, double* %4
br label %87
35: ; preds = %27
%36 = load i8*, i8** %5
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %49
39: ; preds = %35
%40 = load double, double* %7
%41 = fcmp une double %40, 0.000000e+00
br i1 %41, label %42, label %46
42: ; preds = %39
%43 = load double, double* %6
%44 = load double, double* %7
%45 = fdiv double %43, %44
br label %47
46: ; preds = %39
br label %47
47: ; preds = %46, %42
%48 = phi double [ %45, %42 ], [ 0.000000e+00, %46 ]
store double %48, double* %4
br label %87
49: ; preds = %35
%50 = load i8*, i8** %5
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %64
53: ; preds = %49
%54 = load double, double* %7
%55 = fcmp une double %54, 0.000000e+00
br i1 %55, label %56, label %61
56: ; preds = %53
%57 = load double, double* %6
%58 = load double, double* %7
%59 = fdiv double %57, %58
%60 = call double @llvm.floor.f64(double %59)
br label %62
61: ; preds = %53
br label %62
62: ; preds = %61, %56
%63 = phi double [ %60, %56 ], [ 0.000000e+00, %61 ]
store double %63, double* %4
br label %87
64: ; preds = %49
%65 = load i8*, i8** %5
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %78
68: ; preds = %64
%69 = load double, double* %7
%70 = fcmp une double %69, 0.000000e+00
br i1 %70, label %71, label %75
71: ; preds = %68
%72 = load double, double* %6
%73 = load double, double* %7
%74 = call double @fmod(double %72, double %73)
br label %76
75: ; preds = %68
br label %76
76: ; preds = %75, %71
%77 = phi double [ %74, %71 ], [ 0.000000e+00, %75 ]
store double %77, double* %4
br label %87
78: ; preds = %64
%79 = load i8*, i8** %5
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %78
%83 = load double, double* %6
%84 = load double, double* %7
%85 = call double @pow(double %83, double %84)
store double %85, double* %4
br label %87
86: ; preds = %78
store double 0.000000e+00, double* %4
br label %87
87: ; preds = %86, %82, %76, %62, %47, %31, %23, %15, %10
%88 = load double, double* %4
ret double %88
}

LLVM IR (-O2):
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [3 x i8] c"//\00"
@.str.5 = [2 x i8] c"%\00"
@.str.6 = [3 x i8] c"**\00"
define double @calc_operation(i8* %0, double %1, double %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %47, label %5
5: ; preds = %3
%6 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = fadd double %1, %2
br label %47
10: ; preds = %5
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = fsub double %1, %2
br label %47
15: ; preds = %10
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = fmul double %1, %2
br label %47
20: ; preds = %15
%21 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = fcmp une double %2, 0.000000e+00
%25 = fdiv double %1, %2
%26 = select i1 %24, double %25, double 0.000000e+00
br label %47
27: ; preds = %20
%28 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = fcmp une double %2, 0.000000e+00
br i1 %31, label %32, label %47
32: ; preds = %30
%33 = fdiv double %1, %2
%34 = tail call double @llvm.floor.f64(double %33)
br label %47
35: ; preds = %27
%36 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = fcmp une double %2, 0.000000e+00
br i1 %39, label %40, label %47
40: ; preds = %38
%41 = tail call double @fmod(double %1, double %2)
br label %47
42: ; preds = %35
%43 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = tail call double @pow(double %1, double %2)
br label %47
47: ; preds = %42, %40, %38, %32, %30, %3, %45, %23, %18, %13, %8
%48 = phi double [ %9, %8 ], [ %14, %13 ], [ %19, %18 ], [ %26, %23 ], [ %46, %45 ], [ 0.000000e+00, %3 ], [ %34, %32 ], [ 0.000000e+00, %30 ], [ %41, %40 ], [ 0.000000e+00, %38 ], [ 0.000000e+00, %42 ]
ret double %48
}