// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__tesselate_cubic
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 $0x48, %rsp
movl %edx, %r14d
movss %xmm7, -0x20(%rbp)
movss %xmm6, -0x1c(%rbp)
movss %xmm5, -0x28(%rbp)
movss %xmm4, -0x24(%rbp)
movq %rsi, %rbx
movq %rdi, %r15
movss %xmm0, -0x34(%rbp)
movss %xmm1, -0x38(%rbp)
movaps %xmm2, %xmm5
subss %xmm0, %xmm5
movaps %xmm3, %xmm4
subss %xmm1, %xmm4
mulss %xmm4, %xmm4
mulss %xmm5, %xmm5
addss %xmm4, %xmm5
xorps %xmm0, %xmm0
cvtss2sd %xmm5, %xmm0
ucomisd 0x26eb(%rip), %xmm0     # 0xeb78
movss %xmm3, -0x30(%rbp)
movss %xmm2, -0x2c(%rbp)
jb 0xc49f
sqrtsd %xmm0, %xmm0
jmp 0xc4ae
callq 0x1210
movss -0x2c(%rbp), %xmm2
movss -0x30(%rbp), %xmm3
movsd %xmm0, -0x48(%rbp)
movss -0x24(%rbp), %xmm0
subss %xmm2, %xmm0
movss -0x28(%rbp), %xmm1
subss %xmm3, %xmm1
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x269b(%rip), %xmm0     # 0xeb78
jb 0xc4e5
sqrtsd %xmm0, %xmm0
jmp 0xc4ea
callq 0x1210
movsd %xmm0, -0x40(%rbp)
movss -0x1c(%rbp), %xmm0
subss -0x24(%rbp), %xmm0
movss -0x20(%rbp), %xmm1
subss -0x28(%rbp), %xmm1
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x265d(%rip), %xmm0     # 0xeb78
jb 0xc526
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
jmp 0xc52f
callq 0x1210
movapd %xmm0, %xmm3
movss -0x38(%rbp), %xmm1
movss -0x34(%rbp), %xmm9
movss -0x1c(%rbp), %xmm0
subss %xmm9, %xmm0
movss -0x20(%rbp), %xmm2
subss %xmm1, %xmm2
mulss %xmm2, %xmm2
mulss %xmm0, %xmm0
addss %xmm2, %xmm0
ucomiss 0x2558(%rip), %xmm0     # 0xeab8
jb 0xc568
sqrtss %xmm0, %xmm0
jmp 0xc582
movsd %xmm3, -0x50(%rbp)
callq 0x1160
movsd -0x50(%rbp), %xmm3
movss -0x34(%rbp), %xmm9
movss -0x38(%rbp), %xmm1
movss 0x10(%rbp), %xmm12
cmpl $0x10, %r14d
jg 0xc6dc
movsd -0x48(%rbp), %xmm2
addsd -0x40(%rbp), %xmm2
addsd %xmm3, %xmm2
cvtsd2ss %xmm2, %xmm2
mulss %xmm0, %xmm0
mulss %xmm2, %xmm2
subss %xmm0, %xmm2
ucomiss %xmm12, %xmm2
jbe 0xc6b9
movaps %xmm9, %xmm2
movss -0x2c(%rbp), %xmm10
addss %xmm10, %xmm2
movss 0x24d7(%rip), %xmm7     # 0xeaa8
mulss %xmm7, %xmm2
movaps %xmm1, %xmm3
movss -0x30(%rbp), %xmm11
addss %xmm11, %xmm3
mulss %xmm7, %xmm3
movss -0x24(%rbp), %xmm8
addss %xmm8, %xmm10
mulss %xmm7, %xmm10
movss -0x28(%rbp), %xmm0
addss %xmm0, %xmm11
mulss %xmm7, %xmm11
addss -0x1c(%rbp), %xmm8
mulss %xmm7, %xmm8
addss -0x20(%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, -0x24(%rbp)
addss %xmm8, %xmm10
mulss %xmm7, %xmm10
movss %xmm10, -0x2c(%rbp)
movss %xmm0, -0x28(%rbp)
addss %xmm0, %xmm11
mulss %xmm7, %xmm11
movss %xmm11, -0x30(%rbp)
movaps %xmm4, %xmm0
addss %xmm10, %xmm0
mulss %xmm7, %xmm0
movaps %xmm0, %xmm6
movss %xmm0, -0x48(%rbp)
movaps %xmm5, %xmm0
addss %xmm11, %xmm0
mulss %xmm7, %xmm0
movaps %xmm0, %xmm7
movss %xmm0, -0x40(%rbp)
incl %r14d
movss %xmm12, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movaps %xmm9, %xmm0
movl %r14d, %edx
callq 0xc430
movss -0x2c(%rbp), %xmm2
movss -0x30(%rbp), %xmm3
movss -0x48(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
jmp 0xc45a
movslq (%rbx), %rax
testq %r15, %r15
je 0xc6d8
movss -0x1c(%rbp), %xmm0
movss %xmm0, (%r15,%rax,8)
movss -0x20(%rbp), %xmm0
movss %xmm0, 0x4(%r15,%rax,8)
incl %eax
movl %eax, (%rbx)
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq