// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movl %r9d, %ebp
movl %r8d, %r15d
movq %rcx, %r14
movl %edx, %r13d
movq %rsi, %rbx
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rdi, %r12
testq %rdi, %rdi
jne 0x2891b
movq 0x5e701(%rip), %rax     # 0x86ff0
movq (%rax), %rdi
leaq 0x484a3(%rip), %rsi     # 0x70d9c
leaq 0x484ba(%rip), %rdx     # 0x70dba
movl $0x24f4, %ecx           # imm = 0x24F4
xorl %eax, %eax
callq 0x12d80
movq 0x5e6dd(%rip), %rax     # 0x86ff0
movq (%rax), %rdi
callq 0x13780
testq %r14, %r14
jne 0x28953
movq 0x5e6c9(%rip), %rax     # 0x86ff0
movq (%rax), %rdi
leaq 0x4846b(%rip), %rsi     # 0x70d9c
leaq 0x48482(%rip), %rdx     # 0x70dba
movl $0x24f5, %ecx           # imm = 0x24F5
xorl %eax, %eax
callq 0x12d80
movq 0x5e6a5(%rip), %rax     # 0x86ff0
movq (%rax), %rdi
callq 0x13780
testq %r12, %r12
je 0x28b15
testq %rbx, %rbx
je 0x28b15
testl %r13d, %r13d
je 0x28b15
movl $0x1000000, %eax        # imm = 0x1000000
cmpl %eax, %r15d
setb %cl
cmpl %eax, %ebp
setb %al
testb %al, %cl
jne 0x28b15
cmpl $0x0, 0x18(%r12)
je 0x28a17
movss 0x10(%r12), %xmm1
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm1
jne 0x289a7
jnp 0x28b15
movss 0x14(%r12), %xmm0
ucomiss %xmm2, %xmm0
jne 0x289b9
jnp 0x28b15
movss 0x8(%r12), %xmm2
movaps 0x10(%rsp), %xmm3
addss 0x20(%rsp), %xmm3
ucomiss %xmm2, %xmm3
jbe 0x28b15
addss %xmm2, %xmm1
ucomiss 0x10(%rsp), %xmm1
jbe 0x28b15
movss 0xc(%r12), %xmm1
movaps 0x10(%rsp), %xmm2
addps 0x20(%rsp), %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
ucomiss %xmm1, %xmm2
jbe 0x28b15
movaps 0x10(%rsp), %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
addss %xmm1, %xmm0
ucomiss %xmm2, %xmm0
jbe 0x28b15
movss 0x8(%r14), %xmm0
movq (%r14), %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq *0x10(%r14)
movaps 0x20(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x28a64
movl $0x0, (%rsp)
leaq 0x34(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %r14, %rdi
movq %rbx, %rsi
movl %r13d, %edx
movaps %xmm1, %xmm0
xorl %r9d, %r9d
callq 0x28b24
movl %eax, %r13d
testl %eax, %eax
je 0x28b15
movslq %r13d, %r13
leaq 0x39(%r13), %rdx
movq %r12, %rdi
movl $0x10, %esi
callq 0x27250
testq %rax, %rax
je 0x28b15
movq %rax, %r12
movl %r15d, %eax
shrl $0x18, %eax
movl %ebp, %ecx
shrl $0x18, %ecx
movaps 0x20(%rsp), %xmm0
shufps $0xd4, %xmm0, %xmm0     # xmm0 = xmm0[0,1,1,3]
movaps 0x10(%rsp), %xmm1
shufps $0x84, %xmm0, %xmm1     # xmm1 = xmm1[0,1],xmm0[0,2]
cvttps2dq %xmm1, %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(%r12)
movw %r15w, 0x18(%r12)
shrl $0x10, %r15d
movb %r15b, 0x1a(%r12)
movb %al, 0x1b(%r12)
movw %bp, 0x1c(%r12)
shrl $0x10, %ebp
movb %bpl, 0x1e(%r12)
movb %cl, 0x1f(%r12)
movq %r14, 0x10(%r12)
movl %r13d, 0x2c(%r12)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x28(%r12)
movq %r12, %rdi
addq $0x30, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x25a38
movb $0x0, 0x30(%r12,%r13)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq