// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_draw_text
NK_API void
nk_draw_text(struct nk_command_buffer *b, struct nk_rect r,
    const char *string, int length, const struct nk_user_font *font,
    struct nk_color bg, struct nk_color fg)
{
    float text_width = 0;
    struct nk_command_text *cmd;

    NK_ASSERT(b);
    NK_ASSERT(font);
    if (!b || !string || !length || (bg.a == 0 && fg.a == 0)) return;
    if (b->use_clipping) {
        const struct nk_rect *c = &b->clip;
        if (c->w == 0 || c->h == 0 || !NK_INTERSECT(r.x, r.y, r.w, r.h, c->x, c->y, c->w, c->h))
            return;
    }

    /* make sure text fits inside bounds */
    text_width = font->width(font->userdata, font->height, string, length);
    if (text_width > r.w){
        int glyphs = 0;
        float txt_width = (float)text_width;
        length = nk_text_clamp(font, string, length, r.w, &glyphs, &txt_width, 0,0);
    }

    if (!length) return;
    cmd = (struct nk_command_text*)
        nk_command_buffer_push(b, NK_COMMAND_TEXT, sizeof(*cmd) + (nk_size)(length + 1));
    if (!cmd) return;
    cmd->x = (short)r.x;
    cmd->y = (short)r.y;
    cmd->w = (unsigned short)r.w;
    cmd->h = (unsigned short)r.h;
    cmd->background = bg;
    cmd->foreground = fg;
    cmd->font = font;
    cmd->length = length;
    cmd->height = font->height;
    NK_MEMCPY(cmd->string, string, (nk_size)length);
    cmd->string[length] = '\0';
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebp
movl %r8d, %r12d
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %rbx
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rdi, %r13
testq %rdi, %rdi
jne 0x28819
movq 0x5f803(%rip), %rax     # 0x87ff0
movq (%rax), %rdi
leaq 0x49595(%rip), %rsi     # 0x71d8c
leaq 0x495ac(%rip), %rdx     # 0x71daa
movl $0x24f4, %ecx           # imm = 0x24F4
xorl %eax, %eax
callq 0x12d80
movq 0x5f7df(%rip), %rax     # 0x87ff0
movq (%rax), %rdi
callq 0x13780
testq %r14, %r14
jne 0x28851
movq 0x5f7cb(%rip), %rax     # 0x87ff0
movq (%rax), %rdi
leaq 0x4955d(%rip), %rsi     # 0x71d8c
leaq 0x49574(%rip), %rdx     # 0x71daa
movl $0x24f5, %ecx           # imm = 0x24F5
xorl %eax, %eax
callq 0x12d80
movq 0x5f7a7(%rip), %rax     # 0x87ff0
movq (%rax), %rdi
callq 0x13780
testq %r13, %r13
je 0x28a0d
testq %rbx, %rbx
je 0x28a0d
testl %r15d, %r15d
je 0x28a0d
movl $0x1000000, %eax        # imm = 0x1000000
cmpl %eax, %r12d
setb %cl
cmpl %eax, %ebp
setb %al
testb %al, %cl
jne 0x28a0d
cmpl $0x0, 0x18(%r13)
je 0x28910
movss 0x10(%r13), %xmm1
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm1
jne 0x288a3
jnp 0x28a0d
movss 0x14(%r13), %xmm0
ucomiss %xmm2, %xmm0
jne 0x288b4
jnp 0x28a0d
movss 0x8(%r13), %xmm2
movaps 0x10(%rsp), %xmm3
addss 0x20(%rsp), %xmm3
ucomiss %xmm2, %xmm3
jbe 0x28a0d
addss %xmm2, %xmm1
ucomiss 0x10(%rsp), %xmm1
jbe 0x28a0d
movss 0xc(%r13), %xmm1
movaps 0x10(%rsp), %xmm2
addps 0x20(%rsp), %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
ucomiss %xmm1, %xmm2
jbe 0x28a0d
movaps 0x10(%rsp), %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
addss %xmm1, %xmm0
ucomiss %xmm2, %xmm0
jbe 0x28a0d
movss 0x8(%r14), %xmm0
movq (%r14), %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq *0x10(%r14)
movaps 0x20(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x2895a
xorl %eax, %eax
leaq 0x44(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x40(%rsp), %r8
movss %xmm0, (%r8)
movl %eax, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movaps %xmm1, %xmm0
xorl %r9d, %r9d
callq 0x28a1c
movl %eax, %r15d
testl %r15d, %r15d
je 0x28a0d
movslq %r15d, %rax
movq %rax, 0x38(%rsp)
leaq 0x39(%rax), %rdx
movq %r13, %rdi
movl $0x10, %esi
callq 0x2703d
testq %rax, %rax
je 0x28a0d
movq %rax, %r13
movl %r12d, %eax
shrl $0x18, %eax
movl %ebp, %ecx
shrl $0x18, %ecx
movaps 0x10(%rsp), %xmm0
unpcklpd 0x20(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
cvttps2dq %xmm0, %xmm0
pshuflw $0xe8, %xmm0, %xmm1     # xmm1 = xmm0[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,6,6,7]
pshufd $0xaa, %xmm0, %xmm0     # xmm0 = xmm0[2,2,2,2]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movq %xmm1, 0x20(%r13)
movw %r12w, 0x18(%r13)
shrl $0x10, %r12d
movb %r12b, 0x1a(%r13)
movb %al, 0x1b(%r13)
movw %bp, 0x1c(%r13)
shrl $0x10, %ebp
movb %bpl, 0x1e(%r13)
movb %cl, 0x1f(%r13)
movq %r14, 0x10(%r13)
movl %r15d, 0x2c(%r13)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x28(%r13)
movq %r13, %rdi
addq $0x30, %rdi
movq %rbx, %rsi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0x258b3
movb $0x0, 0x30(%r13,%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq