// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movl 0x80(%rsp), %eax
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movl %edx, 0x5c(%rsp)
movss %xmm0, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movq %r8, 0x48(%rsp)
movq %r9, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x38(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x2c(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x14(%rsp)
cmpl $0x0, 0x80(%rsp)
jge 0x34ab3
xorl %eax, %eax
movl %eax, 0x10(%rsp)
jmp 0x34abe
movl 0x80(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0x80(%rsp)
movq 0x60(%rsp), %rdi
movl 0x5c(%rsp), %edx
leaq 0x30(%rsp), %rsi
callq 0x14030
movl %eax, 0x38(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x38(%rsp)
movb %al, 0xf(%rsp)
je 0x34b13
movss 0x2c(%rsp), %xmm1
movss 0x58(%rsp), %xmm0
xorl %eax, %eax
ucomiss %xmm1, %xmm0
movb %al, 0xf(%rsp)
jbe 0x34b13
movl 0x28(%rsp), %eax
cmpl 0x5c(%rsp), %eax
setl %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x34b20
jmp 0x34c1f
movl 0x38(%rsp), %eax
addl 0x28(%rsp), %eax
movl %eax, 0x28(%rsp)
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x68(%rsp), %rcx
movq 0x68(%rsp), %rdx
movss 0x8(%rdx), %xmm0
movq 0x60(%rsp), %rsi
movl 0x28(%rsp), %edx
movq (%rcx), %rdi
callq *%rax
movss %xmm0, 0x20(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x80(%rsp), %eax
jge 0x34bb6
movl 0x30(%rsp), %eax
movq 0x40(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x34b82
jmp 0x34ba9
movss 0x2c(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movss %xmm0, 0x14(%rsp)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movl 0x28(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x34bb6
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x34b60
movl 0x3c(%rsp), %eax
cmpl 0x80(%rsp), %eax
jne 0x34be0
movss 0x2c(%rsp), %xmm0
movss %xmm0, 0x14(%rsp)
movss %xmm0, 0x34(%rsp)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movss 0x20(%rsp), %xmm0
movss %xmm0, 0x2c(%rsp)
movq 0x60(%rsp), %rdi
movslq 0x28(%rsp), %rax
addq %rax, %rdi
movl 0x5c(%rsp), %edx
subl 0x28(%rsp), %edx
leaq 0x30(%rsp), %rsi
callq 0x14030
movl %eax, 0x38(%rsp)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x34ae0
movl 0x28(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jl 0x34c4d
movl 0x24(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movss 0x34(%rsp), %xmm0
movq 0x48(%rsp), %rax
movss %xmm0, (%rax)
movl 0x28(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x34c88
movl 0x18(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movss 0x14(%rsp), %xmm0
movq 0x48(%rsp), %rax
movss %xmm0, (%rax)
cmpl $0x0, 0x1c(%rsp)
jne 0x34c78
movl 0x28(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x34c80
movl 0x1c(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)