// File: /workspace/github_c_makefile_star2_O3/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, 0x80(%rsp)
testl %ecx, %ecx
jle 0x30cfb
movl %ecx, %eax
movq %rax, 0x48(%rsp)
addq $0x4, %r8
movl $0x1, %eax
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
xorl %r14d, %r14d
pxor %xmm2, %xmm2
xorl %ebp, %ebp
movq %rbx, 0x58(%rsp)
movq %r8, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq (%rsp), %r13
leaq (%r14,%r14,4), %r10
movss (%rdx,%r10,8), %xmm4
ucomiss 0x3cf94(%rip), %xmm4    # 0x6d8e0
jbe 0x3098d
movq (%rsp), %rsi
movq 0x8(%rsi), %rcx
movslq 0x24(%rsi), %r9
movzbl 0x5(%rcx,%r9), %esi
movzbl 0x4(%rcx,%r9), %edi
shll $0x8, %edi
movswl %di, %edi
orl %esi, %edi
movzbl 0x7(%rcx,%r9), %esi
movzbl 0x6(%rcx,%r9), %ecx
shll $0x8, %ecx
movswl %cx, %ecx
orl %esi, %ecx
subl %ecx, %edi
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
jmp 0x309b3
xorps 0x3cbdc(%rip), %xmm4    # 0x6d570
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, %xmm4
leaq (%rdx,%r10,8), %rdi
movq 0x20(%rdi), %xmm5
movdqa %xmm5, %xmm0
punpcklbw %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
movdqa %xmm0, %xmm1
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
movq %xmm1, 0x24(%rbx)
cmpl $0x0, 0x10(%rdi)
jle 0x30ceb
movq %r14, 0x50(%rsp)
cvtdq2ps %xmm1, %xmm1
movaps 0x3cbf2(%rip), %xmm3    # 0x6d5e0
divps %xmm1, %xmm3
movaps %xmm3, 0x90(%rsp)
punpcklbw %xmm5, %xmm5    # xmm5 = xmm5[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
punpcklwd %xmm5, %xmm5    # xmm5 = xmm5[0,0,1,1,2,2,3,3]
pcmpeqb %xmm2, %xmm5
movdqa 0x3cc63(%rip), %xmm2    # 0x6d670
psubw %xmm0, %xmm2
punpcklwd %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
psrad $0x10, %xmm0
cvtdq2ps %xmm0, %xmm0
addps %xmm1, %xmm1
divps %xmm1, %xmm0
pandn %xmm0, %xmm5
movdqa %xmm5, 0xa0(%rsp)
movl %ebp, 0x8(%rsp)
movslq %ebp, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%r8,%rcx,8), %r14
xorl %r12d, %r12d
xorl %ebp, %ebp
movaps %xmm4, 0x20(%rsp)
movq %rdi, 0x60(%rsp)
cmpl $0x0, 0x10(%r14)
je 0x30a83
cmpl $0x0, (%r14)
je 0x30a79
cmpl $0x0, 0x4(%r14)
je 0x30a83
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
movl %eax, 0x10(%rsp)
movl %r11d, 0xc(%rsp)
je 0x30a8a
movl (%rcx,%rbp,4), %esi
jmp 0x30a8f
cmpl $0x0, 0x20(%rbx)
je 0x30c94
xorl %eax, %eax
jmp 0x30c7a
movl 0x4(%rdi), %esi
addl %ebp, %esi
movq 0x18(%rdi), %rax
movq %rax, 0x68(%rsp)
movq %r13, %rdi
callq 0x12670
movl %eax, %r15d
movdqu (%r14), %xmm0
movq 0x58(%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 0x7c(%rsp), %rcx
callq 0x13380
movl 0x24(%rbx), %eax
movl 0x28(%rbx), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movaps 0x20(%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 0x78(%rsp), %r8
leaq 0x74(%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 0x20(%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 0x30baf
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 0x303e7
movl 0x28(%rbx), %r8d
cmpl $0x2, %r8d
jb 0x30bdc
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 0x30643
xorps %xmm0, %xmm0
cvtsi2ssl 0x1c(%rsp), %xmm0
mulss 0x20(%rsp), %xmm0
movq 0x68(%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 0x90(%rsp), %xmm4
mulps %xmm4, %xmm0
movaps 0xa0(%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 0x60(%rsp), %rdi
incq %rbp
movslq 0x10(%rdi), %rcx
addq $0x18, %r14
addq $0x1c, %r12
cmpq %rcx, %rbp
jl 0x30a4e
jmp 0x30cd0
cmpl $0x0, 0x4(%r14)
jne 0x30a83
testl %r11d, %r11d
js 0x30a83
movq 0x18(%rdi), %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 0x30c7a
movl 0x8(%rsp), %ecx
addl %ebp, %ecx
movl %ecx, %ebp
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %rdx
movq 0x50(%rsp), %r14
pxor %xmm2, %xmm2
incq %r14
cmpq 0x48(%rsp), %r14
jne 0x3093b
jmp 0x30d00
movl $0x1, %eax
movaps 0x80(%rsp), %xmm0
movlps %xmm0, 0x24(%rbx)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq