// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_text_calculate_text_bounds
NK_LIB struct nk_vec2
nk_text_calculate_text_bounds(const struct nk_user_font *font,
    const char *begin, int byte_len, float row_height, const char **remaining,
    struct nk_vec2 *out_offset, int *glyphs, int op)
{
    float line_height = row_height;
    struct nk_vec2 text_size = nk_vec2(0,0);
    float line_width = 0.0f;

    float glyph_width;
    int glyph_len = 0;
    nk_rune unicode = 0;
    int text_len = 0;
    if (!begin || byte_len <= 0 || !font)
        return nk_vec2(0,row_height);

    glyph_len = nk_utf_decode(begin, &unicode, byte_len);
    if (!glyph_len) return text_size;
    glyph_width = font->width(font->userdata, font->height, begin, glyph_len);

    *glyphs = 0;
    while ((text_len < byte_len) && glyph_len) {
        if (unicode == '\n') {
            text_size.x = NK_MAX(text_size.x, line_width);
            text_size.y += line_height;
            line_width = 0;
            *glyphs+=1;
            if (op == NK_STOP_ON_NEW_LINE)
                break;

            text_len++;
            glyph_len = nk_utf_decode(begin + text_len, &unicode, byte_len-text_len);
            continue;
        }

        if (unicode == '\r') {
            text_len++;
            *glyphs+=1;
            glyph_len = nk_utf_decode(begin + text_len, &unicode, byte_len-text_len);
            continue;
        }

        *glyphs = *glyphs + 1;
        text_len += glyph_len;
        line_width += (float)glyph_width;
        glyph_len = nk_utf_decode(begin + text_len, &unicode, byte_len-text_len);
        glyph_width = font->width(font->userdata, font->height, begin+text_len, glyph_len);
        continue;
    }

    if (text_size.x < line_width)
        text_size.x = line_width;
    if (out_offset)
        *out_offset = nk_vec2(line_width, text_size.y + line_height);
    if (line_width > 0 || text_size.y == 0.0f)
        text_size.y += line_height;
    if (remaining)
        *remaining = begin+text_len;
    return text_size;
}

// 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)
movss 0x58(%rsp), %xmm0
movss %xmm0, 0x3c(%rsp)
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x13460
movlpd %xmm0, 0x34(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x8d093
cmpl $0x0, 0x5c(%rsp)
jle 0x8d093
cmpq $0x0, 0x68(%rsp)
jne 0x8d0ac
movss 0x58(%rsp), %xmm1
xorps %xmm0, %xmm0
callq 0x13460
movlpd %xmm0, 0x70(%rsp)
jmp 0x8d369
movq 0x60(%rsp), %rdi
movl 0x5c(%rsp), %edx
leaq 0x24(%rsp), %rsi
callq 0x14030
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
jne 0x8d0d9
movq 0x34(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0x8d369
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, 0x2c(%rsp)
movq 0x40(%rsp), %rax
movl $0x0, (%rax)
movl 0x20(%rsp), %ecx
xorl %eax, %eax
cmpl 0x5c(%rsp), %ecx
movb %al, 0x17(%rsp)
jge 0x8d12c
cmpl $0x0, 0x28(%rsp)
setne %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x8d139
jmp 0x8d2b5
cmpl $0xa, 0x24(%rsp)
jne 0x8d1e4
movss 0x34(%rsp), %xmm1
movss 0x30(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x8d163
movss 0x30(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
jmp 0x8d16f
movss 0x34(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movss 0x3c(%rsp), %xmm0
addss 0x38(%rsp), %xmm0
movss %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x30(%rsp)
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpl $0x1, 0x80(%rsp)
jne 0x8d1b1
jmp 0x8d2b5
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x60(%rsp), %rdi
movslq 0x20(%rsp), %rax
addq %rax, %rdi
movl 0x5c(%rsp), %edx
subl 0x20(%rsp), %edx
leaq 0x24(%rsp), %rsi
callq 0x14030
movl %eax, 0x28(%rsp)
jmp 0x8d110
cmpl $0xd, 0x24(%rsp)
jne 0x8d22a
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x60(%rsp), %rdi
movslq 0x20(%rsp), %rax
addq %rax, %rdi
movl 0x5c(%rsp), %edx
subl 0x20(%rsp), %edx
leaq 0x24(%rsp), %rsi
callq 0x14030
movl %eax, 0x28(%rsp)
jmp 0x8d110
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
movl 0x28(%rsp), %eax
addl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
movss 0x2c(%rsp), %xmm0
addss 0x30(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movq 0x60(%rsp), %rdi
movslq 0x20(%rsp), %rax
addq %rax, %rdi
movl 0x5c(%rsp), %edx
subl 0x20(%rsp), %edx
leaq 0x24(%rsp), %rsi
callq 0x14030
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
movslq 0x20(%rsp), %rdx
addq %rdx, %rsi
movl 0x28(%rsp), %edx
movq (%rcx), %rdi
callq *%rax
movss %xmm0, 0x2c(%rsp)
jmp 0x8d110
movss 0x34(%rsp), %xmm1
movss 0x30(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x8d2d2
movss 0x30(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x8d312
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movss 0x30(%rsp), %xmm0
movss 0x38(%rsp), %xmm1
movss 0x3c(%rsp), %xmm2
addss %xmm2, %xmm1
callq 0x13460
movq 0x8(%rsp), %rax
movlpd %xmm0, 0x18(%rsp)
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
movss 0x30(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
ja 0x8d330
movss 0x38(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x8d342
jp 0x8d342
movss 0x3c(%rsp), %xmm0
addss 0x38(%rsp), %xmm0
movss %xmm0, 0x38(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x8d35f
movq 0x60(%rsp), %rcx
movslq 0x20(%rsp), %rax
addq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
movq 0x34(%rsp), %rax
movq %rax, 0x70(%rsp)
movsd 0x70(%rsp), %xmm0
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)