// File: /workspace/github_c_makefile_star2_O2/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 %rdx, %rbx
movq %rsi, (%rsp)
movq %rdi, %r12
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
movq %rcx, 0x40(%rsp)
movsd 0x24(%rdi), %xmm0
movaps %xmm0, 0x80(%rsp)
addq $0x4, %r8
movq %r8, 0x38(%rsp)
pushq $-0x1
popq %r14
pushq $0x1
popq %rax
xorl %r15d, %r15d
movq %rdi, 0x58(%rsp)
movq %rbx, 0x30(%rsp)
cmpq 0x40(%rsp), %rdx
je 0x2eb4d
movq %rdx, 0x50(%rsp)
imulq $0x28, %rdx, %rdi
movss (%rbx,%rdi), %xmm0
ucomiss 0x38087(%rip), %xmm0    # 0x66870
jbe 0x2e800
movq %rdi, %r13
movq (%rsp), %rdi
movl %eax, %ebp
callq 0x121e0
movq %r13, %rdi
movl %ebp, %eax
jmp 0x2e827
xorps 0x37d69(%rip), %xmm0    # 0x66570
movq (%rsp), %rcx
movq 0x8(%rcx), %rdx
movslq 0x1c(%rcx), %rcx
movzwl 0x12(%rdx,%rcx), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
cvtsi2ss %ecx, %xmm1
divss %xmm1, %xmm0
movaps %xmm0, 0x20(%rsp)
addq %rbx, %rdi
movq 0x20(%rdi), %xmm4
movdqa %xmm4, %xmm0
pxor %xmm2, %xmm2
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 0x37e08(%rip), %xmm1    # 0x66650
psubw %xmm0, %xmm1
punpcklwd %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
movq %xmm0, 0x24(%r12)
cvtdq2ps %xmm0, %xmm0
movaps 0x37d6f(%rip), %xmm3    # 0x665d0
divps %xmm0, %xmm3
movaps %xmm3, 0x90(%rsp)
punpcklbw %xmm4, %xmm4    # xmm4 = xmm4[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
punpcklwd %xmm4, %xmm4    # xmm4 = xmm4[0,0,1,1,2,2,3,3]
pcmpeqb %xmm2, %xmm4
punpcklwd %xmm1, %xmm1    # xmm1 = xmm1[0,0,1,1,2,2,3,3]
psrad $0x10, %xmm1
cvtdq2ps %xmm1, %xmm1
addps %xmm0, %xmm0
divps %xmm0, %xmm1
pandn %xmm1, %xmm4
movdqa %xmm4, 0xa0(%rsp)
movslq %r15d, %r15
movq %r15, 0x48(%rsp)
imulq $0x18, %r15, %r15
addq 0x38(%rsp), %r15
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %rdi, 0x60(%rsp)
movslq 0x10(%rdi), %rcx
cmpq %rcx, %rbp
jge 0x2eb33
cmpl $0x0, 0x10(%r15)
je 0x2e8f6
cmpl $0x0, (%r15)
je 0x2e8ea
cmpl $0x0, 0x4(%r15)
je 0x2e8f6
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
movl %r14d, 0x10(%rsp)
movl %eax, 0xc(%rsp)
je 0x2e8fd
movl (%rcx,%rbp,4), %esi
jmp 0x2e902
cmpl $0x0, 0x20(%r12)
je 0x2eafe
xorl %eax, %eax
jmp 0x2eaee
movl 0x4(%rdi), %esi
addl %ebp, %esi
movq 0x18(%rdi), %rax
movq %rax, 0x68(%rsp)
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x126e0
movl %eax, %r14d
movdqu (%r15), %xmm0
movq 0x58(%rsp), %r12
movd 0x1c(%r12), %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, (%r15)
movq %rbx, %rdi
movl %eax, %esi
leaq 0x1c(%rsp), %rdx
leaq 0x7c(%rsp), %rcx
callq 0x134f0
movl 0x24(%r12), %eax
movl 0x28(%r12), %ecx
cvtsi2ss %rax, %xmm0
movaps 0x20(%rsp), %xmm2
mulss %xmm2, %xmm0
cvtsi2ss %rcx, %xmm1
mulss %xmm2, %xmm1
movq %rbx, %rdi
movl %r14d, %esi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x78(%rsp), %r8
leaq 0x74(%rsp), %r9
callq 0x12720
movslq 0x8(%r15), %rax
addq 0x30(%r12), %rax
movslq 0xc(%r15), %rsi
movslq 0x18(%r12), %r8
imulq %r8, %rsi
addq %rax, %rsi
movl 0x24(%r12), %eax
movl 0x28(%r12), %edi
movl (%r15), %edx
movl 0x4(%r15), %ecx
subl %eax, %edx
incl %edx
subl %edi, %ecx
incl %ecx
cvtsi2ss %rax, %xmm0
movaps 0x20(%rsp), %xmm2
mulss %xmm2, %xmm0
cvtsi2ss %rdi, %xmm1
mulss %xmm2, %xmm1
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
movq %rbx, %rdi
movl %r14d, %r9d
callq 0x14130
movl 0x24(%r12), %r8d
cmpl $0x2, %r8d
jb 0x2ea23
movslq 0x8(%r15), %rax
addq 0x30(%r12), %rax
movslq 0xc(%r15), %rdi
movslq 0x18(%r12), %rcx
imulq %rcx, %rdi
addq %rax, %rdi
movl (%r15), %esi
movl 0x4(%r15), %edx
callq 0x2e330
movl 0x28(%r12), %r8d
cmpl $0x2, %r8d
jb 0x2ea53
movslq 0x8(%r15), %rax
addq 0x30(%r12), %rax
movslq 0xc(%r15), %rdi
movslq 0x18(%r12), %rcx
imulq %rcx, %rdi
addq %rax, %rdi
movl (%r15), %esi
movl 0x4(%r15), %edx
callq 0x2e545
cvtsi2ssl 0x1c(%rsp), %xmm0
mulss 0x20(%rsp), %xmm0
movq 0x68(%rsp), %rcx
movss %xmm0, 0x10(%rcx,%r13)
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,%r13)
movq (%r15), %xmm0
movq 0x8(%r15), %rax
movq %rax, %xmm2
movw %ax, (%rcx,%r13)
shrq $0x20, %rax
movw %ax, 0x2(%rcx,%r13)
paddd %xmm0, %xmm2
pshuflw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3,4,5,6,7]
movd %xmm2, 0x4(%rcx,%r13)
paddd %xmm0, %xmm1
cvtdq2ps %xmm1, %xmm0
mulps %xmm4, %xmm0
addps %xmm3, %xmm0
movlps %xmm0, 0x14(%rcx,%r13)
testl %r14d, %r14d
movl 0x10(%rsp), %r14d
cmovel %ebp, %r14d
movl 0xc(%rsp), %eax
movq 0x60(%rsp), %rdi
incq %rbp
addq $0x1c, %r13
addq $0x18, %r15
jmp 0x2e8b2
cmpl $0x0, 0x4(%r15)
jne 0x2e8f6
testl %r14d, %r14d
js 0x2e8f6
movq 0x18(%rdi), %rdx
movl %r14d, %ecx
imulq $0x1c, %rcx, %rcx
movups (%rdx,%rcx), %xmm0
movups 0xc(%rdx,%rcx), %xmm1
movups %xmm1, 0xc(%rdx,%r13)
movups %xmm0, (%rdx,%r13)
jmp 0x2eaee
movq 0x50(%rsp), %rdx
incq %rdx
movq 0x48(%rsp), %r15
addq %rbp, %r15
movq 0x30(%rsp), %rbx
jmp 0x2e7c9
movaps 0x80(%rsp), %xmm0
movlps %xmm0, 0x24(%r12)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq