// File: 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
subq $0xc0, %rsp
movss 0x10(%rbp), %xmm8
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movss %xmm0, -0x24(%rbp)
movss %xmm1, -0x28(%rbp)
movss %xmm2, -0x2c(%rbp)
movss %xmm3, -0x30(%rbp)
movss %xmm4, -0x34(%rbp)
movss %xmm5, -0x38(%rbp)
movss %xmm6, -0x3c(%rbp)
movss %xmm7, -0x40(%rbp)
movl %r8d, -0x44(%rbp)
movss -0x3c(%rbp), %xmm0
subss -0x24(%rbp), %xmm0
movss %xmm0, -0x48(%rbp)
movss -0x40(%rbp), %xmm0
subss -0x28(%rbp), %xmm0
movss %xmm0, -0x4c(%rbp)
movss -0x2c(%rbp), %xmm0
subss -0x3c(%rbp), %xmm0
movss -0x4c(%rbp), %xmm2
movss -0x30(%rbp), %xmm1
subss -0x40(%rbp), %xmm1
mulss -0x48(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x50(%rbp)
movss -0x34(%rbp), %xmm0
subss -0x3c(%rbp), %xmm0
movss -0x4c(%rbp), %xmm2
movss -0x38(%rbp), %xmm1
subss -0x40(%rbp), %xmm1
mulss -0x48(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xc3e27
movss -0x50(%rbp), %xmm0
movss %xmm0, -0xa4(%rbp)
jmp 0xc3e41
movss -0x50(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0xa4(%rbp)
movss -0xa4(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
movss -0x54(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xc3e6a
movss -0x54(%rbp), %xmm0
movss %xmm0, -0xa8(%rbp)
jmp 0xc3e84
movss -0x54(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0xa8(%rbp)
movss -0xa8(%rbp), %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x50(%rbp), %xmm1
addss -0x54(%rbp), %xmm1
movss -0x50(%rbp), %xmm0
addss -0x54(%rbp), %xmm0
mulss %xmm0, %xmm1
movss 0x10(%rbp), %xmm0
movss -0x48(%rbp), %xmm2
movss -0x48(%rbp), %xmm4
movss -0x4c(%rbp), %xmm3
mulss -0x4c(%rbp), %xmm3
mulss %xmm4, %xmm2
addss %xmm3, %xmm2
mulss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0xc3f64
movss -0x3c(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
leaq -0x5c(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0xbf4c0
movq -0xb0(%rbp), %rsi
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rdx
callq 0xc3ac0
movlpd %xmm0, -0x64(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0xc3c00
movlpd %xmm0, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xc3bc0
movss %xmm0, -0x68(%rbp)
movss -0x68(%rbp), %xmm1
movq -0x20(%rbp), %rax
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xc3f54
movq -0x10(%rbp), %rax
movq -0x64(%rbp), %rcx
movq %rcx, (%rax)
movss -0x68(%rbp), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, (%rax)
movq -0x18(%rbp), %rax
movq -0x5c(%rbp), %rcx
movq %rcx, (%rax)
jmp 0xc419e
cmpl $0xa, -0x44(%rbp)
jge 0xc419c
movss -0x24(%rbp), %xmm0
addss -0x2c(%rbp), %xmm0
movss 0xae058(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x74(%rbp)
movss -0x28(%rbp), %xmm0
addss -0x30(%rbp), %xmm0
movss 0xae03d(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x78(%rbp)
movss -0x2c(%rbp), %xmm0
addss -0x34(%rbp), %xmm0
movss 0xae022(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x7c(%rbp)
movss -0x30(%rbp), %xmm0
addss -0x38(%rbp), %xmm0
movss 0xae007(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x80(%rbp)
movss -0x34(%rbp), %xmm0
addss -0x3c(%rbp), %xmm0
movss 0xadfec(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x84(%rbp)
movss -0x38(%rbp), %xmm0
addss -0x40(%rbp), %xmm0
movss 0xadfce(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x88(%rbp)
movss -0x74(%rbp), %xmm0
addss -0x7c(%rbp), %xmm0
movss 0xadfb0(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x8c(%rbp)
movss -0x78(%rbp), %xmm0
addss -0x80(%rbp), %xmm0
movss 0xadf92(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x90(%rbp)
movss -0x7c(%rbp), %xmm0
addss -0x84(%rbp), %xmm0
movss 0xadf71(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x94(%rbp)
movss -0x80(%rbp), %xmm0
addss -0x88(%rbp), %xmm0
movss 0xadf50(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x98(%rbp)
movss -0x8c(%rbp), %xmm0
addss -0x94(%rbp), %xmm0
movss 0xadf2c(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x9c(%rbp)
movss -0x90(%rbp), %xmm0
addss -0x98(%rbp), %xmm0
movss 0xadf08(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movss -0x24(%rbp), %xmm0
movss -0x28(%rbp), %xmm1
movss -0x74(%rbp), %xmm2
movss -0x78(%rbp), %xmm3
movss -0x8c(%rbp), %xmm4
movss -0x90(%rbp), %xmm5
movss -0x9c(%rbp), %xmm6
movss -0xa0(%rbp), %xmm7
movss 0x10(%rbp), %xmm8
movl -0x44(%rbp), %r8d
addl $0x1, %r8d
movss %xmm8, (%rsp)
callq 0xc3d30
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movss -0x9c(%rbp), %xmm0
movss -0xa0(%rbp), %xmm1
movss -0x94(%rbp), %xmm2
movss -0x98(%rbp), %xmm3
movss -0x84(%rbp), %xmm4
movss -0x88(%rbp), %xmm5
movss -0x3c(%rbp), %xmm6
movss -0x40(%rbp), %xmm7
movss 0x10(%rbp), %xmm8
movl -0x44(%rbp), %r8d
addl $0x1, %r8d
movss %xmm8, (%rsp)
callq 0xc3d30
jmp 0xc419e
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)