// File: /workspace/github_c_makefile_star2_O3/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_text_clamp
NK_LIB int
nk_text_clamp(const struct nk_user_font *font, const char *text,
    int text_len, float space, int *glyphs, float *text_width,
    nk_rune *sep_list, int sep_count)
{
    int i = 0;
    int glyph_len = 0;
    float last_width = 0;
    nk_rune unicode = 0;
    float width = 0;
    int len = 0;
    int g = 0;
    float s;

    int sep_len = 0;
    int sep_g = 0;
    float sep_width = 0;
    sep_count = NK_MAX(sep_count,0);

    glyph_len = nk_utf_decode(text, &unicode, text_len);
    while (glyph_len && (width < space) && (len < text_len)) {
        len += glyph_len;
        s = font->width(font->userdata, font->height, text, len);
        for (i = 0; i < sep_count; ++i) {
            if (unicode != sep_list[i]) continue;
            sep_width = last_width = width;
            sep_g = g+1;
            sep_len = len;
            break;
        }
        if (i == sep_count){
            last_width = sep_width = width;
            sep_g = g+1;
        }
        width = s;
        glyph_len = nk_utf_decode(&text[len], &unicode, text_len - len);
        g++;
    }
    if (len >= text_len) {
        *glyphs = g;
        *text_width = last_width;
        return len;
    } else {
        *glyphs = sep_g;
        *text_width = sep_width;
        return (!sep_len) ? len: sep_len;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r15
movq %r8, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movss %xmm0, 0x14(%rsp)
movl %edx, %ebp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x1c(%rsp), %rsi
movl $0x0, (%rsi)
movq %rax, 0x20(%rsp)
movq %rax, %rdi
callq 0x12ef0
testl %eax, %eax
setne %cl
xorps %xmm1, %xmm1
xorps %xmm0, %xmm0
movss %xmm0, (%rsp)
movss 0x14(%rsp), %xmm0
ucomiss %xmm1, %xmm0
seta %dl
movl %ebp, 0x18(%rsp)
testl %ebp, %ebp
setg %r13b
andb %r13b, %cl
andb %dl, %cl
xorl %ebp, %ebp
movl $0x0, %r14d
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
xorps %xmm0, %xmm0
cmpb $0x1, %cl
jne 0x28cb1
movl 0x70(%rsp), %r12d
movl $0x0, 0x8(%rsp)
xorps %xmm2, %xmm2
movl $0x0, 0xc(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
movss %xmm0, (%rsp)
movss %xmm2, 0x10(%rsp)
movss %xmm1, 0x4(%rsp)
addl %eax, %ebp
movss 0x8(%rbx), %xmm0
movq (%rbx), %rdi
movq 0x20(%rsp), %rsi
movl %ebp, %edx
callq *0x10(%rbx)
movl 0x1c(%rsp), %ecx
xorl %edx, %edx
movl %edx, %eax
cmpl %r12d, %edx
jge 0x28c25
movl $0x1, %edx
cmpl (%r15), %ecx
jne 0x28bfc
incl %r14d
movss 0x4(%rsp), %xmm1
movaps %xmm1, %xmm2
movl %ebp, 0xc(%rsp)
movl %r14d, %ecx
movaps %xmm1, %xmm3
jmp 0x28c3d
incl %r14d
movss (%rsp), %xmm2
movl 0x8(%rsp), %ecx
movss 0x4(%rsp), %xmm1
movss 0x10(%rsp), %xmm3
movss %xmm1, (%rsp)
cmpl %r12d, %eax
je 0x28c4c
movss %xmm2, (%rsp)
movss %xmm0, 0x10(%rsp)
cmovel %r14d, %ecx
movl %ecx, 0x8(%rsp)
je 0x28c5f
movaps %xmm3, %xmm1
movss %xmm1, 0x4(%rsp)
movslq %ebp, %rdi
addq 0x20(%rsp), %rdi
movl 0x18(%rsp), %edx
subl %ebp, %edx
setg %r13b
leaq 0x1c(%rsp), %rsi
callq 0x12ef0
testl %eax, %eax
je 0x28cab
movss 0x14(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
ucomiss %xmm1, %xmm0
movss 0x4(%rsp), %xmm0
jbe 0x28cb1
movaps %xmm0, %xmm2
cmpl %ebp, 0x18(%rsp)
jg 0x28bd6
jmp 0x28cb1
movss 0x4(%rsp), %xmm0
movl 0xc(%rsp), %eax
testl %eax, %eax
cmovel %ebp, %eax
testb %r13b, %r13b
cmovnel 0x8(%rsp), %r14d
jne 0x28cca
movss (%rsp), %xmm0
cmovnel %eax, %ebp
movq 0x28(%rsp), %rax
movl %r14d, (%rax)
movq 0x30(%rsp), %rax
movss %xmm0, (%rax)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq