// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_font_bake
NK_INTERN void
nk_font_bake(struct nk_font_baker *baker, void *image_memory, int width, int height,
    struct nk_font_glyph *glyphs, int glyphs_count,
    const struct nk_font_config *config_list, int font_count)
{
    int input_i = 0;
    nk_rune glyph_n = 0;
    const struct nk_font_config *config_iter;
    const struct nk_font_config *it;

    NK_ASSERT(image_memory);
    NK_ASSERT(width);
    NK_ASSERT(height);
    NK_ASSERT(config_list);
    NK_ASSERT(baker);
    NK_ASSERT(font_count);
    NK_ASSERT(glyphs_count);
    if (!image_memory || !width || !height || !config_list ||
        !font_count || !glyphs || !glyphs_count)
        return;

    /* second font pass: render glyphs */
    nk_zero(image_memory, (nk_size)((nk_size)width * (nk_size)height));
    baker->spc.pixels = (unsigned char*)image_memory;
    baker->spc.height = (int)height;
    for (input_i = 0, config_iter = config_list; input_i < font_count && config_iter;
        config_iter = config_iter->next) {
        it = config_iter;
        do {const struct nk_font_config *cfg = it;
            struct nk_font_bake_data *tmp = &baker->build[input_i++];
            stbtt_PackSetOversampling(&baker->spc, cfg->oversample_h, cfg->oversample_v);
            stbtt_PackFontRangesRenderIntoRects(&baker->spc, &tmp->info, tmp->ranges, (int)tmp->range_count, tmp->rects);
        } while ((it = it->n) != config_iter);
    } stbtt_PackEnd(&baker->spc);

    /* third pass: setup font and glyphs */
    for (input_i = 0, config_iter = config_list; input_i < font_count && config_iter;
        config_iter = config_iter->next) {
        it = config_iter;
        do {nk_size i = 0;
            int char_idx = 0;
            nk_rune glyph_count = 0;
            const struct nk_font_config *cfg = it;
            struct nk_font_bake_data *tmp = &baker->build[input_i++];
            struct nk_baked_font *dst_font = cfg->font;

            float font_scale = stbtt_ScaleForPixelHeight(&tmp->info, cfg->size);
            int unscaled_ascent, unscaled_descent, unscaled_line_gap;
            stbtt_GetFontVMetrics(&tmp->info, &unscaled_ascent, &unscaled_descent,
                                    &unscaled_line_gap);

            /* fill baked font */
            if (!cfg->merge_mode) {
                dst_font->ranges = cfg->range;
                dst_font->height = cfg->size;
                dst_font->ascent = ((float)unscaled_ascent * font_scale);
                dst_font->descent = ((float)unscaled_descent * font_scale);
                dst_font->glyph_offset = glyph_n;
                /*
                    Need to zero this, or it will carry over from a previous
                    bake, and cause a segfault when accessing glyphs[].
                */
                dst_font->glyph_count = 0;
            }

            /* fill own baked font glyph array */
            for (i = 0; i < tmp->range_count; ++i) {
                stbtt_pack_range *range = &tmp->ranges[i];
                for (char_idx = 0; char_idx < range->num_chars; char_idx++)
                {
                    nk_rune codepoint = 0;
                    float dummy_x = 0, dummy_y = 0;
                    stbtt_aligned_quad q;
                    struct nk_font_glyph *glyph;

                    /* query glyph bounds from stb_truetype */
                    const stbtt_packedchar *pc = &range->chardata_for_range[char_idx];
                    codepoint = (nk_rune)(range->first_unicode_codepoint_in_range + char_idx);
                    stbtt_GetPackedQuad(range->chardata_for_range, (int)width,
                        (int)height, char_idx, &dummy_x, &dummy_y, &q, 0);

                    /* fill own glyph type with data */
                    glyph = &glyphs[dst_font->glyph_offset + dst_font->glyph_count + (unsigned int)glyph_count];
                    glyph->codepoint = codepoint;
                    glyph->x0 = q.x0; glyph->y0 = q.y0;
                    glyph->x1 = q.x1; glyph->y1 = q.y1;
                    glyph->y0 += (dst_font->ascent + 0.5f);
                    glyph->y1 += (dst_font->ascent + 0.5f);
                    glyph->w = glyph->x1 - glyph->x0 + 0.5f;
                    glyph->h = glyph->y1 - glyph->y0;

                    if (cfg->coord_type == NK_COORD_PIXEL) {
                        glyph->u0 = q.s0 * (float)width;
                        glyph->v0 = q.t0 * (float)height;
                        glyph->u1 = q.s1 * (float)width;
                        glyph->v1 = q.t1 * (float)height;
                    } else {
                        glyph->u0 = q.s0;
                        glyph->v0 = q.t0;
                        glyph->u1 = q.s1;
                        glyph->v1 = q.t1;
                    }
                    glyph->xadvance = (pc->xadvance + cfg->spacing.x);
                    if (cfg->pixel_snap)
                        glyph->xadvance = (float)(int)(glyph->xadvance + 0.5f);
                    glyph_count++;
                }
            }
            dst_font->glyph_count += glyph_count;
            glyph_n += glyph_count;
        } while ((it = it->n) != config_iter);
    }
}

// Assembly:
subq $0xe8, %rsp
movl 0xf8(%rsp), %eax
movq 0xf0(%rsp), %rax
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movl %edx, 0xd4(%rsp)
movl %ecx, 0xd0(%rsp)
movq %r8, 0xc8(%rsp)
movl %r9d, 0xc4(%rsp)
movl $0x0, 0xc0(%rsp)
movl $0x0, 0xbc(%rsp)
cmpq $0x0, 0xd8(%rsp)
jne 0x4aba8
movq 0x7a474(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x6681a(%rip), %rsi     # 0xb13a0
leaq 0x66831(%rip), %rdx     # 0xb13be
movl $0x41b9, %ecx           # imm = 0x41B9
movb $0x0, %al
callq 0x13ec0
movq 0x7a450(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4abaa
jmp 0x4abac
cmpl $0x0, 0xd4(%rsp)
jne 0x4abe9
movq 0x7a433(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x667d9(%rip), %rsi     # 0xb13a0
leaq 0x667f0(%rip), %rdx     # 0xb13be
movl $0x41ba, %ecx           # imm = 0x41BA
movb $0x0, %al
callq 0x13ec0
movq 0x7a40f(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4abeb
jmp 0x4abed
cmpl $0x0, 0xd0(%rsp)
jne 0x4ac2a
movq 0x7a3f2(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x66798(%rip), %rsi     # 0xb13a0
leaq 0x667af(%rip), %rdx     # 0xb13be
movl $0x41bb, %ecx           # imm = 0x41BB
movb $0x0, %al
callq 0x13ec0
movq 0x7a3ce(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4ac2c
jmp 0x4ac2e
cmpq $0x0, 0xf0(%rsp)
jne 0x4ac6c
movq 0x7a3b0(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x66756(%rip), %rsi     # 0xb13a0
leaq 0x6676d(%rip), %rdx     # 0xb13be
movl $0x41bc, %ecx           # imm = 0x41BC
movb $0x0, %al
callq 0x13ec0
movq 0x7a38c(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4ac6e
jmp 0x4ac70
cmpq $0x0, 0xe0(%rsp)
jne 0x4acae
movq 0x7a36e(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x66714(%rip), %rsi     # 0xb13a0
leaq 0x6672b(%rip), %rdx     # 0xb13be
movl $0x41bd, %ecx           # imm = 0x41BD
movb $0x0, %al
callq 0x13ec0
movq 0x7a34a(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4acb0
jmp 0x4acb2
cmpl $0x0, 0xf8(%rsp)
jne 0x4acef
movq 0x7a32d(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x666d3(%rip), %rsi     # 0xb13a0
leaq 0x666ea(%rip), %rdx     # 0xb13be
movl $0x41be, %ecx           # imm = 0x41BE
movb $0x0, %al
callq 0x13ec0
movq 0x7a309(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4acf1
jmp 0x4acf3
cmpl $0x0, 0xc4(%rsp)
jne 0x4ad30
movq 0x7a2ec(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x66692(%rip), %rsi     # 0xb13a0
leaq 0x666a9(%rip), %rdx     # 0xb13be
movl $0x41bf, %ecx           # imm = 0x41BF
movb $0x0, %al
callq 0x13ec0
movq 0x7a2c8(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x4ad32
cmpq $0x0, 0xd8(%rsp)
je 0x4ad7b
cmpl $0x0, 0xd4(%rsp)
je 0x4ad7b
cmpl $0x0, 0xd0(%rsp)
je 0x4ad7b
cmpq $0x0, 0xf0(%rsp)
je 0x4ad7b
cmpl $0x0, 0xf8(%rsp)
je 0x4ad7b
cmpq $0x0, 0xc8(%rsp)
je 0x4ad7b
cmpl $0x0, 0xc4(%rsp)
jne 0x4ad80
jmp 0x4b45a
movq 0xd8(%rsp), %rdi
movslq 0xd4(%rsp), %rsi
movslq 0xd0(%rsp), %rax
imulq %rax, %rsi
callq 0x2f0e0
movq 0xd8(%rsp), %rcx
movq 0xe0(%rsp), %rax
movq %rcx, 0x48(%rax)
movl 0xd0(%rsp), %ecx
movq 0xe0(%rsp), %rax
movl %ecx, 0x2c(%rax)
movl $0x0, 0xc0(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl 0xc0(%rsp), %ecx
xorl %eax, %eax
cmpl 0xf8(%rsp), %ecx
movb %al, 0x17(%rsp)
jge 0x4ae08
cmpq $0x0, 0xb0(%rsp)
setne %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x4ae15
jmp 0x4af13
movq 0xb0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xe0(%rsp), %rax
movq 0x58(%rax), %rax
movl 0xc0(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0xc0(%rsp)
movslq %ecx, %rcx
imulq $0xb8, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x98(%rsp)
movq 0xe0(%rsp), %rdi
addq $0x18, %rdi
movq 0xa0(%rsp), %rax
movzbl 0x1c(%rax), %esi
movq 0xa0(%rsp), %rax
movzbl 0x1b(%rax), %edx
callq 0x15170
movq 0xe0(%rsp), %rdi
addq $0x18, %rdi
movq 0x98(%rsp), %rsi
movq 0x98(%rsp), %rax
movq 0xa8(%rax), %rdx
movq 0x98(%rsp), %rax
movl 0xb0(%rax), %ecx
movq 0x98(%rsp), %rax
movq 0xa0(%rax), %r8
callq 0x14ca0
movq 0xa8(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0xa8(%rsp)
cmpq 0xb0(%rsp), %rax
jne 0x4ae25
jmp 0x4aefb
movq 0xb0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x4ade2
movq 0xe0(%rsp), %rdi
addq $0x18, %rdi
callq 0x14830
movl $0x0, 0xc0(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl 0xc0(%rsp), %ecx
xorl %eax, %eax
cmpl 0xf8(%rsp), %ecx
movb %al, 0x16(%rsp)
jge 0x4af65
cmpq $0x0, 0xb0(%rsp)
setne %al
movb %al, 0x16(%rsp)
movb 0x16(%rsp), %al
testb $0x1, %al
jne 0x4af72
jmp 0x4b45a
movq 0xb0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq $0x0, 0x90(%rsp)
movl $0x0, 0x8c(%rsp)
movl $0x0, 0x88(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0xe0(%rsp), %rax
movq 0x58(%rax), %rax
movl 0xc0(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0xc0(%rsp)
movslq %ecx, %rcx
imulq $0xb8, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rax
movss 0x20(%rax), %xmm0
callq 0x131e0
movss %xmm0, 0x6c(%rsp)
movq 0x78(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x64(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x131c0
movq 0x80(%rsp), %rax
cmpb $0x0, 0x19(%rax)
jne 0x4b0ac
movq 0x80(%rsp), %rax
movq 0x30(%rax), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x80(%rsp), %rax
movss 0x20(%rax), %xmm0
movq 0x70(%rsp), %rax
movss %xmm0, (%rax)
cvtsi2ssl 0x68(%rsp), %xmm0
mulss 0x6c(%rsp), %xmm0
movq 0x70(%rsp), %rax
movss %xmm0, 0x4(%rax)
cvtsi2ssl 0x64(%rsp), %xmm0
mulss 0x6c(%rsp), %xmm0
movq 0x70(%rsp), %rax
movss %xmm0, 0x8(%rax)
movl 0xbc(%rsp), %ecx
movq 0x70(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x70(%rsp), %rax
movl $0x0, 0x10(%rax)
movq $0x0, 0x90(%rsp)
movq 0x90(%rsp), %rax
movq 0x78(%rsp), %rcx
movl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jae 0x4b3f7
movq 0x78(%rsp), %rax
movq 0xa8(%rax), %rax
imulq $0x28, 0x90(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
movl $0x0, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
movq 0x58(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x4b3dc
movl $0x0, 0x54(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x50(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x4c(%rsp)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x8c(%rsp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rax
movl 0x4(%rax), %eax
addl 0x8c(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0xd4(%rsp), %esi
movl 0xd0(%rsp), %edx
movl 0x8c(%rsp), %ecx
leaq 0x50(%rsp), %r8
leaq 0x4c(%rsp), %r9
leaq 0x2c(%rsp), %rax
xorl %r10d, %r10d
movq %rax, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x15060
movq 0xc8(%rsp), %rax
movq 0x70(%rsp), %rcx
movl 0xc(%rcx), %ecx
movq 0x70(%rsp), %rdx
addl 0x10(%rdx), %ecx
addl 0x88(%rsp), %ecx
movl %ecx, %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movl 0x54(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movss 0x2c(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x8(%rax)
movss 0x30(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0xc(%rax)
movss 0x3c(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x10(%rax)
movss 0x40(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x14(%rax)
movq 0x70(%rsp), %rax
movss 0x622f3(%rip), %xmm0    # 0xad514
addss 0x4(%rax), %xmm0
movq 0x20(%rsp), %rax
addss 0xc(%rax), %xmm0
movss %xmm0, 0xc(%rax)
movq 0x70(%rsp), %rax
movss 0x622d2(%rip), %xmm0    # 0xad514
addss 0x4(%rax), %xmm0
movq 0x20(%rsp), %rax
addss 0x14(%rax), %xmm0
movss %xmm0, 0x14(%rax)
movq 0x20(%rsp), %rax
movss 0x10(%rax), %xmm0
movq 0x20(%rsp), %rax
subss 0x8(%rax), %xmm0
movss 0x622a2(%rip), %xmm1    # 0xad514
addss %xmm1, %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x18(%rax)
movq 0x20(%rsp), %rax
movss 0x14(%rax), %xmm0
movq 0x20(%rsp), %rax
subss 0xc(%rax), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x1c(%rax)
movq 0x80(%rsp), %rax
cmpl $0x1, 0x24(%rax)
jne 0x4b322
movss 0x34(%rsp), %xmm0
cvtsi2ssl 0xd4(%rsp), %xmm1
mulss %xmm1, %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x20(%rax)
movss 0x38(%rsp), %xmm0
cvtsi2ssl 0xd0(%rsp), %xmm1
mulss %xmm1, %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x24(%rax)
movss 0x44(%rsp), %xmm0
cvtsi2ssl 0xd4(%rsp), %xmm1
mulss %xmm1, %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x28(%rax)
movss 0x48(%rsp), %xmm0
cvtsi2ssl 0xd0(%rsp), %xmm1
mulss %xmm1, %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x2c(%rax)
jmp 0x4b362
movss 0x34(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x20(%rax)
movss 0x38(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x24(%rax)
movss 0x44(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x28(%rax)
movss 0x48(%rsp), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x2c(%rax)
movq 0x18(%rsp), %rax
movss 0x10(%rax), %xmm0
movq 0x80(%rsp), %rax
addss 0x28(%rax), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x4(%rax)
movq 0x80(%rsp), %rax
cmpb $0x0, 0x1a(%rax)
je 0x4b3b5
movq 0x20(%rsp), %rax
movss 0x62176(%rip), %xmm0    # 0xad514
addss 0x4(%rax), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0x4(%rax)
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x4b0fc
jmp 0x4b3de
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x4b0b8
movl 0x88(%rsp), %ecx
movq 0x70(%rsp), %rax
addl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
movl 0x88(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0xbc(%rsp)
movq 0xa8(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0xa8(%rsp)
cmpq 0xb0(%rsp), %rax
jne 0x4af82
jmp 0x4b442
movq 0xb0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x4af3f
addq $0xe8, %rsp
retq
nopw %cs:(%rax,%rax)