// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_font_atlas_add
NK_API struct nk_font*
nk_font_atlas_add(struct nk_font_atlas *atlas, const struct nk_font_config *config)
{
    struct nk_font *font = 0;
    struct nk_font_config *cfg;

    NK_ASSERT(atlas);
    NK_ASSERT(atlas->permanent.alloc);
    NK_ASSERT(atlas->permanent.free);
    NK_ASSERT(atlas->temporary.alloc);
    NK_ASSERT(atlas->temporary.free);

    NK_ASSERT(config);
    NK_ASSERT(config->ttf_blob);
    NK_ASSERT(config->ttf_size);
    NK_ASSERT(config->size > 0.0f);

    if (!atlas || !config || !config->ttf_blob || !config->ttf_size || config->size <= 0.0f||
        !atlas->permanent.alloc || !atlas->permanent.free ||
        !atlas->temporary.alloc || !atlas->temporary.free)
        return 0;

    /* allocate font config  */
    cfg = (struct nk_font_config*)
        atlas->permanent.alloc(atlas->permanent.userdata,0, sizeof(struct nk_font_config));
    NK_MEMCPY(cfg, config, sizeof(*config));
    cfg->n = cfg;
    cfg->p = cfg;

    if (!config->merge_mode) {
        /* insert font config into list */
        if (!atlas->config) {
            atlas->config = cfg;
            cfg->next = 0;
        } else {
            struct nk_font_config *i = atlas->config;
            while (i->next) i = i->next;
            i->next = cfg;
            cfg->next = 0;
        }
        /* allocate new font */
        font = (struct nk_font*)
            atlas->permanent.alloc(atlas->permanent.userdata,0, sizeof(struct nk_font));
        NK_ASSERT(font);
        nk_zero(font, sizeof(*font));
        if (!font) return 0;
        font->config = cfg;

        /* insert font into list */
        if (!atlas->fonts) {
            atlas->fonts = font;
            font->next = 0;
        } else {
            struct nk_font *i = atlas->fonts;
            while (i->next) i = i->next;
            i->next = font;
            font->next = 0;
        }
        cfg->font = &font->info;
    } else {
        /* extend previously added font */
        struct nk_font *f = 0;
        struct nk_font_config *c = 0;
        NK_ASSERT(atlas->font_num);
        f = atlas->fonts;
        c = f->config;
        cfg->font = &f->info;

        cfg->n = c;
        cfg->p = c->p;
        c->p->n = cfg;
        c->p = cfg;
    }
    /* create own copy of .TTF font blob */
    if (!config->ttf_data_owned_by_atlas) {
        cfg->ttf_blob = atlas->permanent.alloc(atlas->permanent.userdata,0, cfg->ttf_size);
        NK_ASSERT(cfg->ttf_blob);
        if (!cfg->ttf_blob) {
            atlas->font_num++;
            return 0;
        }
        NK_MEMCPY(cfg->ttf_blob, config->ttf_blob, cfg->ttf_size);
        cfg->ttf_data_owned_by_atlas = 1;
    }
    atlas->font_num++;
    return font;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x31249
movq 0x53dcc(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x38ade(%rip), %rsi     # 0x69d0c
leaq 0x38af5(%rip), %rdx     # 0x69d2a
movl $0x4443, %ecx           # imm = 0x4443
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
cmpq $0x0, 0x18(%rbx)
jne 0x3127c
movq 0x53d99(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x38aab(%rip), %rsi     # 0x69d0c
leaq 0x38ac2(%rip), %rdx     # 0x69d2a
movl $0x4444, %ecx           # imm = 0x4444
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
cmpq $0x0, 0x20(%rbx)
jne 0x312af
movq 0x53d66(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x38a78(%rip), %rsi     # 0x69d0c
leaq 0x38a8f(%rip), %rdx     # 0x69d2a
movl $0x4445, %ecx           # imm = 0x4445
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
cmpq $0x0, 0x30(%rbx)
jne 0x312e2
movq 0x53d33(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x38a45(%rip), %rsi     # 0x69d0c
leaq 0x38a5c(%rip), %rdx     # 0x69d2a
movl $0x4446, %ecx           # imm = 0x4446
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
cmpq $0x0, 0x38(%rbx)
jne 0x31315
movq 0x53d00(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x38a12(%rip), %rsi     # 0x69d0c
leaq 0x38a29(%rip), %rdx     # 0x69d2a
movl $0x4447, %ecx           # imm = 0x4447
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
testq %r14, %r14
jne 0x31346
movq 0x53ccf(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x389e1(%rip), %rsi     # 0x69d0c
leaq 0x389f8(%rip), %rdx     # 0x69d2a
movl $0x4449, %ecx           # imm = 0x4449
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
cmpq $0x0, 0x8(%r14)
jne 0x31379
movq 0x53c9c(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x389ae(%rip), %rsi     # 0x69d0c
leaq 0x389c5(%rip), %rdx     # 0x69d2a
movl $0x444a, %ecx           # imm = 0x444A
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
cmpq $0x0, 0x10(%r14)
jne 0x313ac
movq 0x53c69(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x3897b(%rip), %rsi     # 0x69d0c
leaq 0x38992(%rip), %rdx     # 0x69d2a
movl $0x444b, %ecx           # imm = 0x444B
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
movss 0x20(%r14), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
ja 0x313e6
movq 0x53c2f(%rip), %r15     # 0x84ff0
movq (%r15), %rdi
leaq 0x38941(%rip), %rsi     # 0x69d0c
leaq 0x38958(%rip), %rdx     # 0x69d2a
movl $0x444c, %ecx           # imm = 0x444C
xorl %eax, %eax
callq 0x12ea0
movq (%r15), %rdi
callq 0x13960
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x3161a
cmpq $0x0, 0x8(%r14)
je 0x3161a
cmpq $0x0, 0x10(%r14)
je 0x3161a
xorps %xmm0, %xmm0
ucomiss 0x20(%r14), %xmm0
jae 0x3161a
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x3161a
cmpq $0x0, 0x20(%rbx)
je 0x3161a
cmpq $0x0, 0x30(%rbx)
je 0x3161a
cmpq $0x0, 0x38(%rbx)
je 0x3161a
movq 0x10(%rbx), %rdi
pushq $0x58
popq %r12
xorl %esi, %esi
movq %r12, %rdx
callq *%rax
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x24323
movq %r15, 0x48(%r15)
movq %r15, 0x50(%r15)
cmpb $0x0, 0x19(%r14)
je 0x314e1
cmpl $0x0, 0x188(%rbx)
jne 0x314b2
movq 0x53b65(%rip), %r12     # 0x84ff0
movq (%r12), %rdi
leaq 0x38876(%rip), %rsi     # 0x69d0c
leaq 0x3888d(%rip), %rdx     # 0x69d2a
movl $0x447c, %ecx           # imm = 0x447C
xorl %eax, %eax
callq 0x12ea0
movq (%r12), %rdi
callq 0x13960
movq 0x178(%rbx), %rax
movq 0x78(%rax), %rcx
addq $0x30, %rax
movq %rax, 0x38(%r15)
movq %rcx, 0x48(%r15)
movq 0x50(%rcx), %rax
movq %rax, 0x50(%r15)
movq %r15, 0x48(%rax)
movq %r15, 0x50(%rcx)
xorl %r12d, %r12d
jmp 0x315a3
movq 0x180(%rbx), %rax
testq %rax, %rax
je 0x314fa
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x314ed
jmp 0x31501
leaq 0x180(%rbx), %rcx
movq %r15, (%rcx)
andq $0x0, (%r15)
movq 0x10(%rbx), %rdi
movl $0x80, %edx
xorl %esi, %esi
callq *0x18(%rbx)
testq %rax, %rax
je 0x31549
movq %rax, %r12
movl $0x80, %esi
movq %rax, %rdi
callq 0x23ed0
movq %r15, 0x78(%r12)
movq 0x178(%rbx), %rax
testq %rax, %rax
je 0x31589
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x3153c
jmp 0x31590
movq 0x53aa0(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x387b2(%rip), %rsi     # 0x69d0c
leaq 0x387c9(%rip), %rdx     # 0x69d2a
xorl %r12d, %r12d
movl $0x4468, %ecx           # imm = 0x4468
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
movl $0x80, %esi
xorl %edi, %edi
callq 0x23ed0
jmp 0x3161d
leaq 0x178(%rbx), %rcx
movq %r12, (%rcx)
andq $0x0, (%r12)
movq %r12, %rax
addq $0x30, %rax
movq %rax, 0x38(%r15)
cmpb $0x0, 0x18(%r14)
jne 0x3160c
movq 0x10(%r15), %rdx
movq 0x10(%rbx), %rdi
xorl %esi, %esi
callq *0x18(%rbx)
movq %rax, 0x8(%r15)
testq %rax, %rax
jne 0x315f7
movq 0x53a29(%rip), %r13     # 0x84ff0
movq (%r13), %rdi
leaq 0x3873a(%rip), %rsi     # 0x69d0c
leaq 0x38751(%rip), %rdx     # 0x69d2a
movl $0x4489, %ecx           # imm = 0x4489
xorl %eax, %eax
callq 0x12ea0
movq (%r13), %rdi
callq 0x13960
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x31614
movq 0x8(%r14), %rsi
movq 0x10(%r15), %rdx
movq %rax, %rdi
callq 0x24323
movb $0x1, 0x18(%r15)
incl 0x188(%rbx)
jmp 0x3161d
incl 0x188(%rbx)
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq