// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonnuklear/src/./nuklear/nuklear.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, missing_glyph = -1, 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;

            if (glyph == 0)
               missing_glyph = j;
         } else if (spc->skip_missing) {
            return_value = 0;
         } else if (r->was_packed && r->w == 0 && r->h == 0 && missing_glyph >= 0) {
            ranges[i].chardata_for_range[j] = ranges[i].chardata_for_range[missing_glyph];
         } 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, (%rsp)
movq %rdi, %rbx
movsd 0x24(%rdi), %xmm0
movaps %xmm0, 0x90(%rsp)
testl %ecx, %ecx
jle 0x30eb4
movl %ecx, %eax
movq %rax, 0x58(%rsp)
addq $0x4, %r8
movl $0x1, %eax
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
xorl %r14d, %r14d
xorl %ebp, %ebp
movq %rbx, 0x68(%rsp)
movq %r8, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq (%rsp), %r13
leaq (%r14,%r14,4), %r10
movss (%rdx,%r10,8), %xmm3
ucomiss 0x3de2a(%rip), %xmm3    # 0x6e8f0
jbe 0x30b07
movq (%rsp), %rsi
movq 0x8(%rsi), %rcx
movslq 0x24(%rsi), %r9
movzbl 0x4(%rcx,%r9), %esi
shll $0x8, %esi
movzbl 0x5(%rcx,%r9), %edi
movswl %si, %esi
orl %edi, %esi
movzbl 0x6(%rcx,%r9), %edi
shll $0x8, %edi
movzbl 0x7(%rcx,%r9), %ecx
movswl %di, %edi
orl %ecx, %edi
subl %edi, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
jmp 0x30b2d
xorps 0x3da62(%rip), %xmm3    # 0x6e570
movq (%rsp), %rsi
movq 0x8(%rsi), %rcx
movslq 0x1c(%rsi), %rsi
movzwl 0x12(%rcx,%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
divss %xmm0, %xmm3
leaq (%rdx,%r10,8), %r10
movq 0x20(%r10), %r9
movl %r9d, %edi
movl $0xff, %esi
andl %esi, %edi
movl %edi, 0x24(%rbx)
movl %r9d, %ecx
shrl $0x8, %ecx
andl %esi, %ecx
movl %ecx, 0x28(%rbx)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x20(%rsp)
testb %r9b, %r9b
je 0x30b83
movl $0x1, %esi
subl %edi, %esi
xorps %xmm2, %xmm2
cvtsi2ss %esi, %xmm2
xorps %xmm1, %xmm1
cvtsi2ss %edi, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm2
movaps %xmm2, 0x20(%rsp)
testl %ecx, %ecx
je 0x30ba4
movl $0x1, %esi
subl %ecx, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
cmpl $0x0, 0x10(%r10)
jle 0x30ea4
movq %r14, 0x60(%rsp)
movq %r9, %xmm1
xorps %xmm2, %xmm2
punpcklbw %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
cvtdq2ps %xmm1, %xmm1
movaps 0x3da12(%rip), %xmm2    # 0x6e5e0
divps %xmm1, %xmm2
movaps %xmm2, 0xa0(%rsp)
movl %ebp, 0x8(%rsp)
movslq %ebp, %rcx
movaps 0x20(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, 0x20(%rsp)
leaq (%rcx,%rcx,2), %rcx
leaq (%r8,%rcx,8), %r14
xorl %r12d, %r12d
xorl %ebp, %ebp
movaps %xmm3, 0x30(%rsp)
movq %r10, 0x70(%rsp)
movl 0x10(%r14), %ecx
testl %ecx, %ecx
je 0x30c30
cmpl $0x0, (%r14)
je 0x30c30
cmpl $0x0, 0x4(%r14)
je 0x30c30
movq 0x8(%r10), %rcx
testq %rcx, %rcx
movl %eax, 0x10(%rsp)
movl %r11d, 0xc(%rsp)
je 0x30c7e
movl (%rcx,%rbp,4), %esi
jmp 0x30c84
testl %ecx, %ecx
je 0x30c40
cmpl $0x0, 0x20(%rbx)
jne 0x30c40
cmpl $0x0, (%r14)
je 0x30c47
xorl %eax, %eax
jmp 0x30e75
cmpl $0x0, 0x4(%r14)
jne 0x30c40
testl %r11d, %r11d
js 0x30c40
movq 0x18(%r10), %rsi
movl %r11d, %ecx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movups (%rsi,%rdx), %xmm0
movups 0xc(%rsi,%rdx), %xmm1
movups %xmm1, 0xc(%rsi,%r12)
movups %xmm0, (%rsi,%r12)
jmp 0x30e75
movl 0x4(%r10), %esi
addl %ebp, %esi
movq 0x18(%r10), %rax
movq %rax, 0x78(%rsp)
movq %r13, %rdi
callq 0x12670
movl %eax, %r15d
movdqu (%r14), %xmm0
movq 0x68(%rsp), %rbx
movd 0x1c(%rbx), %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movdqa %xmm0, %xmm2
psubd %xmm1, %xmm2
paddd %xmm1, %xmm0
movsd %xmm2, %xmm0            # xmm0 = xmm2[0],xmm0[1]
movupd %xmm0, (%r14)
movq %r13, %rdi
movl %eax, %esi
leaq 0x1c(%rsp), %rdx
leaq 0x8c(%rsp), %rcx
callq 0x13380
movl 0x24(%rbx), %eax
movl 0x28(%rbx), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movaps 0x30(%rsp), %xmm2
mulss %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rcx, %xmm1
mulss %xmm2, %xmm1
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
movq %r13, %rdi
movl %r15d, %esi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x88(%rsp), %r8
leaq 0x84(%rsp), %r9
callq 0x125c0
movslq 0x8(%r14), %rax
addq 0x30(%rbx), %rax
movslq 0xc(%r14), %rsi
movslq 0x18(%rbx), %r8
imulq %r8, %rsi
addq %rax, %rsi
movl 0x24(%rbx), %eax
movl 0x28(%rbx), %edi
movl (%r14), %edx
movl 0x4(%r14), %ecx
subl %eax, %edx
incl %edx
subl %edi, %ecx
incl %ecx
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movaps 0x30(%rsp), %xmm2
mulss %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rdi, %xmm1
mulss %xmm2, %xmm1
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
movq %r13, %rdi
movl %r15d, %r9d
callq 0x13ef0
movl 0x24(%rbx), %r8d
cmpl $0x2, %r8d
jb 0x30dad
movslq 0x8(%r14), %rax
addq 0x30(%rbx), %rax
movslq 0xc(%r14), %rdi
movslq 0x18(%rbx), %rcx
imulq %rcx, %rdi
addq %rax, %rdi
movl (%r14), %esi
movl 0x4(%r14), %edx
callq 0x30574
movl 0x28(%rbx), %r8d
cmpl $0x2, %r8d
jb 0x30dda
movslq 0x8(%r14), %rax
addq 0x30(%rbx), %rax
movslq 0xc(%r14), %rdi
movslq 0x18(%rbx), %rcx
imulq %rcx, %rdi
addq %rax, %rdi
movl (%r14), %esi
movl 0x4(%r14), %edx
callq 0x307cc
xorps %xmm0, %xmm0
cvtsi2ssl 0x1c(%rsp), %xmm0
mulss 0x30(%rsp), %xmm0
movq 0x78(%rsp), %rcx
movss %xmm0, 0x10(%rcx,%r12)
movss 0x14(%rsp), %xmm0
movss 0x18(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtdq2ps %xmm1, %xmm0
movaps 0xa0(%rsp), %xmm4
mulps %xmm4, %xmm0
movaps 0x20(%rsp), %xmm3
addps %xmm3, %xmm0
movlps %xmm0, 0x8(%rcx,%r12)
movq (%r14), %xmm0
movq 0x8(%r14), %rax
movq %rax, %xmm2
movw %ax, (%rcx,%r12)
shrq $0x20, %rax
movw %ax, 0x2(%rcx,%r12)
paddd %xmm0, %xmm2
pshuflw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3,4,5,6,7]
movd %xmm2, 0x4(%rcx,%r12)
paddd %xmm0, %xmm1
cvtdq2ps %xmm1, %xmm0
mulps %xmm4, %xmm0
addps %xmm3, %xmm0
movlps %xmm0, 0x14(%rcx,%r12)
testl %r15d, %r15d
movl 0xc(%rsp), %r11d
cmovel %ebp, %r11d
movl 0x10(%rsp), %eax
movq 0x70(%rsp), %r10
incq %rbp
movslq 0x10(%r10), %rcx
addq $0x18, %r14
addq $0x1c, %r12
cmpq %rcx, %rbp
jl 0x30c04
movl 0x8(%rsp), %ecx
addl %ebp, %ecx
movl %ecx, %ebp
movq 0x50(%rsp), %r8
movq 0x48(%rsp), %rdx
movq 0x60(%rsp), %r14
incq %r14
cmpq 0x58(%rsp), %r14
jne 0x30ab5
jmp 0x30eb9
movl $0x1, %eax
movaps 0x90(%rsp), %xmm0
movlps %xmm0, 0x24(%rbx)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq