// File: /workspace/github_cpp_makefile_star2_O3/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: PathBezierToCasteljau(ImVector<ImVec2>*, float, float, float, float, float, float, float, float, float, int)
static void PathBezierToCasteljau(ImVector<ImVec2>* path, 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)) 
    {
        path->push_back(ImVec2(x4, y4));
    }
    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;

        PathBezierToCasteljau(path, x1,y1,        x12,y12,    x123,y123,  x1234,y1234, tess_tol, level+1); 
        PathBezierToCasteljau(path, x1234,y1234,  x234,y234,  x34,y34,    x4,y4,       tess_tol, level+1); 
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %esi, %r14d
movaps %xmm7, %xmm8
movaps %xmm6, %xmm9
movaps %xmm5, %xmm10
movaps %xmm4, %xmm11
movaps %xmm3, %xmm12
movaps %xmm2, %xmm13
movq %rdi, %rbx
movss 0x10(%rbp), %xmm14
cmpl $0xb, %esi
movl $0xa, %r15d
cmovgel %esi, %r15d
negl %r15d
incl %r14d
movss %xmm7, -0x20(%rbp)
movss %xmm6, -0x1c(%rbp)
movaps %xmm9, %xmm2
subss %xmm0, %xmm2
movaps %xmm8, %xmm3
subss %xmm1, %xmm3
movaps %xmm13, %xmm4
subss %xmm9, %xmm4
movaps %xmm12, %xmm5
subss %xmm8, %xmm5
mulss %xmm2, %xmm5
mulss %xmm3, %xmm4
subss %xmm5, %xmm4
movaps %xmm11, %xmm5
subss %xmm9, %xmm5
movaps %xmm10, %xmm6
subss %xmm8, %xmm6
mulss %xmm2, %xmm6
mulss %xmm3, %xmm5
subss %xmm6, %xmm5
movaps %xmm4, %xmm6
movaps 0xe20b(%rip), %xmm15    # 0x3d330
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 %xmm3, %xmm3
mulss %xmm2, %xmm2
addss %xmm3, %xmm2
mulss %xmm14, %xmm2
ucomiss %xmm6, %xmm2
ja 0x2f286
leal (%r15,%r14), %eax
cmpl $0x1, %eax
je 0x2f30a
movaps %xmm0, %xmm2
addss %xmm13, %xmm2
movss 0xe23b(%rip), %xmm6     # 0x3d3cc
mulss %xmm6, %xmm2
movaps %xmm1, %xmm3
addss %xmm12, %xmm3
mulss %xmm6, %xmm3
addss %xmm11, %xmm13
mulss %xmm6, %xmm13
addss %xmm10, %xmm12
mulss %xmm6, %xmm12
addss %xmm9, %xmm11
mulss %xmm6, %xmm11
movss %xmm11, -0x34(%rbp)
addss %xmm8, %xmm10
mulss %xmm6, %xmm10
movss %xmm10, -0x38(%rbp)
movaps %xmm2, %xmm4
addss %xmm13, %xmm4
mulss %xmm6, %xmm4
movaps %xmm3, %xmm5
addss %xmm12, %xmm5
mulss %xmm6, %xmm5
addss %xmm11, %xmm13
mulss %xmm6, %xmm13
movss %xmm13, -0x2c(%rbp)
addss %xmm10, %xmm12
mulss %xmm6, %xmm12
movss %xmm12, -0x30(%rbp)
movaps %xmm4, %xmm7
addss %xmm13, %xmm7
mulss %xmm6, %xmm7
movss %xmm7, -0x28(%rbp)
movaps %xmm5, %xmm10
addss %xmm12, %xmm10
mulss %xmm6, %xmm10
movss %xmm10, -0x24(%rbp)
movss %xmm14, (%rsp)
movq %rbx, %rdi
movaps %xmm7, %xmm6
movaps %xmm10, %xmm7
movl %r14d, %esi
callq 0x2f080
movss 0x10(%rbp), %xmm14
movss -0x2c(%rbp), %xmm13
movss -0x30(%rbp), %xmm12
movss -0x34(%rbp), %xmm11
movss -0x38(%rbp), %xmm10
movss -0x1c(%rbp), %xmm9
movss -0x20(%rbp), %xmm8
incl %r14d
movss -0x28(%rbp), %xmm0
movss -0x24(%rbp), %xmm1
jmp 0x2f0ce
movl (%rbx), %eax
cmpl 0x4(%rbx), %eax
jne 0x2f2a1
leal 0x1(%rax), %ecx
testl %eax, %eax
je 0x2f2a7
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
addl %eax, %edx
jmp 0x2f2ac
movq 0x8(%rbx), %r14
jmp 0x2f2f6
movl $0x8, %edx
cmpl %ecx, %edx
cmovgl %edx, %ecx
movslq %ecx, %r15
leaq (,%r15,8), %rdi
callq 0x8589
movq %rax, %r14
movq 0x8(%rbx), %rsi
movslq (%rbx), %rdx
shlq $0x3, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x8(%rbx), %rdi
callq 0x9019
movq %r14, 0x8(%rbx)
movl %r15d, 0x4(%rbx)
movl (%rbx), %eax
movss -0x20(%rbp), %xmm8
movss -0x1c(%rbp), %xmm9
leal 0x1(%rax), %ecx
movl %ecx, (%rbx)
cltq
movss %xmm9, (%r14,%rax,8)
movss %xmm8, 0x4(%r14,%rax,8)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop