#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(int, int);
double ExponentialEaseInOut(double p) {
  if (p == 0.0 || p == 1.0)
    return p;
  if (p < 0.5) {
    return 0.5 * pow(2, (20 * p) - 10);
  } else {
    return -0.5 * pow(2, (-20 * p) + 10) + 1;
  }
}


x86 assembly (clang, -O0):
<ExponentialEaseInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    113a <ExponentialEaseInOut+0x2a>
jp     113a <ExponentialEaseInOut+0x2a>
jmp    1157 <ExponentialEaseInOut+0x47>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1166 <ExponentialEaseInOut+0x56>
jp     1166 <ExponentialEaseInOut+0x56>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1205 <ExponentialEaseInOut+0xf5>
movsd  0xe9a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11bd <ExponentialEaseInOut+0xad>
movsd  -0x10(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe59(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1205 <ExponentialEaseInOut+0xf5>
movsd  -0x10(%rbp),%xmm0
movsd  0xe4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  0xe20(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe04(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExponentialEaseInOut>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    111d <ExponentialEaseInOut+0xd>
jnp    118d <ExponentialEaseInOut+0x7d>
ucomisd 0xedb(%rip),%xmm0
jne    1129 <ExponentialEaseInOut+0x19>
jnp    118d <ExponentialEaseInOut+0x7d>
movsd  0xed7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    115f <ExponentialEaseInOut+0x4f>
mulsd  0xee9(%rip),%xmm0
addsd  0xee9(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0xeab(%rip),%xmm0
pop    %rax
ret
mulsd  0xea9(%rip),%xmm0
addsd  0xea9(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0xe9b(%rip),%xmm0
addsd  0xe73(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ExponentialEaseInOut(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oeq double %4, 0.000000e+00
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp oeq double %7, 1.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = load double, double* %3
store double %10, double* %2
br label %26
11: ; preds = %6
%12 = load double, double* %3
%13 = fcmp olt double %12, 5.000000e-01
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load double, double* %3
%16 = call double @llvm.fmuladd.f64(double 2.000000e+01, double %15, double -1.000000e+01)
%17 = fptosi double %16 to i32
%18 = call double @pow(i32 2, i32 %17)
%19 = fmul double 5.000000e-01, %18
store double %19, double* %2
br label %26
20: ; preds = %11
%21 = load double, double* %3
%22 = call double @llvm.fmuladd.f64(double -2.000000e+01, double %21, double 1.000000e+01)
%23 = fptosi double %22 to i32
%24 = call double @pow(i32 2, i32 %23)
%25 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %24, double 1.000000e+00)
store double %25, double* %2
br label %26
26: ; preds = %20, %14, %9
%27 = load double, double* %2
ret double %27
}

LLVM IR (-O2):
define double @ExponentialEaseInOut(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
%3 = fcmp oeq double %0, 1.000000e+00
%4 = or i1 %2, %3
br i1 %4, label %17, label %5
5: ; preds = %1
%6 = fcmp olt double %0, 5.000000e-01
br i1 %6, label %7, label %12
7: ; preds = %5
%8 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+01, double -1.000000e+01)
%9 = fptosi double %8 to i32
%10 = tail call double @pow(i32 2, i32 %9)
%11 = fmul double %10, 5.000000e-01
br label %17
12: ; preds = %5
%13 = tail call double @llvm.fmuladd.f64(double %0, double -2.000000e+01, double 1.000000e+01)
%14 = fptosi double %13 to i32
%15 = tail call double @pow(i32 2, i32 %14)
%16 = tail call double @llvm.fmuladd.f64(double %15, double -5.000000e-01, double 1.000000e+00)
br label %17
17: ; preds = %1, %12, %7
%18 = phi double [ %11, %7 ], [ %16, %12 ], [ %0, %1 ]
ret double %18
}