// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %r9, %r12
movq %r8, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movss %xmm0, 0x24(%rsp)
movq %rsi, %rax
movq %rdi, %rbx
movl 0x80(%rsp), %r14d
leaq 0x20(%rsp), %rsi
andl $0x0, (%rsi)
movq %rax, 0x30(%rsp)
movq %rax, %rdi
movl %edx, 0x18(%rsp)
callq 0x13020
xorl %r15d, %r15d
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
pushq $0x1
popq %r13
xorps %xmm1, %xmm1
xorl %ebp, %ebp
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x14(%rsp)
movss %xmm0, 0x10(%rsp)
testl %eax, %eax
je 0x27475
movss 0x24(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x27475
cmpl 0x18(%rsp), %r15d
jge 0x27475
addl %eax, %r15d
movss 0x8(%rbx), %xmm0
movq (%rbx), %rdi
movq 0x30(%rsp), %rsi
movl %r15d, %edx
movss %xmm1, 0x2c(%rsp)
callq *0x10(%rbx)
movss 0x2c(%rsp), %xmm1
xorl %edx, %edx
movl 0x20(%rsp), %ecx
movss %xmm0, 0x28(%rsp)
movl %edx, %eax
cmpl %r14d, %edx
jge 0x2741f
movl %r13d, %edx
cmpl (%r12), %ecx
jne 0x273f9
incl %ebp
movaps %xmm1, %xmm0
movl %r15d, 0x1c(%rsp)
movl %ebp, 0x14(%rsp)
movss %xmm1, 0x10(%rsp)
jmp 0x27427
incl %ebp
movss 0xc(%rsp), %xmm0
movss %xmm1, 0xc(%rsp)
cmpl %r14d, %eax
je 0x27438
movss %xmm0, 0xc(%rsp)
movl 0x14(%rsp), %eax
cmovel %ebp, %eax
movl %eax, 0x14(%rsp)
je 0x2744b
movss 0x10(%rsp), %xmm1
movss %xmm1, 0x10(%rsp)
movslq %r15d, %rdi
addq 0x30(%rsp), %rdi
movl 0x18(%rsp), %edx
subl %r15d, %edx
leaq 0x20(%rsp), %rsi
callq 0x13020
movss 0x28(%rsp), %xmm1
jmp 0x273a9
movl 0x1c(%rsp), %eax
testl %eax, %eax
cmovel %r15d, %eax
cmpl 0x18(%rsp), %r15d
cmovll 0x14(%rsp), %ebp
movss 0x10(%rsp), %xmm0
jl 0x27497
movss 0xc(%rsp), %xmm0
cmovll %eax, %r15d
movq 0x38(%rsp), %rax
movl %ebp, (%rax)
movq 0x40(%rsp), %rax
movss %xmm0, (%rax)
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq