#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 sqrt(int);
double Tween_CircularInOutEasing(double k) {
  k *= 2;
  if (k < 1) {
    return -0.5 * (sqrt(1 - k * k) - 1);
  }
  k -= 2;
  return 0.5 * (sqrt(1 - k * k) + 1);
}


x86 assembly (clang, -O0):
<Tween_CircularInOutEasing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xee3(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec9(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1199 <Tween_CircularInOutEasing+0x89>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe8d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1201 <Tween_CircularInOutEasing+0xf1>
movsd  -0x10(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe24(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe18(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tween_CircularInOutEasing>:
push   %rbp
push   %r14
push   %rbx
addsd  %xmm0,%xmm0
movsd  0xee0(%rip),%xmm1
xor    %ebx,%ebx
xor    %ebp,%ebp
ucomisd %xmm0,%xmm1
seta   %r14b
setbe  %al
ja     1139 <Tween_CircularInOutEasing+0x29>
addsd  0xecf(%rip),%xmm0
mov    %al,%bpl
mulsd  %xmm0,%xmm0
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sqrt@plt>
lea    (%rax,%rbp,2),%eax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %r14b,%bl
lea    0xeac(%rip),%rax
mulsd  (%rax,%rbx,8),%xmm0
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define double @Tween_CircularInOutEasing(double %0) {
%2 = fmul double %0, 2.000000e+00
%3 = fcmp olt double %2, 1.000000e+00
%4 = fadd double %2, -2.000000e+00
%5 = select i1 %3, double %2, double %4
%6 = select i1 %3, i32 -1, i32 1
%7 = select i1 %3, double -5.000000e-01, double 5.000000e-01
%8 = fneg double %5
%9 = tail call double @llvm.fmuladd.f64(double %8, double %5, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = tail call i32 @sqrt(i32 %10)
%12 = add nsw i32 %11, %6
%13 = sitofp i32 %12 to double
%14 = fmul double %7, %13
ret double %14
}