#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);
double Tween_ExponentialInOutEasing(double k) {
  if (k == 0) {
    return 0;
  }
  if (k == 1) {
    return 1;
  }
  k *= 2;
  if (k < 1) {
    return 0.5 * pow(1024, k - 1);
  }
  return 0.5 * (-pow(2, -10 * (k - 1)) + 2);
}


x86 assembly (clang, -O0):
<Tween_ExponentialInOutEasing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1142 <Tween_ExponentialInOutEasing+0x32>
jp     1142 <Tween_ExponentialInOutEasing+0x32>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1218 <Tween_ExponentialInOutEasing+0x108>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <Tween_ExponentialInOutEasing+0x61>
jp     1171 <Tween_ExponentialInOutEasing+0x61>
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1218 <Tween_ExponentialInOutEasing+0x108>
movsd  0xe8f(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe75(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11cf <Tween_ExponentialInOutEasing+0xbf>
movsd  -0x10(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x400,%edi
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe4f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1218 <Tween_ExponentialInOutEasing+0x108>
movsd  -0x10(%rbp),%xmm1
movsd  0xe24(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe30(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x2,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe01(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tween_ExponentialInOutEasing>:
push   %rbx
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    111d <Tween_ExponentialInOutEasing+0xd>
jnp    118a <Tween_ExponentialInOutEasing+0x7a>
movsd  0xedb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    112d <Tween_ExponentialInOutEasing+0x1d>
jnp    118a <Tween_ExponentialInOutEasing+0x7a>
addsd  %xmm0,%xmm0
movsd  0xec7(%rip),%xmm1
ucomisd %xmm0,%xmm1
addsd  0xec3(%rip),%xmm0
jbe    115e <Tween_ExponentialInOutEasing+0x4e>
cvttsd2si %xmm0,%esi
mov    $0x400,%edi
call   1030 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
jmp    1182 <Tween_ExponentialInOutEasing+0x72>
mulsd  0xeaa(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%ebx
mov    $0x2,%edi
call   1030 <pow@plt>
sub    %eax,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  0xe8e(%rip),%xmm1
movapd %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @Tween_ExponentialInOutEasing(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 %6, label %7
6: ; preds = %1
store double 0.000000e+00, double* %2
br label %33
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp oeq double %8, 1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store double 1.000000e+00, double* %2
br label %33
11: ; preds = %7
%12 = load double, double* %3
%13 = fmul double %12, 2.000000e+00
store double %13, double* %3
%14 = load double, double* %3
%15 = fcmp olt double %14, 1.000000e+00
br i1 %15, label %16, label %23
16: ; preds = %11
%17 = load double, double* %3
%18 = fsub double %17, 1.000000e+00
%19 = fptosi double %18 to i32
%20 = call i32 @pow(i32 1024, i32 %19)
%21 = sitofp i32 %20 to double
%22 = fmul double 5.000000e-01, %21
store double %22, double* %2
br label %33
23: ; preds = %11
%24 = load double, double* %3
%25 = fsub double %24, 1.000000e+00
%26 = fmul double -1.000000e+01, %25
%27 = fptosi double %26 to i32
%28 = call i32 @pow(i32 2, i32 %27)
%29 = sub nsw i32 0, %28
%30 = add nsw i32 %29, 2
%31 = sitofp i32 %30 to double
%32 = fmul double 5.000000e-01, %31
store double %32, double* %2
br label %33
33: ; preds = %23, %16, %10, %6
%34 = load double, double* %2
ret double %34
}

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