// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movl %edx, %r14d
movss %xmm7, -0x28(%rbp)
movss %xmm6, -0x24(%rbp)
movss %xmm5, -0x30(%rbp)
movss %xmm4, -0x2c(%rbp)
movaps %xmm0, %xmm4
movq %rsi, %rbx
movq %rdi, %r15
movss %xmm4, -0x3c(%rbp)
movss %xmm1, -0x40(%rbp)
movaps %xmm2, %xmm0
subss %xmm4, %xmm0
movaps %xmm3, %xmm4
subss %xmm1, %xmm4
mulss %xmm4, %xmm4
mulss %xmm0, %xmm0
addss %xmm4, %xmm0
ucomiss 0x3035c(%rip), %xmm0    # 0xb7844
movss %xmm3, -0x38(%rbp)
movss %xmm2, -0x34(%rbp)
jb 0x874fa
sqrtss %xmm0, %xmm0
jmp 0x87509
callq 0xc860
movss -0x34(%rbp), %xmm2
movss -0x38(%rbp), %xmm3
movss %xmm0, -0x20(%rbp)
movss -0x2c(%rbp), %xmm0
subss %xmm2, %xmm0
movss -0x30(%rbp), %xmm1
subss %xmm3, %xmm1
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
ucomiss 0x30311(%rip), %xmm0    # 0xb7844
jb 0x8753b
sqrtss %xmm0, %xmm0
jmp 0x87540
callq 0xc860
movss %xmm0, -0x1c(%rbp)
movss -0x24(%rbp), %xmm0
subss -0x2c(%rbp), %xmm0
movss -0x28(%rbp), %xmm1
subss -0x30(%rbp), %xmm1
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
ucomiss 0x302d8(%rip), %xmm0    # 0xb7844
jb 0x87577
xorps %xmm3, %xmm3
sqrtss %xmm0, %xmm3
jmp 0x8757f
callq 0xc860
movaps %xmm0, %xmm3
movss -0x40(%rbp), %xmm1
movss -0x3c(%rbp), %xmm9
movss -0x24(%rbp), %xmm0
subss %xmm9, %xmm0
movss -0x28(%rbp), %xmm2
subss %xmm1, %xmm2
mulss %xmm2, %xmm2
mulss %xmm0, %xmm0
addss %xmm2, %xmm0
ucomiss 0x30294(%rip), %xmm0    # 0xb7844
jb 0x875b8
sqrtss %xmm0, %xmm0
jmp 0x875d2
movss %xmm3, -0x44(%rbp)
callq 0xc860
movss -0x44(%rbp), %xmm3
movss -0x3c(%rbp), %xmm9
movss -0x40(%rbp), %xmm1
movss 0x10(%rbp), %xmm12
cmpl $0x10, %r14d
jg 0x87728
movss -0x20(%rbp), %xmm2
addss -0x1c(%rbp), %xmm2
addss %xmm3, %xmm2
mulss %xmm0, %xmm0
mulss %xmm2, %xmm2
subss %xmm0, %xmm2
ucomiss %xmm12, %xmm2
jbe 0x87705
movaps %xmm9, %xmm2
movss -0x34(%rbp), %xmm10
addss %xmm10, %xmm2
movss 0x2f9e7(%rip), %xmm7    # 0xb7004
mulss %xmm7, %xmm2
movaps %xmm1, %xmm3
movss -0x38(%rbp), %xmm11
addss %xmm11, %xmm3
mulss %xmm7, %xmm3
movss -0x2c(%rbp), %xmm8
addss %xmm8, %xmm10
mulss %xmm7, %xmm10
movss -0x30(%rbp), %xmm0
addss %xmm0, %xmm11
mulss %xmm7, %xmm11
addss -0x24(%rbp), %xmm8
mulss %xmm7, %xmm8
addss -0x28(%rbp), %xmm0
mulss %xmm7, %xmm0
movaps %xmm2, %xmm4
addss %xmm10, %xmm4
mulss %xmm7, %xmm4
movaps %xmm3, %xmm5
addss %xmm11, %xmm5
mulss %xmm7, %xmm5
movss %xmm8, -0x2c(%rbp)
addss %xmm8, %xmm10
mulss %xmm7, %xmm10
movss %xmm10, -0x34(%rbp)
movss %xmm0, -0x30(%rbp)
addss %xmm0, %xmm11
mulss %xmm7, %xmm11
movss %xmm11, -0x38(%rbp)
movaps %xmm4, %xmm0
addss %xmm10, %xmm0
mulss %xmm7, %xmm0
movaps %xmm0, %xmm6
movss %xmm0, -0x20(%rbp)
movaps %xmm5, %xmm0
addss %xmm11, %xmm0
mulss %xmm7, %xmm0
movaps %xmm0, %xmm7
movss %xmm0, -0x1c(%rbp)
incl %r14d
movss %xmm12, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movaps %xmm9, %xmm0
movl %r14d, %edx
callq 0x87490
movss -0x34(%rbp), %xmm2
movss -0x38(%rbp), %xmm3
movss -0x20(%rbp), %xmm4
movss -0x1c(%rbp), %xmm1
jmp 0x874bd
movslq (%rbx), %rax
testq %r15, %r15
je 0x87724
movss -0x24(%rbp), %xmm0
movss %xmm0, (%r15,%rax,8)
movss -0x28(%rbp), %xmm0
movss %xmm0, 0x4(%r15,%rax,8)
incl %eax
movl %eax, (%rbx)
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq