// File: /workspace/github_c_makefile_star2_O0/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt_FlattenCurves
static stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata)
{
   stbtt__point *points=0;
   int num_points=0;

   float objspace_flatness_squared = objspace_flatness * objspace_flatness;
   int i,n=0,start=0, pass;

   // count how many "moves" there are to get the contour count
   for (i=0; i < num_verts; ++i)
      if (vertices[i].type == STBTT_vmove)
         ++n;

   *num_contours = n;
   if (n == 0) return 0;

   *contour_lengths = (int *) STBTT_malloc(sizeof(**contour_lengths) * n, userdata);

   if (*contour_lengths == 0) {
      *num_contours = 0;
      return 0;
   }

   // make two passes through the points so we don't need to realloc
   for (pass=0; pass < 2; ++pass) {
      float x=0,y=0;
      if (pass == 1) {
         points = (stbtt__point *) STBTT_malloc(num_points * sizeof(points[0]), userdata);
         if (points == NULL) goto error;
      }
      num_points = 0;
      n= -1;
      for (i=0; i < num_verts; ++i) {
         switch (vertices[i].type) {
            case STBTT_vmove:
               // start the next contour
               if (n >= 0)
                  (*contour_lengths)[n] = num_points - start;
               ++n;
               start = num_points;

               x = vertices[i].x, y = vertices[i].y;
               stbtt__add_point(points, num_points++, x,y);
               break;
            case STBTT_vline:
               x = vertices[i].x, y = vertices[i].y;
               stbtt__add_point(points, num_points++, x, y);
               break;
            case STBTT_vcurve:
               stbtt__tesselate_curve(points, &num_points, x,y,
                                        vertices[i].cx, vertices[i].cy,
                                        vertices[i].x,  vertices[i].y,
                                        objspace_flatness_squared, 0);
               x = vertices[i].x, y = vertices[i].y;
               break;
            case STBTT_vcubic:
               stbtt__tesselate_cubic(points, &num_points, x,y,
                                        vertices[i].cx, vertices[i].cy,
                                        vertices[i].cx1, vertices[i].cy1,
                                        vertices[i].x,  vertices[i].y,
                                        objspace_flatness_squared, 0);
               x = vertices[i].x, y = vertices[i].y;
               break;
         }
      }
      (*contour_lengths)[n] = num_points - start;
   }

   return points;
error:
   STBTT_free(points, userdata);
   STBTT_free(*contour_lengths, userdata);
   *contour_lengths = 0;
   *num_contours = 0;
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movss %xmm0, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movss -0x18(%rbp), %xmm0
mulss -0x18(%rbp), %xmm0
movss %xmm0, -0x40(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x7169
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
imulq $0xe, %rcx, %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
cmpl $0x1, %eax
jne 0x715c
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x715e
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x7133
movl -0x48(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x48(%rbp)
jne 0x7185
movq $0x0, -0x8(%rbp)
jmp 0x751f
movslq -0x48(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x71bd
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x751f
movl $0x0, -0x50(%rbp)
cmpl $0x2, -0x50(%rbp)
jge 0x74e3
xorps %xmm0, %xmm0
movss %xmm0, -0x54(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x58(%rbp)
cmpl $0x1, -0x50(%rbp)
jne 0x7203
movslq -0x3c(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1140
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x7201
jmp 0x74ed
jmp 0x7203
movl $0x0, -0x3c(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x74c1
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movzbl 0xc(%rax,%rcx), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x3, %eax
ja 0x74b1
movq -0x60(%rbp), %rax
leaq 0xdde6(%rip), %rcx      # 0x15040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x48(%rbp)
jl 0x727d
movl -0x3c(%rbp), %edx
subl -0x4c(%rbp), %edx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
incl %eax
movl %eax, -0x48(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl (%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl 0x2(%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movss -0x54(%rbp), %xmm0
movss -0x58(%rbp), %xmm1
callq 0x11260
jmp 0x74b1
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl (%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl 0x2(%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movss -0x54(%rbp), %xmm0
movss -0x58(%rbp), %xmm1
callq 0x11260
jmp 0x74b1
movq -0x38(%rbp), %rdi
movss -0x54(%rbp), %xmm0
movss -0x58(%rbp), %xmm1
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl 0x4(%rax,%rcx), %edx
cvtsi2ss %edx, %xmm2
movswl 0x6(%rax,%rcx), %edx
cvtsi2ss %edx, %xmm3
movswl (%rax,%rcx), %edx
cvtsi2ss %edx, %xmm4
movswl 0x2(%rax,%rcx), %eax
cvtsi2ss %eax, %xmm5
movss -0x40(%rbp), %xmm6
leaq -0x3c(%rbp), %rsi
xorl %edx, %edx
callq 0x112b0
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl (%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl 0x2(%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x58(%rbp)
jmp 0x74b1
movq -0x38(%rbp), %rdi
movss -0x54(%rbp), %xmm0
movss -0x58(%rbp), %xmm1
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl 0x4(%rax,%rcx), %edx
cvtsi2ss %edx, %xmm2
movswl 0x6(%rax,%rcx), %edx
cvtsi2ss %edx, %xmm3
movswl 0x8(%rax,%rcx), %edx
cvtsi2ss %edx, %xmm4
movswl 0xa(%rax,%rcx), %edx
cvtsi2ss %edx, %xmm5
movswl (%rax,%rcx), %edx
cvtsi2ss %edx, %xmm6
movswl 0x2(%rax,%rcx), %eax
cvtsi2ss %eax, %xmm7
movss -0x40(%rbp), %xmm8
movq %rsp, %rax
movss %xmm8, (%rax)
leaq -0x3c(%rbp), %rsi
xorl %edx, %edx
callq 0x114a0
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl (%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rcx, %rdx
addq %rdx, %rdx
shlq $0x4, %rcx
subq %rdx, %rcx
movswl 0x2(%rax,%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x58(%rbp)
jmp 0x74b3
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x7218
movl -0x3c(%rbp), %edx
subl -0x4c(%rbp), %edx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x71c4
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x751f
movq -0x38(%rbp), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)