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


x86 assembly (clang, -O0):
<ElasticEaseInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xecb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11bd <ElasticEaseInOut+0x9d>
movsd  0xef0(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xedb(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe92(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe88(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe94(%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    1245 <ElasticEaseInOut+0x125>
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe42(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe46(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe32(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe09(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xdf5(%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  0xdc4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ElasticEaseInOut>:
push   %rbx
sub    $0x10,%rsp
movsd  0xed3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1198 <ElasticEaseInOut+0x78>
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xee4(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xea0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
addsd  0xe95(%rip),%xmm0
mulsd  0xeb5(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    11f8 <ElasticEaseInOut+0xd8>
addsd  %xmm0,%xmm0
addsd  0xe64(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe5f(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe5b(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
mulsd  0xe4b(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0xe15(%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):
define double @ElasticEaseInOut(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 %21
6: ; preds = %1
%7 = load double, double* %3
%8 = fmul double 2.000000e+00, %7
%9 = fmul double 0x40346B9C347764A4, %8
%10 = fptosi double %9 to i32
%11 = call i32 @sin(i32 %10)
%12 = sitofp i32 %11 to double
%13 = fmul double 5.000000e-01, %12
%14 = load double, double* %3
%15 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %14, double -1.000000e+00)
%16 = fmul double 1.000000e+01, %15
%17 = fptosi double %16 to i32
%18 = call i32 @pow(i32 2, i32 %17)
%19 = sitofp i32 %18 to double
%20 = fmul double %13, %19
store double %20, double* %2
br label %37
21: ; preds = %1
%22 = load double, double* %3
%23 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %22, double -1.000000e+00)
%24 = fadd double %23, 1.000000e+00
%25 = fmul double 0xC0346B9C347764A4, %24
%26 = fptosi double %25 to i32
%27 = call i32 @sin(i32 %26)
%28 = load double, double* %3
%29 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %28, double -1.000000e+00)
%30 = fmul double -1.000000e+01, %29
%31 = fptosi double %30 to i32
%32 = call i32 @pow(i32 2, i32 %31)
%33 = mul nsw i32 %27, %32
%34 = add nsw i32 %33, 2
%35 = sitofp i32 %34 to double
%36 = fmul double 5.000000e-01, %35
store double %36, double* %2
br label %37
37: ; preds = %21, %6
%38 = load double, double* %2
ret double %38
}

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