#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 */
float sqrtf(float);
float circular_ease_in_out(float p) {
  float f = 0.0f;
  if (p < 0.5f) {
    f = 0.5f * (1.0f - sqrtf(1.0f - 4.0f * (p * p)));
  } else {
    f = 0.5f * (sqrtf(-((2.0f * p) - 3.0f) * ((2.0f * p) - 1.0f)) + 1.0f);
  }
  return f;
}


x86 assembly (clang, -O0):
<circular_ease_in_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed3(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1180 <circular_ease_in_out+0x70>
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xec7(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xeaf(%rip),%xmm1
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
movss  0xe9e(%rip),%xmm1
subss  %xmm0,%xmm1
movss  0xe8e(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11e0 <circular_ease_in_out+0xd0>
movss  -0x4(%rbp),%xmm0
addss  %xmm0,%xmm0
movss  0xe7b(%rip),%xmm1
addss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x4(%rbp),%xmm1
addss  %xmm1,%xmm1
movss  0xe55(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xe39(%rip),%xmm0
addss  %xmm0,%xmm1
movss  0xe29(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circular_ease_in_out>:
push   %rax
movss  0xee7(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1143 <circular_ease_in_out+0x33>
mulss  %xmm0,%xmm0
mulss  0xee6(%rip),%xmm0
addss  0xeda(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1174 <circular_ease_in_out+0x64>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    117c <circular_ease_in_out+0x6c>
addss  %xmm0,%xmm0
movss  0xeb5(%rip),%xmm1
addss  %xmm0,%xmm1
xorps  0xec6(%rip),%xmm1
addss  0xea6(%rip),%xmm0
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     118a <circular_ease_in_out+0x7a>
sqrtss %xmm0,%xmm0
jmp    118f <circular_ease_in_out+0x7f>
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xe88(%rip),%xmm0
subss  %xmm1,%xmm0
jmp    1197 <circular_ease_in_out+0x87>
call   1030 <sqrtf@plt>
addss  0xe75(%rip),%xmm0
mulss  0xe61(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @circular_ease_in_out(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 0.000000e+00, float* %3
%4 = load float, float* %2
%5 = fcmp olt float %4, 5.000000e-01
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load float, float* %2
%8 = load float, float* %2
%9 = fmul float %7, %8
%10 = call float @llvm.fmuladd.f32(float -4.000000e+00, float %9, float 1.000000e+00)
%11 = call float @sqrtf(float %10)
%12 = fsub float 1.000000e+00, %11
%13 = fmul float 5.000000e-01, %12
store float %13, float* %3
br label %24
14: ; preds = %1
%15 = load float, float* %2
%16 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %15, float -3.000000e+00)
%17 = fneg float %16
%18 = load float, float* %2
%19 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %18, float -1.000000e+00)
%20 = fmul float %17, %19
%21 = call float @sqrtf(float %20)
%22 = fadd float %21, 1.000000e+00
%23 = fmul float 5.000000e-01, %22
store float %23, float* %3
br label %24
24: ; preds = %14, %6
%25 = load float, float* %3
ret float %25
}

LLVM IR (-O2):
define float @circular_ease_in_out(float %0) {
%2 = fcmp olt float %0, 5.000000e-01
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fmul float %0, %0
%5 = tail call float @llvm.fmuladd.f32(float %4, float -4.000000e+00, float 1.000000e+00)
%6 = tail call float @sqrtf(float %5)
%7 = fsub float 1.000000e+00, %6
br label %15
8: ; preds = %1
%9 = tail call float @llvm.fmuladd.f32(float %0, float 2.000000e+00, float -3.000000e+00)
%10 = fneg float %9
%11 = tail call float @llvm.fmuladd.f32(float %0, float 2.000000e+00, float -1.000000e+00)
%12 = fmul float %11, %10
%13 = tail call float @sqrtf(float %12)
%14 = fadd float %13, 1.000000e+00
br label %15
15: ; preds = %8, %3
%16 = phi float [ %7, %3 ], [ %14, %8 ]
%17 = fmul float %16, 5.000000e-01
ret float %17
}