// File: /workspace/github_c_makefile_star2_O0/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt_BakeFontBitmap_internal
static int stbtt_BakeFontBitmap_internal(unsigned char *data, int offset,  // font location (use offset=0 for plain .ttf)
                                float pixel_height,                     // height of font in pixels
                                unsigned char *pixels, int pw, int ph,  // bitmap to be filled in
                                int first_char, int num_chars,          // characters to bake
                                stbtt_bakedchar *chardata)
{
   float scale;
   int x,y,bottom_y, i;
   stbtt_fontinfo f;
   f.userdata = NULL;
   if (!stbtt_InitFont(&f, data, offset))
      return -1;
   STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels
   x=y=1;
   bottom_y = 1;

   scale = stbtt_ScaleForPixelHeight(&f, pixel_height);

   for (i=0; i < num_chars; ++i) {
      int advance, lsb, x0,y0,x1,y1,gw,gh;
      int g = stbtt_FindGlyphIndex(&f, first_char + i);
      stbtt_GetGlyphHMetrics(&f, g, &advance, &lsb);
      stbtt_GetGlyphBitmapBox(&f, g, scale,scale, &x0,&y0,&x1,&y1);
      gw = x1-x0;
      gh = y1-y0;
      if (x + gw + 1 >= pw)
         y = bottom_y, x = 1; // advance to next row
      if (y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row
         return -i;
      STBTT_assert(x+gw < pw);
      STBTT_assert(y+gh < ph);
      stbtt_MakeGlyphBitmap(&f, pixels+x+y*pw, gw,gh,pw, scale,scale, g);
      chardata[i].x0 = (stbtt_int16) x;
      chardata[i].y0 = (stbtt_int16) y;
      chardata[i].x1 = (stbtt_int16) (x + gw);
      chardata[i].y1 = (stbtt_int16) (y + gh);
      chardata[i].xadvance = scale * advance;
      chardata[i].xoff     = (float) x0;
      chardata[i].yoff     = (float) y0;
      x = x + gw + 1;
      if (y+gh+1 > bottom_y)
         bottom_y = y+gh+1;
   }
   return bottom_y;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movss %xmm0, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0xe0(%rbp), %rdi
callq 0x97c0
cmpl $0x0, %eax
jne 0xc14c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc422
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %eax
imull -0x28(%rbp), %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x10b0
movl $0x1, -0x38(%rbp)
movl $0x1, -0x34(%rbp)
movl $0x1, -0x3c(%rbp)
movss -0x18(%rbp), %xmm0
leaq -0xe0(%rbp), %rdi
callq 0x6c40
movss %xmm0, -0x30(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0xc41c
movl -0x2c(%rbp), %esi
addl -0x40(%rbp), %esi
leaq -0xe0(%rbp), %rdi
callq 0x4450
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %esi
leaq -0xe0(%rbp), %rdi
leaq -0xe4(%rbp), %rdx
leaq -0xe8(%rbp), %rcx
callq 0x5fa0
movl -0x104(%rbp), %esi
movss -0x30(%rbp), %xmm0
movss -0x30(%rbp), %xmm1
leaq -0xe0(%rbp), %rdi
leaq -0xec(%rbp), %rdx
leaq -0xf0(%rbp), %rcx
leaq -0xf4(%rbp), %r8
leaq -0xf8(%rbp), %r9
callq 0x6ea0
movl -0xf4(%rbp), %eax
subl -0xec(%rbp), %eax
movl %eax, -0xfc(%rbp)
movl -0xf8(%rbp), %eax
subl -0xf0(%rbp), %eax
movl %eax, -0x100(%rbp)
movl -0x34(%rbp), %eax
addl -0xfc(%rbp), %eax
addl $0x1, %eax
cmpl -0x24(%rbp), %eax
jl 0xc251
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x38(%rbp), %eax
addl -0x100(%rbp), %eax
addl $0x1, %eax
cmpl -0x28(%rbp), %eax
jl 0xc26f
xorl %eax, %eax
subl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xc422
movl -0x34(%rbp), %eax
addl -0xfc(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xc27f
jmp 0xc29e
leaq 0xb132(%rip), %rdi      # 0x173b8
leaq 0xa52a(%rip), %rsi      # 0x167b7
movl $0xe4d, %edx            # imm = 0xE4D
leaq 0xb129(%rip), %rcx      # 0x173c2
callq 0x10a0
movl -0x38(%rbp), %eax
addl -0x100(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xc2ae
jmp 0xc2cd
leaq 0xb184(%rip), %rdi      # 0x17439
leaq 0xa4fb(%rip), %rsi      # 0x167b7
movl $0xe4e, %edx            # imm = 0xE4E
leaq 0xb0fa(%rip), %rcx      # 0x173c2
callq 0x10a0
movq -0x20(%rbp), %rsi
movslq -0x34(%rbp), %rax
addq %rax, %rsi
movl -0x38(%rbp), %eax
imull -0x24(%rbp), %eax
cltq
addq %rax, %rsi
movl -0xfc(%rbp), %edx
movl -0x100(%rbp), %ecx
movl -0x24(%rbp), %r8d
movss -0x30(%rbp), %xmm0
movss -0x30(%rbp), %xmm1
movl -0x104(%rbp), %r9d
leaq -0xe0(%rbp), %rdi
callq 0x7ba0
movl -0x34(%rbp), %eax
movw %ax, %cx
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movl -0x38(%rbp), %eax
movw %ax, %cx
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movw %cx, 0x2(%rax)
movl -0x34(%rbp), %eax
addl -0xfc(%rbp), %eax
movw %ax, %cx
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movw %cx, 0x4(%rax)
movl -0x38(%rbp), %eax
addl -0x100(%rbp), %eax
movw %ax, %cx
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movw %cx, 0x6(%rax)
movss -0x30(%rbp), %xmm0
cvtsi2ssl -0xe4(%rbp), %xmm1
mulss %xmm1, %xmm0
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x10(%rax)
cvtsi2ssl -0xec(%rbp), %xmm0
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
cvtsi2ssl -0xf0(%rbp), %xmm0
movq 0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movl -0x34(%rbp), %eax
addl -0xfc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x38(%rbp), %eax
addl -0x100(%rbp), %eax
addl $0x1, %eax
cmpl -0x3c(%rbp), %eax
jle 0xc40c
movl -0x38(%rbp), %eax
addl -0x100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xc40e
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xc193
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nop