#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 M_PI_2;
int pow(int, int);
int sin(int);
double elasticEaseInOutd(double p) {
  if (p < 0.5) {
    return 0.5 * sin(13 * M_PI_2 * (2 * p)) * pow(2, 10 * ((2 * p) - 1));
  } else {
    return 0.5 *
           (sin(-13 * M_PI_2 * ((2 * p - 1) + 1)) * pow(2, -10 * (2 * p - 1)) +
            2);
  }
}


x86 assembly (clang, -O0):
<elasticEaseInOutd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xecb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11c3 <elasticEaseInOutd+0xa3>
mov    0x2ea1(%rip),%rax
imul   $0xd,(%rax),%eax
cvtsi2sd %eax,%xmm0
movsd  0xed2(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe8c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe82(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe86(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  -0x18(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1254 <elasticEaseInOutd+0x134>
mov    0x2e1e(%rip),%rax
imul   $0xfffffff3,(%rax),%eax
cvtsi2sd %eax,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe2b(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0xe27(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xdfa(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xde6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
add    $0x2,%eax
cvtsi2sd %eax,%xmm1
movsd  0xdb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elasticEaseInOutd>:
push   %rbx
sub    $0x10,%rsp
movsd  0xed3(%rip),%xmm1
ucomisd %xmm0,%xmm1
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
jbe    11a6 <elasticEaseInOutd+0x86>
lea    (%rax,%rax,2),%ecx
lea    (%rax,%rcx,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe92(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
addsd  0xe87(%rip),%xmm0
mulsd  0xe97(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    1209 <elasticEaseInOutd+0xe9>
imul   $0xfffffff3,%eax,%eax
cvtsi2sd %eax,%xmm2
addsd  %xmm0,%xmm0
addsd  0xe4f(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe4a(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
mulsd  0xe32(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0xe04(%rip),%xmm0
imul   %ebx,%eax
add    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@M_PI_2 = global i32 0
define double @elasticEaseInOutd(double %0) {
%2 = fcmp olt double %0, 5.000000e-01
%3 = load i32, i32* @M_PI_2
br i1 %2, label %4, label %18
4: ; preds = %1
%5 = mul nsw i32 %3, 13
%6 = sitofp i32 %5 to double
%7 = fmul double %0, 2.000000e+00
%8 = fmul double %7, %6
%9 = fptosi double %8 to i32
%10 = tail call i32 @sin(i32 %9)
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 5.000000e-01
%13 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
%14 = fmul double %13, 1.000000e+01
%15 = fptosi double %14 to i32
%16 = tail call i32 @pow(i32 2, i32 %15)
%17 = sitofp i32 %16 to double
br label %32
18: ; preds = %1
%19 = mul nsw i32 %3, -13
%20 = sitofp i32 %19 to double
%21 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
%22 = fadd double %21, 1.000000e+00
%23 = fmul double %22, %20
%24 = fptosi double %23 to i32
%25 = tail call i32 @sin(i32 %24)
%26 = fmul double %21, -1.000000e+01
%27 = fptosi double %26 to i32
%28 = tail call i32 @pow(i32 2, i32 %27)
%29 = mul nsw i32 %28, %25
%30 = add nsw i32 %29, 2
%31 = sitofp i32 %30 to double
br label %32
32: ; preds = %18, %4
%33 = phi double [ 5.000000e-01, %18 ], [ %17, %4 ]
%34 = phi double [ %31, %18 ], [ %12, %4 ]
%35 = fmul double %34, %33
ret double %35
}