// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_textedit_find_charpos
NK_INTERN void
nk_textedit_find_charpos(struct nk_text_find *find, struct nk_text_edit *state,
    int n, int single_line, const struct nk_user_font *font, float row_height)
{
    /* find the x/y location of a character, and remember info about the previous
     * row in case we get a move-up event (for page up, we'll have to rescan) */
    struct nk_text_edit_row r;
    int prev_start = 0;
    int z = state->string.len;
    int i=0, first;

    nk_zero_struct(r);
    if (n == z) {
        /* if it's at the end, then find the last line -- simpler than trying to
        explicitly handle this case in the regular code */
        nk_textedit_layout_row(&r, state, 0, row_height, font);
        if (single_line) {
            find->first_char = 0;
            find->length = z;
        } else {
            while (i < z) {
                prev_start = i;
                i += r.num_chars;
                nk_textedit_layout_row(&r, state, i, row_height, font);
            }

            find->first_char = i;
            find->length = r.num_chars;
        }
        find->x = r.x1;
        find->y = r.ymin;
        find->height = r.ymax - r.ymin;
        find->prev_first = prev_start;
        return;
    }

    /* search rows to find the one that straddles character n */
    find->y = 0;

    for(;;) {
        nk_textedit_layout_row(&r, state, i, row_height, font);
        if (n < i + r.num_chars) break;
        prev_start = i;
        i += r.num_chars;
        find->y += r.baseline_y_delta;
    }

    find->first_char = first = i;
    find->length = r.num_chars;
    find->height = r.ymax - r.ymin;
    find->prev_first = prev_start;

    /* now scan to find xpos */
    find->x = r.x0;
    for (i=0; first+i < n; ++i)
        find->x += nk_textedit_get_width(state, first, i, font);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl %edx, 0x44(%rsp)
movl %ecx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movss %xmm0, 0x34(%rsp)
movl $0x0, 0x18(%rsp)
movq 0x48(%rsp), %rax
movl 0x90(%rax), %eax
movl %eax, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
leaq 0x1c(%rsp), %rdi
movl $0x18, %esi
callq 0x2f0e0
movl 0x44(%rsp), %eax
cmpl 0x14(%rsp), %eax
jne 0x8e068
movq 0x48(%rsp), %rsi
movss 0x34(%rsp), %xmm0
movq 0x38(%rsp), %rcx
leaq 0x1c(%rsp), %rdi
xorl %edx, %edx
callq 0x8db60
cmpl $0x0, 0x40(%rsp)
je 0x8dfca
movq 0x50(%rsp), %rax
movl $0x0, 0xc(%rax)
movl 0x14(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x10(%rax)
jmp 0x8e022
jmp 0x8dfcc
movl 0x10(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x8e00a
movl 0x10(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x30(%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x48(%rsp), %rsi
movl 0x10(%rsp), %edx
movss 0x34(%rsp), %xmm0
movq 0x38(%rsp), %rcx
leaq 0x1c(%rsp), %rdi
callq 0x8db60
jmp 0x8dfcc
movl 0x10(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x30(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x10(%rax)
movss 0x20(%rsp), %xmm0
movq 0x50(%rsp), %rax
movss %xmm0, (%rax)
movss 0x28(%rsp), %xmm0
movq 0x50(%rsp), %rax
movss %xmm0, 0x4(%rax)
movss 0x2c(%rsp), %xmm0
subss 0x28(%rsp), %xmm0
movq 0x50(%rsp), %rax
movss %xmm0, 0x8(%rax)
movl 0x18(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x14(%rax)
jmp 0x8e164
movq 0x50(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x4(%rax)
movq 0x48(%rsp), %rsi
movl 0x10(%rsp), %edx
movss 0x34(%rsp), %xmm0
movq 0x38(%rsp), %rcx
leaq 0x1c(%rsp), %rdi
callq 0x8db60
movl 0x44(%rsp), %eax
movl 0x10(%rsp), %ecx
addl 0x30(%rsp), %ecx
cmpl %ecx, %eax
jge 0x8e0a5
jmp 0x8e0d0
movl 0x10(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x30(%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movss 0x24(%rsp), %xmm0
movq 0x50(%rsp), %rax
addss 0x4(%rax), %xmm0
movss %xmm0, 0x4(%rax)
jmp 0x8e075
movl 0x10(%rsp), %ecx
movl %ecx, 0xc(%rsp)
movq 0x50(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x30(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x10(%rax)
movss 0x2c(%rsp), %xmm0
subss 0x28(%rsp), %xmm0
movq 0x50(%rsp), %rax
movss %xmm0, 0x8(%rax)
movl 0x18(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x14(%rax)
movss 0x1c(%rsp), %xmm0
movq 0x50(%rsp), %rax
movss %xmm0, (%rax)
movl $0x0, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl 0x10(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x8e164
movq 0x48(%rsp), %rdi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movq 0x38(%rsp), %rcx
callq 0x8dc70
movq 0x50(%rsp), %rax
addss (%rax), %xmm0
movss %xmm0, (%rax)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x8e125
addq $0x58, %rsp
retq
nopl (%rax)