#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 sin(double);
double BackEaseInOut(double p) {
  if (p < 0.5) {
    double f = 2 * p;
    return 0.5 * (f * f * f - f * sin(f * 3.14159265358979323846264338327));
  } else {
    double f = (1 - (2 * p - 1));
    return 0.5 * (1 -
                  (f * f * f - f * sin(f * 3.14159265358979323846264338327))) +
           0.5;
  }
}


x86 assembly (clang, -O0):
<BackEaseInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11c2 <BackEaseInOut+0xb2>
movsd  0xee8(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea3(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm3,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe4c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1273 <BackEaseInOut+0x163>
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe45(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe29(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdfd(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm3,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdae(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xd9a(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BackEaseInOut>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
movsd  0xee0(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1178 <BackEaseInOut+0x68>
addsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xed2(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe91(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret
addsd  %xmm1,%xmm1
addsd  0xe84(%rip),%xmm1
movsd  0xe84(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe6c(%rip),%xmm0
mulsd  %xmm2,%xmm0
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm0,%xmm1
movsd  0xe3b(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @BackEaseInOut(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, 5.000000e-01
br i1 %7, label %8, label %23
8: ; preds = %1
%9 = load double, double* %3
%10 = fmul double 2.000000e+00, %9
store double %10, double* %4
%11 = load double, double* %4
%12 = load double, double* %4
%13 = fmul double %11, %12
%14 = load double, double* %4
%15 = load double, double* %4
%16 = load double, double* %4
%17 = fmul double %16, 0x400921FB54442D18
%18 = call double @sin(double %17)
%19 = fmul double %15, %18
%20 = fneg double %19
%21 = call double @llvm.fmuladd.f64(double %13, double %14, double %20)
%22 = fmul double 5.000000e-01, %21
store double %22, double* %2
br label %40
23: ; preds = %1
%24 = load double, double* %3
%25 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %24, double -1.000000e+00)
%26 = fsub double 1.000000e+00, %25
store double %26, double* %5
%27 = load double, double* %5
%28 = load double, double* %5
%29 = fmul double %27, %28
%30 = load double, double* %5
%31 = load double, double* %5
%32 = load double, double* %5
%33 = fmul double %32, 0x400921FB54442D18
%34 = call double @sin(double %33)
%35 = fmul double %31, %34
%36 = fneg double %35
%37 = call double @llvm.fmuladd.f64(double %29, double %30, double %36)
%38 = fsub double 1.000000e+00, %37
%39 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %38, double 5.000000e-01)
store double %39, double* %2
br label %40
40: ; preds = %23, %8
%41 = load double, double* %2
ret double %41
}

LLVM IR (-O2):
define double @BackEaseInOut(double %0) {
%2 = fcmp olt double %0, 5.000000e-01
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = fmul double %0, 2.000000e+00
%5 = fmul double %4, %4
%6 = fmul double %4, 0x400921FB54442D18
%7 = tail call double @sin(double %6)
%8 = fneg double %4
%9 = fmul double %7, %8
%10 = tail call double @llvm.fmuladd.f64(double %5, double %4, double %9)
%11 = fmul double %10, 5.000000e-01
br label %23
12: ; preds = %1
%13 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
%14 = fsub double 1.000000e+00, %13
%15 = fmul double %14, %14
%16 = fmul double %14, 0x400921FB54442D18
%17 = tail call double @sin(double %16)
%18 = fneg double %14
%19 = fmul double %17, %18
%20 = tail call double @llvm.fmuladd.f64(double %15, double %14, double %19)
%21 = fsub double 1.000000e+00, %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double 5.000000e-01, double 5.000000e-01)
br label %23
23: ; preds = %12, %3
%24 = phi double [ %11, %3 ], [ %22, %12 ]
ret double %24
}