#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 CircularEaseInOut(double p) {
  if (p < 0.5) {
    return 0.5 * (1 - sqrt(1 - 4 * (p * p)));
  } else {
    return 0.5 * (sqrt(-((2 * p) - 3) * ((2 * p) - 1)) + 1);
  }
}


x86 assembly (clang, -O0):
<CircularEaseInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    117e <CircularEaseInOut+0x6e>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe90(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <CircularEaseInOut+0xd4>
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe81(%rip),%xmm1
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe4d(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe25(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CircularEaseInOut>:
push   %rax
movsd  0xee7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1147 <CircularEaseInOut+0x37>
mulsd  %xmm0,%xmm0
mulsd  0xeed(%rip),%xmm0
addsd  0xeed(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
jmp    1177 <CircularEaseInOut+0x67>
addsd  %xmm0,%xmm0
movsd  0xeb5(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  0xed1(%rip),%xmm1
addsd  0xea9(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe7a(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @CircularEaseInOut(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 %16
6: ; preds = %1
%7 = load double, double* %3
%8 = load double, double* %3
%9 = fmul double %7, %8
%10 = call double @llvm.fmuladd.f64(double -4.000000e+00, double %9, double 1.000000e+00)
%11 = fptosi double %10 to i32
%12 = call i32 @sqrt(i32 %11)
%13 = sub nsw i32 1, %12
%14 = sitofp i32 %13 to double
%15 = fmul double 5.000000e-01, %14
store double %15, double* %2
br label %28
16: ; preds = %1
%17 = load double, double* %3
%18 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %17, double -3.000000e+00)
%19 = fneg double %18
%20 = load double, double* %3
%21 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %20, double -1.000000e+00)
%22 = fmul double %19, %21
%23 = fptosi double %22 to i32
%24 = call i32 @sqrt(i32 %23)
%25 = add nsw i32 %24, 1
%26 = sitofp i32 %25 to double
%27 = fmul double 5.000000e-01, %26
store double %27, double* %2
br label %28
28: ; preds = %16, %6
%29 = load double, double* %2
ret double %29
}

LLVM IR (-O2):
define double @CircularEaseInOut(double %0) {
%2 = fcmp olt double %0, 5.000000e-01
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = fmul double %0, %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double -4.000000e+00, double 1.000000e+00)
%6 = fptosi double %5 to i32
%7 = tail call i32 @sqrt(i32 %6)
%8 = sub nsw i32 1, %7
br label %17
9: ; preds = %1
%10 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -3.000000e+00)
%11 = fneg double %10
%12 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
%13 = fmul double %12, %11
%14 = fptosi double %13 to i32
%15 = tail call i32 @sqrt(i32 %14)
%16 = add nsw i32 %15, 1
br label %17
17: ; preds = %9, %3
%18 = phi i32 [ %8, %3 ], [ %16, %9 ]
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 5.000000e-01
ret double %20
}