// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImBezierCubicClosestPointCasteljauStep(ImVec2 const&, ImVec2&, ImVec2&, float&, float, float, float, float, float, float, float, float, float, int)
static void ImBezierCubicClosestPointCasteljauStep(const ImVec2& p, ImVec2& p_closest, ImVec2& p_last, float& p_closest_dist2, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)
{
    float dx = x4 - x1;
    float dy = y4 - y1;
    float d2 = ((x2 - x4) * dy - (y2 - y4) * dx);
    float d3 = ((x3 - x4) * dy - (y3 - y4) * dx);
    d2 = (d2 >= 0) ? d2 : -d2;
    d3 = (d3 >= 0) ? d3 : -d3;
    if ((d2 + d3) * (d2 + d3) < tess_tol * (dx * dx + dy * dy))
    {
        ImVec2 p_current(x4, y4);
        ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);
        float dist2 = ImLengthSqr(p - p_line);
        if (dist2 < p_closest_dist2)
        {
            p_closest = p_line;
            p_closest_dist2 = dist2;
        }
        p_last = p_current;
    }
    else if (level < 10)
    {
        float x12 = (x1 + x2)*0.5f,       y12 = (y1 + y2)*0.5f;
        float x23 = (x2 + x3)*0.5f,       y23 = (y2 + y3)*0.5f;
        float x34 = (x3 + x4)*0.5f,       y34 = (y3 + y4)*0.5f;
        float x123 = (x12 + x23)*0.5f,    y123 = (y12 + y23)*0.5f;
        float x234 = (x23 + x34)*0.5f,    y234 = (y23 + y34)*0.5f;
        float x1234 = (x123 + x234)*0.5f, y1234 = (y123 + y234)*0.5f;
        ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);
        ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movaps %xmm7, %xmm10
movaps %xmm6, %xmm11
movaps %xmm5, %xmm12
movaps %xmm4, %xmm13
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movss %xmm1, -0x2c(%rbp)
movss %xmm0, -0x30(%rbp)
movss 0x20(%rbp), %xmm14
movss 0x18(%rbp), %xmm8
movss 0x10(%rbp), %xmm9
cmpl $0xb, %ecx
movl $0xa, %r13d
cmovgel %ecx, %r13d
negl %r13d
incl %r12d
movaps %xmm9, %xmm0
subss %xmm2, %xmm0
movaps %xmm8, %xmm1
subss %xmm3, %xmm1
movaps %xmm13, %xmm4
subss %xmm9, %xmm4
movaps %xmm12, %xmm5
subss %xmm8, %xmm5
mulss %xmm0, %xmm5
mulss %xmm1, %xmm4
subss %xmm5, %xmm4
movaps %xmm11, %xmm5
subss %xmm9, %xmm5
movaps %xmm10, %xmm6
subss %xmm8, %xmm6
mulss %xmm0, %xmm6
mulss %xmm1, %xmm5
subss %xmm6, %xmm5
movaps %xmm4, %xmm6
movaps 0x73a94(%rip), %xmm15   # 0xb4fc0
xorps %xmm15, %xmm6
movaps %xmm6, %xmm7
cmpless %xmm4, %xmm7
andps %xmm7, %xmm4
andnps %xmm6, %xmm7
orps %xmm4, %xmm7
movaps %xmm5, %xmm4
xorps %xmm15, %xmm4
movaps %xmm4, %xmm6
cmpless %xmm5, %xmm6
andps %xmm6, %xmm5
andnps %xmm4, %xmm6
orps %xmm5, %xmm6
addss %xmm7, %xmm6
mulss %xmm6, %xmm6
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
mulss %xmm14, %xmm0
ucomiss %xmm6, %xmm0
ja 0x416a3
leal (%r12,%r13), %eax
cmpl $0x1, %eax
je 0x41767
movaps %xmm2, %xmm4
addss %xmm13, %xmm4
movss 0x73a6c(%rip), %xmm0    # 0xb5004
mulss %xmm0, %xmm4
movaps %xmm3, %xmm5
addss %xmm12, %xmm5
mulss %xmm0, %xmm5
addss %xmm11, %xmm13
mulss %xmm0, %xmm13
addss %xmm10, %xmm12
mulss %xmm0, %xmm12
addss %xmm9, %xmm11
mulss %xmm0, %xmm11
movss %xmm11, -0x44(%rbp)
addss %xmm8, %xmm10
mulss %xmm0, %xmm10
movss %xmm10, -0x48(%rbp)
movaps %xmm4, %xmm6
addss %xmm13, %xmm6
mulss %xmm0, %xmm6
movaps %xmm5, %xmm7
addss %xmm12, %xmm7
mulss %xmm0, %xmm7
addss %xmm11, %xmm13
mulss %xmm0, %xmm13
movss %xmm13, -0x3c(%rbp)
addss %xmm10, %xmm12
mulss %xmm0, %xmm12
movss %xmm12, -0x40(%rbp)
movaps %xmm6, %xmm1
addss %xmm13, %xmm1
mulss %xmm0, %xmm1
movss %xmm1, -0x34(%rbp)
movaps %xmm7, %xmm8
addss %xmm12, %xmm8
mulss %xmm0, %xmm8
movss %xmm8, -0x38(%rbp)
movss %xmm14, 0x10(%rsp)
movss %xmm8, 0x8(%rsp)
movss %xmm1, (%rsp)
movss -0x30(%rbp), %xmm0
movss -0x2c(%rbp), %xmm1
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl %r12d, %ecx
callq 0x41479
movss 0x20(%rbp), %xmm14
movss -0x3c(%rbp), %xmm13
movss -0x40(%rbp), %xmm12
movss -0x44(%rbp), %xmm11
movss -0x48(%rbp), %xmm10
movss 0x10(%rbp), %xmm9
movss 0x18(%rbp), %xmm8
incl %r12d
movss -0x34(%rbp), %xmm2
movss -0x38(%rbp), %xmm3
jmp 0x414d5
movaps %xmm9, %xmm0
unpcklps %xmm8, %xmm0            # xmm0 = xmm0[0],xmm8[0],xmm0[1],xmm8[1]
movss (%rbx), %xmm1
movss 0x4(%rbx), %xmm2
movss -0x30(%rbp), %xmm6
movaps %xmm6, %xmm3
subss %xmm1, %xmm3
movss -0x2c(%rbp), %xmm4
subss %xmm2, %xmm4
subss %xmm1, %xmm9
subss %xmm2, %xmm8
mulss %xmm8, %xmm4
mulss %xmm9, %xmm3
addss %xmm4, %xmm3
xorps %xmm4, %xmm4
ucomiss %xmm3, %xmm4
jbe 0x416ef
movsd (%rbx), %xmm4
jmp 0x41731
movaps %xmm8, %xmm4
mulss %xmm8, %xmm4
movaps %xmm9, %xmm5
mulss %xmm9, %xmm5
addss %xmm4, %xmm5
ucomiss %xmm5, %xmm3
movaps %xmm0, %xmm4
ja 0x41731
mulss %xmm3, %xmm9
mulss %xmm3, %xmm8
divss %xmm5, %xmm9
divss %xmm5, %xmm8
addss %xmm9, %xmm1
addss %xmm8, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movaps %xmm1, %xmm4
movaps %xmm4, %xmm1
shufps $0x55, %xmm4, %xmm1     # xmm1 = xmm1[1,1],xmm4[1,1]
subss %xmm4, %xmm6
movss -0x2c(%rbp), %xmm2
subss %xmm1, %xmm2
mulss %xmm2, %xmm2
mulss %xmm6, %xmm6
addss %xmm2, %xmm6
movss (%r14), %xmm1
ucomiss %xmm6, %xmm1
jbe 0x41764
movlps %xmm4, (%r15)
movss %xmm6, (%r14)
movlps %xmm0, (%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq