// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x28, %rsp
movl %edx, %r14d
movss %xmm7, -0x30(%rbp)
movss %xmm6, -0x2c(%rbp)
movss %xmm5, -0x28(%rbp)
movss %xmm4, -0x24(%rbp)
movss %xmm3, -0x20(%rbp)
movss %xmm2, -0x1c(%rbp)
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x10, %r14d
jg 0x6eb32
movss -0x2c(%rbp), %xmm8
movaps %xmm8, %xmm2
subss %xmm0, %xmm2
movss -0x30(%rbp), %xmm7
movaps %xmm7, %xmm3
subss %xmm1, %xmm3
mulss %xmm3, %xmm3
mulss %xmm2, %xmm2
addss %xmm3, %xmm2
sqrtss %xmm2, %xmm2
movaps %xmm8, %xmm3
movss -0x24(%rbp), %xmm10
subss %xmm10, %xmm3
movaps %xmm7, %xmm4
movss -0x28(%rbp), %xmm9
subss %xmm9, %xmm4
mulss %xmm4, %xmm4
mulss %xmm3, %xmm3
addss %xmm4, %xmm3
sqrtss %xmm3, %xmm3
movaps %xmm10, %xmm4
movss -0x1c(%rbp), %xmm12
subss %xmm12, %xmm4
movaps %xmm9, %xmm5
movss -0x20(%rbp), %xmm11
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
movss 0x10(%rbp), %xmm14
ucomiss %xmm14, %xmm5
jbe 0x6eb19
movaps %xmm0, %xmm2
addss %xmm12, %xmm2
movss 0x2d5cc(%rip), %xmm13   # 0x9c018
mulss %xmm13, %xmm2
movaps %xmm1, %xmm3
addss %xmm11, %xmm3
mulss %xmm13, %xmm3
addss %xmm10, %xmm12
mulss %xmm13, %xmm12
addss %xmm9, %xmm11
mulss %xmm13, %xmm11
addss %xmm8, %xmm10
mulss %xmm13, %xmm10
addss %xmm7, %xmm9
mulss %xmm13, %xmm9
movaps %xmm2, %xmm4
addss %xmm12, %xmm4
mulss %xmm13, %xmm4
movaps %xmm3, %xmm5
addss %xmm11, %xmm5
mulss %xmm13, %xmm5
movss %xmm10, -0x24(%rbp)
addss %xmm10, %xmm12
mulss %xmm13, %xmm12
movss %xmm9, -0x28(%rbp)
addss %xmm9, %xmm11
mulss %xmm13, %xmm11
movaps %xmm4, %xmm7
movss %xmm12, -0x1c(%rbp)
addss %xmm12, %xmm7
mulss %xmm13, %xmm7
movaps %xmm7, %xmm6
movss %xmm7, -0x38(%rbp)
movaps %xmm5, %xmm7
movss %xmm11, -0x20(%rbp)
addss %xmm11, %xmm7
mulss %xmm13, %xmm7
movss %xmm7, -0x34(%rbp)
incl %r14d
movss %xmm14, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x6e934
movss -0x38(%rbp), %xmm0
movss -0x34(%rbp), %xmm1
jmp 0x6e968
movslq (%rbx), %rax
testq %r15, %r15
je 0x6eb2e
movss %xmm8, (%r15,%rax,8)
movss %xmm7, 0x4(%r15,%rax,8)
incl %eax
movl %eax, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq