// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imstb_truetype.h
// Function: stbtt__tesselate_cubic(stbtt__point*, int*, float, float, float, float, float, float, float, float, float, int)
static void stbtt__tesselate_cubic(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float objspace_flatness_squared, int n)
{
   // @TODO this "flatness" calculation is just made-up nonsense that seems to work well enough
   float dx0 = x1-x0;
   float dy0 = y1-y0;
   float dx1 = x2-x1;
   float dy1 = y2-y1;
   float dx2 = x3-x2;
   float dy2 = y3-y2;
   float dx = x3-x0;
   float dy = y3-y0;
   float longlen = (float) (STBTT_sqrt(dx0*dx0+dy0*dy0)+STBTT_sqrt(dx1*dx1+dy1*dy1)+STBTT_sqrt(dx2*dx2+dy2*dy2));
   float shortlen = (float) STBTT_sqrt(dx*dx+dy*dy);
   float flatness_squared = longlen*longlen-shortlen*shortlen;

   if (n > 16) // 65536 segments on one curve better be enough!
      return;

   if (flatness_squared > objspace_flatness_squared) {
      float x01 = (x0+x1)/2;
      float y01 = (y0+y1)/2;
      float x12 = (x1+x2)/2;
      float y12 = (y1+y2)/2;
      float x23 = (x2+x3)/2;
      float y23 = (y2+y3)/2;

      float xa = (x01+x12)/2;
      float ya = (y01+y12)/2;
      float xb = (x12+x23)/2;
      float yb = (y12+y23)/2;

      float mx = (xa+xb)/2;
      float my = (ya+yb)/2;

      stbtt__tesselate_cubic(points, num_points, x0,y0, x01,y01, xa,ya, mx,my, objspace_flatness_squared,n+1);
      stbtt__tesselate_cubic(points, num_points, mx,my, xb,yb, x23,y23, x3,y3, objspace_flatness_squared,n+1);
   } else {
      stbtt__add_point(points, *num_points,x3,y3);
      *num_points = *num_points+1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x12, %edx
movl $0x11, %r12d
cmovgel %edx, %r12d
cmpl $0x10, %edx
jg 0x85a28
movl %edx, %r15d
movaps %xmm6, %xmm8
movaps %xmm5, %xmm9
movaps %xmm4, %xmm10
movaps %xmm3, %xmm11
movaps %xmm2, %xmm12
movq %rsi, %rbx
movq %rdi, %r14
movss 0x10(%rbp), %xmm13
negl %r12d
incl %r15d
movss %xmm7, -0x28(%rbp)
movss %xmm6, -0x24(%rbp)
movaps %xmm8, %xmm2
subss %xmm0, %xmm2
movaps %xmm7, %xmm3
subss %xmm1, %xmm3
mulss %xmm3, %xmm3
mulss %xmm2, %xmm2
addss %xmm3, %xmm2
sqrtss %xmm2, %xmm2
movaps %xmm8, %xmm3
subss %xmm10, %xmm3
movaps %xmm7, %xmm4
subss %xmm9, %xmm4
mulss %xmm4, %xmm4
mulss %xmm3, %xmm3
addss %xmm4, %xmm3
sqrtss %xmm3, %xmm3
movaps %xmm10, %xmm4
subss %xmm12, %xmm4
movaps %xmm9, %xmm5
subss %xmm11, %xmm5
mulss %xmm5, %xmm5
mulss %xmm4, %xmm4
addss %xmm5, %xmm4
sqrtss %xmm4, %xmm4
movaps %xmm12, %xmm5
subss %xmm0, %xmm5
movaps %xmm11, %xmm6
subss %xmm1, %xmm6
mulss %xmm6, %xmm6
mulss %xmm5, %xmm5
addss %xmm6, %xmm5
sqrtss %xmm5, %xmm5
addss %xmm4, %xmm5
addss %xmm3, %xmm5
mulss %xmm2, %xmm2
mulss %xmm5, %xmm5
subss %xmm2, %xmm5
ucomiss %xmm13, %xmm5
jbe 0x85a0f
movaps %xmm0, %xmm2
addss %xmm12, %xmm2
movss 0x2f701(%rip), %xmm6    # 0xb5004
mulss %xmm6, %xmm2
movaps %xmm1, %xmm3
addss %xmm11, %xmm3
mulss %xmm6, %xmm3
addss %xmm10, %xmm12
mulss %xmm6, %xmm12
addss %xmm9, %xmm11
mulss %xmm6, %xmm11
addss %xmm8, %xmm10
mulss %xmm6, %xmm10
movss %xmm10, -0x3c(%rbp)
addss %xmm7, %xmm9
mulss %xmm6, %xmm9
movss %xmm9, -0x40(%rbp)
movaps %xmm2, %xmm4
addss %xmm12, %xmm4
mulss %xmm6, %xmm4
movaps %xmm3, %xmm5
addss %xmm11, %xmm5
mulss %xmm6, %xmm5
addss %xmm10, %xmm12
mulss %xmm6, %xmm12
movss %xmm12, -0x34(%rbp)
addss %xmm9, %xmm11
mulss %xmm6, %xmm11
movss %xmm11, -0x38(%rbp)
movaps %xmm4, %xmm9
addss %xmm12, %xmm9
mulss %xmm6, %xmm9
movss %xmm9, -0x30(%rbp)
movaps %xmm5, %xmm10
addss %xmm11, %xmm10
mulss %xmm6, %xmm10
movss %xmm10, -0x2c(%rbp)
movss %xmm13, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movaps %xmm9, %xmm6
movaps %xmm10, %xmm7
movl %r15d, %edx
callq 0x857fb
movss 0x10(%rbp), %xmm13
movss -0x34(%rbp), %xmm12
movss -0x38(%rbp), %xmm11
movss -0x3c(%rbp), %xmm10
movss -0x40(%rbp), %xmm9
movss -0x24(%rbp), %xmm8
movss -0x28(%rbp), %xmm7
leal (%r12,%r15), %eax
incl %eax
movl %r15d, %ecx
incl %ecx
movl %ecx, %r15d
movss -0x2c(%rbp), %xmm1
movss -0x30(%rbp), %xmm0
cmpl $0x1, %eax
jne 0x85853
jmp 0x85a28
movslq (%rbx), %rax
testq %r14, %r14
je 0x85a24
movss %xmm8, (%r14,%rax,8)
movss %xmm7, 0x4(%r14,%rax,8)
incl %eax
movl %eax, (%rbx)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq