// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt_PackFontRangesRenderIntoRects
STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects)
{
   int i,j,k, return_value = 1;

   // save current values
   int old_h_over = spc->h_oversample;
   int old_v_over = spc->v_oversample;

   k = 0;
   for (i=0; i < num_ranges; ++i) {
      float fh = ranges[i].font_size;
      float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh);
      float recip_h,recip_v,sub_x,sub_y;
      spc->h_oversample = ranges[i].h_oversample;
      spc->v_oversample = ranges[i].v_oversample;
      recip_h = 1.0f / spc->h_oversample;
      recip_v = 1.0f / spc->v_oversample;
      sub_x = stbtt__oversample_shift(spc->h_oversample);
      sub_y = stbtt__oversample_shift(spc->v_oversample);
      for (j=0; j < ranges[i].num_chars; ++j) {
         stbrp_rect *r = &rects[k];
         if (r->was_packed && r->w != 0 && r->h != 0) {
            stbtt_packedchar *bc = &ranges[i].chardata_for_range[j];
            int advance, lsb, x0,y0,x1,y1;
            int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];
            int glyph = stbtt_FindGlyphIndex(info, codepoint);
            stbrp_coord pad = (stbrp_coord) spc->padding;

            // pad on left and top
            r->x += pad;
            r->y += pad;
            r->w -= pad;
            r->h -= pad;
            stbtt_GetGlyphHMetrics(info, glyph, &advance, &lsb);
            stbtt_GetGlyphBitmapBox(info, glyph,
                                    scale * spc->h_oversample,
                                    scale * spc->v_oversample,
                                    &x0,&y0,&x1,&y1);
            stbtt_MakeGlyphBitmapSubpixel(info,
                                          spc->pixels + r->x + r->y*spc->stride_in_bytes,
                                          r->w - spc->h_oversample+1,
                                          r->h - spc->v_oversample+1,
                                          spc->stride_in_bytes,
                                          scale * spc->h_oversample,
                                          scale * spc->v_oversample,
                                          0,0,
                                          glyph);

            if (spc->h_oversample > 1)
               stbtt__h_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes,
                                  r->w, r->h, spc->stride_in_bytes,
                                  spc->h_oversample);

            if (spc->v_oversample > 1)
               stbtt__v_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes,
                                  r->w, r->h, spc->stride_in_bytes,
                                  spc->v_oversample);

            bc->x0       = (stbtt_int16)  r->x;
            bc->y0       = (stbtt_int16)  r->y;
            bc->x1       = (stbtt_int16) (r->x + r->w);
            bc->y1       = (stbtt_int16) (r->y + r->h);
            bc->xadvance =                scale * advance;
            bc->xoff     =       (float)  x0 * recip_h + sub_x;
            bc->yoff     =       (float)  y0 * recip_v + sub_y;
            bc->xoff2    =                (x0 + r->w) * recip_h + sub_x;
            bc->yoff2    =                (y0 + r->h) * recip_v + sub_y;
         } else {
            return_value = 0; // if any fail, report failure
         }

         ++k;
      }
   }

   // restore original values
   spc->h_oversample = old_h_over;
   spc->v_oversample = old_v_over;

   return return_value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r8, -0x80(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdi, %r13
movl 0x24(%rdi), %eax
movl %eax, -0x40(%rbp)
movl 0x28(%rdi), %eax
movl %eax, -0x3c(%rbp)
testl %ecx, %ecx
jle 0x758e
movl %ecx, %eax
movq %rax, -0x88(%rbp)
movl $0x1, %eax
xorl %r10d, %r10d
xorl %r11d, %r11d
movq %rdx, -0x78(%rbp)
leaq (%r10,%r10,4), %rcx
movss (%rdx,%rcx,8), %xmm3
ucomiss 0x78e2(%rip), %xmm3     # 0xeab8
jbe 0x721b
movq -0x30(%rbp), %rsi
movq 0x8(%rsi), %r9
movslq 0x24(%rsi), %rsi
movzbl 0x4(%r9,%rsi), %edi
shll $0x8, %edi
movzbl 0x5(%r9,%rsi), %r8d
movswl %di, %edi
orl %r8d, %edi
movzbl 0x6(%r9,%rsi), %r8d
shll $0x8, %r8d
movzbl 0x7(%r9,%rsi), %r9d
movswl %r8w, %esi
orl %r9d, %esi
subl %esi, %edi
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
jmp 0x7241
xorps 0x790e(%rip), %xmm3     # 0xeb30
movq -0x30(%rbp), %rsi
movq 0x8(%rsi), %rdi
movslq 0x1c(%rsi), %rsi
movzwl 0x12(%rdi,%rsi), %esi
rolw $0x8, %si
movzwl %si, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
divss %xmm0, %xmm3
leaq (%rdx,%rcx,8), %r8
movzbl 0x20(%r8), %edi
movl %edi, 0x24(%r13)
movzbl 0x21(%r8), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
movl %ecx, 0x28(%r13)
xorps %xmm1, %xmm1
movss %xmm1, -0x38(%rbp)
movss %xmm1, -0x34(%rbp)
testl %edi, %edi
je 0x7291
movl $0x1, %esi
subl %edi, %esi
xorps %xmm2, %xmm2
cvtsi2ss %esi, %xmm2
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
divss %xmm1, %xmm2
movss %xmm2, -0x34(%rbp)
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
testl %ecx, %ecx
je 0x72ba
movl $0x1, %esi
subl %ecx, %esi
xorps %xmm4, %xmm4
cvtsi2ss %esi, %xmm4
movaps %xmm1, %xmm2
addss %xmm1, %xmm2
divss %xmm2, %xmm4
movss %xmm4, -0x38(%rbp)
cmpl $0x0, 0x10(%r8)
jle 0x757c
movq %r10, -0x90(%rbp)
movss 0x77b8(%rip), %xmm2     # 0xea8c
movaps %xmm2, %xmm4
divss %xmm0, %xmm4
movss %xmm4, -0x4c(%rbp)
divss %xmm1, %xmm2
movss %xmm2, -0x48(%rbp)
movl %r11d, -0x44(%rbp)
movslq %r11d, %rcx
leaq (%rcx,%rcx,2), %rcx
movq -0x80(%rbp), %rdx
leaq (%rdx,%rcx,8), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movaps %xmm3, -0x70(%rbp)
movq %r8, -0x98(%rbp)
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, 0x14(%r14)
je 0x7552
cmpl $0x0, 0xc(%r14)
je 0x7552
cmpl $0x0, 0x10(%r14)
je 0x7552
movq 0x8(%r8), %rax
testq %rax, %rax
movl %ecx, -0x50(%rbp)
je 0x7344
movl (%rax,%r12,4), %esi
jmp 0x734b
movl 0x4(%r8), %esi
addl %r12d, %esi
movq 0x18(%r8), %rax
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x35dc
movl 0x1c(%r13), %ecx
addl %ecx, (%r14)
addl %ecx, 0x4(%r14)
subl %ecx, 0xc(%r14)
subl %ecx, 0x10(%r14)
movq %rbx, %rdi
movl %eax, %esi
movl %eax, %ebx
leaq -0x5c(%rbp), %rdx
leaq -0xac(%rbp), %rcx
callq 0x4595
movl 0x24(%r13), %eax
movl 0x28(%r13), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movaps -0x70(%rbp), %xmm2
mulss %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rcx, %xmm1
mulss %xmm2, %xmm1
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
movq -0x30(%rbp), %rdi
movl %ebx, %esi
leaq -0x58(%rbp), %rdx
leaq -0x54(%rbp), %rcx
leaq -0xa8(%rbp), %r8
leaq -0xa4(%rbp), %r9
callq 0x4f19
movslq (%r14), %rax
addq 0x30(%r13), %rax
movslq 0x4(%r14), %rsi
movslq 0x18(%r13), %r8
imulq %r8, %rsi
addq %rax, %rsi
movl 0x24(%r13), %eax
movl 0x28(%r13), %edi
movl 0xc(%r14), %edx
movl 0x10(%r14), %ecx
subl %eax, %edx
incl %edx
subl %edi, %ecx
incl %ecx
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movaps -0x70(%rbp), %xmm2
mulss %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rdi, %xmm1
mulss %xmm2, %xmm1
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
movq -0x30(%rbp), %rdi
movl %ebx, %r9d
callq 0x63ad
movl 0x24(%r13), %r8d
cmpl $0x2, %r8d
jb 0x7460
movslq (%r14), %rax
addq 0x30(%r13), %rax
movslq 0x4(%r14), %rdi
movslq 0x18(%r13), %rcx
imulq %rcx, %rdi
addq %rax, %rdi
movl 0xc(%r14), %esi
movl 0x10(%r14), %edx
callq 0x6c8b
movl 0x28(%r13), %r8d
cmpl $0x2, %r8d
jb 0x748d
movslq (%r14), %rax
addq 0x30(%r13), %rax
movslq 0x4(%r14), %rdi
movslq 0x18(%r13), %rcx
imulq %rcx, %rdi
addq %rax, %rdi
movl 0xc(%r14), %esi
movl 0x10(%r14), %edx
callq 0x6ee0
movl (%r14), %eax
movq -0xa0(%rbp), %rdi
movw %ax, (%rdi,%r15)
movl 0x4(%r14), %edx
movw %dx, 0x2(%rdi,%r15)
movl 0xc(%r14), %ecx
addl %ecx, %eax
movw %ax, 0x4(%rdi,%r15)
movl 0x10(%r14), %eax
addl %eax, %edx
movw %dx, 0x6(%rdi,%r15)
xorps %xmm0, %xmm0
cvtsi2ssl -0x5c(%rbp), %xmm0
mulss -0x70(%rbp), %xmm0
movss %xmm0, 0x10(%rdi,%r15)
movl -0x58(%rbp), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss -0x4c(%rbp), %xmm4
mulss %xmm4, %xmm0
movss -0x34(%rbp), %xmm3
addss %xmm3, %xmm0
movss %xmm0, 0x8(%rdi,%r15)
movl -0x54(%rbp), %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
movss -0x48(%rbp), %xmm5
mulss %xmm5, %xmm0
movss -0x38(%rbp), %xmm2
addss %xmm2, %xmm0
addl %ecx, %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
movss %xmm0, 0xc(%rdi,%r15)
mulss %xmm4, %xmm1
addss %xmm3, %xmm1
movss %xmm1, 0x14(%rdi,%r15)
addl %eax, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
mulss %xmm5, %xmm0
addss %xmm2, %xmm0
movss %xmm0, 0x18(%rdi,%r15)
movl -0x50(%rbp), %eax
movq -0x98(%rbp), %r8
incq %r12
movslq 0x10(%r8), %rcx
addq $0x18, %r14
addq $0x1c, %r15
cmpq %rcx, %r12
jl 0x730d
movl -0x44(%rbp), %r11d
addl %r12d, %r11d
movq -0x78(%rbp), %rdx
movq -0x90(%rbp), %r10
incq %r10
cmpq -0x88(%rbp), %r10
jne 0x71c6
jmp 0x7593
movl $0x1, %eax
movl -0x40(%rbp), %ecx
movl %ecx, 0x24(%r13)
movl -0x3c(%rbp), %ecx
movl %ecx, 0x28(%r13)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq