// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_edit_string
NK_API nk_flags
nk_edit_string(struct nk_context *ctx, nk_flags flags,
    char *memory, int *len, int max, nk_plugin_filter filter)
{
    nk_hash hash;
    nk_flags state;
    struct nk_text_edit *edit;
    struct nk_window *win;

    NK_ASSERT(ctx);
    NK_ASSERT(memory);
    NK_ASSERT(len);
    if (!ctx || !memory || !len)
        return 0;

    filter = (!filter) ? nk_filter_default: filter;
    win = ctx->current;
    hash = win->edit.seq;
    edit = &ctx->text_edit;
    nk_textedit_clear_state(&ctx->text_edit, (flags & NK_EDIT_MULTILINE)?
        NK_TEXT_EDIT_MULTI_LINE: NK_TEXT_EDIT_SINGLE_LINE, filter);

    if (win->edit.active && hash == win->edit.name) {
        if (flags & NK_EDIT_NO_CURSOR)
            edit->cursor = nk_utf_len(memory, *len);
        else edit->cursor = win->edit.cursor;
        if (!(flags & NK_EDIT_SELECTABLE)) {
            edit->select_start = win->edit.cursor;
            edit->select_end = win->edit.cursor;
        } else {
            edit->select_start = win->edit.sel_start;
            edit->select_end = win->edit.sel_end;
        }
        edit->mode = win->edit.mode;
        edit->scrollbar.x = (float)win->edit.scrollbar.x;
        edit->scrollbar.y = (float)win->edit.scrollbar.y;
        edit->active = nk_true;
    } else edit->active = nk_false;

    max = NK_MAX(1, max);
    *len = NK_MIN(*len, max-1);
    nk_str_init_fixed(&edit->string, memory, (nk_size)max);
    edit->string.buffer.allocated = (nk_size)*len;
    edit->string.len = nk_utf_len(memory, *len);
    state = nk_edit_buffer(ctx, flags, edit, filter);
    *len = (int)edit->string.buffer.allocated;

    if (edit->active) {
        win->edit.cursor = edit->cursor;
        win->edit.sel_start = edit->select_start;
        win->edit.sel_end = edit->select_end;
        win->edit.mode = edit->mode;
        win->edit.scrollbar.x = (nk_uint)edit->scrollbar.x;
        win->edit.scrollbar.y = (nk_uint)edit->scrollbar.y;
    } return state;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x8(%rsp)
movl %r8d, %r15d
movq %rcx, %r14
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x47ac0
movq 0x3d557(%rip), %r13     # 0x84ff0
movq (%r13), %rdi
leaq 0x22268(%rip), %rsi     # 0x69d0c
leaq 0x2227f(%rip), %rdx     # 0x69d2a
movl $0x6d31, %ecx           # imm = 0x6D31
xorl %eax, %eax
callq 0x12ea0
movq (%r13), %rdi
callq 0x13960
testq %r12, %r12
jne 0x47af3
movq 0x3d524(%rip), %r13     # 0x84ff0
movq (%r13), %rdi
leaq 0x22235(%rip), %rsi     # 0x69d0c
leaq 0x2224c(%rip), %rdx     # 0x69d2a
movl $0x6d32, %ecx           # imm = 0x6D32
xorl %eax, %eax
callq 0x12ea0
movq (%r13), %rdi
callq 0x13960
testq %r14, %r14
je 0x47b76
movl %r15d, 0x4(%rsp)
movl %ebp, %r15d
testq %r12, %r12
sete %al
testq %rbx, %rbx
sete %cl
xorl %ebp, %ebp
orb %al, %cl
jne 0x47cee
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
jne 0x47b27
movq 0x3d4b1(%rip), %rdx     # 0x84fd8
movq 0x4780(%rbx), %r13
movl 0x184(%r13), %ebp
leaq 0x31d0(%rbx), %rdi
movl %r15d, %esi
shrl $0xa, %esi
andl $0x1, %esi
movq %rdi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
callq 0x476ee
cmpl $0x0, 0x18c(%r13)
je 0x47ba9
cmpl 0x180(%r13), %ebp
jne 0x47ba9
testb $0x10, %r15b
jne 0x47bb1
movl 0x194(%r13), %eax
jmp 0x47bbc
movq 0x3d473(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x22185(%rip), %rsi     # 0x69d0c
leaq 0x2219c(%rip), %rdx     # 0x69d2a
xorl %ebp, %ebp
movl $0x6d33, %ecx           # imm = 0x6D33
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
jmp 0x47cee
xorl %eax, %eax
movl 0x4(%rsp), %ecx
jmp 0x47c28
movl (%r14), %esi
movq %r12, %rdi
callq 0x127b0
movl 0x4(%rsp), %ecx
movl %eax, 0x3278(%rbx)
testb $0x20, %r15b
jne 0x47bdc
movd 0x194(%r13), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
jmp 0x47be5
movq 0x198(%r13), %xmm0
movq %xmm0, 0x327c(%rbx)
movb 0x1a8(%r13), %al
movb %al, 0x3284(%rbx)
movsd 0x1a0(%r13), %xmm0
xorpd %xmm1, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x1eb7e(%rip), %xmm1    # 0x66790
orpd %xmm1, %xmm0
subpd %xmm1, %xmm0
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, 0x3270(%rbx)
movb $0x1, %al
cmpl $0x2, %ecx
pushq $0x1
popq %rdx
cmovgel %ecx, %edx
movb %al, 0x3289(%rbx)
movl (%r14), %eax
leal -0x1(%rdx), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, (%r14)
leaq 0x31e8(%rbx), %rdi
movq %r12, %rsi
callq 0x14220
movslq (%r14), %rsi
movq %rsi, 0x3240(%rbx)
movq %r12, %rdi
callq 0x127b0
movl %eax, 0x3260(%rbx)
movq %rbx, %rdi
movl %r15d, %esi
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0x12200
movl %eax, %ebp
movl 0x3240(%rbx), %eax
movl %eax, (%r14)
cmpb $0x0, 0x3289(%rbx)
je 0x47cee
movq 0x3278(%rbx), %rax
movq %rax, 0x194(%r13)
movl 0x3280(%rbx), %eax
movl %eax, 0x19c(%r13)
movb 0x3284(%rbx), %al
movb %al, 0x1a8(%r13)
movsd 0x3270(%rbx), %xmm0
cvttps2dq %xmm0, %xmm1
movdqa %xmm1, %xmm2
psrad $0x1f, %xmm2
subps 0x1e927(%rip), %xmm0    # 0x66600
cvttps2dq %xmm0, %xmm0
pand %xmm2, %xmm0
por %xmm1, %xmm0
movq %xmm0, 0x1a0(%r13)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq