// File: /workspace/github_c_makefile_star2_O1/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, %r15
movl %r8d, 0xc(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x4c6b0
movq 0x3b967(%rip), %r13     # 0x87ff0
movq (%r13), %rdi
leaq 0x256f8(%rip), %rsi     # 0x71d8c
leaq 0x2570f(%rip), %rdx     # 0x71daa
movl $0x6d31, %ecx           # imm = 0x6D31
xorl %eax, %eax
callq 0x12d80
movq (%r13), %rdi
callq 0x13780
testq %r12, %r12
jne 0x4c6e3
movq 0x3b934(%rip), %r13     # 0x87ff0
movq (%r13), %rdi
leaq 0x256c5(%rip), %rsi     # 0x71d8c
leaq 0x256dc(%rip), %rdx     # 0x71daa
movl $0x6d32, %ecx           # imm = 0x6D32
xorl %eax, %eax
callq 0x12d80
movq (%r13), %rdi
callq 0x13780
testq %r14, %r14
jne 0x4c716
movq 0x3b901(%rip), %r13     # 0x87ff0
movq (%r13), %rdi
leaq 0x25692(%rip), %rsi     # 0x71d8c
leaq 0x256a9(%rip), %rdx     # 0x71daa
movl $0x6d33, %ecx           # imm = 0x6D33
xorl %eax, %eax
callq 0x12d80
movq (%r13), %rdi
callq 0x13780
testq %r14, %r14
sete %cl
testq %r12, %r12
sete %al
testq %rbx, %rbx
sete %dl
orb %al, %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x4c914
testq %r15, %r15
jne 0x4c740
movq 0x3b898(%rip), %r15     # 0x87fd8
movq 0x4780(%rbx), %r13
movl 0x184(%r13), %eax
leaq 0x31d0(%rbx), %rcx
movq %rcx, 0x10(%rsp)
movabsq $0x3e7000000630000, %rcx # imm = 0x3E7000000630000
movq %rcx, 0x46d0(%rbx)
movapd 0x220dd(%rip), %xmm0    # 0x6e850
movupd %xmm0, 0x3278(%rbx)
movl $0x0, 0x328c(%rbx)
btl $0xa, %ebp
setae 0x3288(%rbx)
movq %r15, 0x3268(%rbx)
movq $0x0, 0x3270(%rbx)
cmpl $0x0, 0x18c(%r13)
je 0x4c7c4
cmpl 0x180(%r13), %eax
jne 0x4c7c4
testb $0x10, %bpl
jne 0x4c7c8
movl 0x194(%r13), %eax
jmp 0x4c7d3
xorl %eax, %eax
jmp 0x4c843
movl (%r14), %esi
movq %r12, %rdi
callq 0x12730
movl %eax, 0x3278(%rbx)
testb $0x20, %bpl
jne 0x4c7ee
movl 0x194(%r13), %eax
movl %eax, 0x327c(%rbx)
jmp 0x4c802
movl 0x198(%r13), %eax
movl %eax, 0x327c(%rbx)
movl 0x19c(%r13), %eax
movl %eax, 0x3280(%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 0x22003(%rip), %xmm1    # 0x6e830
orpd %xmm1, %xmm0
subpd %xmm1, %xmm0
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, 0x3270(%rbx)
movb $0x1, %al
movl 0xc(%rsp), %ecx
cmpl $0x2, %ecx
movl $0x1, %edx
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 0x12680
movl $0x0, 0x3260(%rbx)
movslq (%r14), %rsi
movq %rsi, 0x3240(%rbx)
movq %r12, %rdi
callq 0x12730
movl %eax, 0x3260(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movq 0x10(%rsp), %rdx
movq %r15, %rcx
callq 0x121d0
movl 0x3240(%rbx), %ecx
movl %ecx, (%r14)
cmpb $0x0, 0x3289(%rbx)
je 0x4c914
movq 0x3278(%rbx), %rcx
movq %rcx, 0x194(%r13)
movl 0x3280(%rbx), %ecx
movl %ecx, 0x19c(%r13)
movb 0x3284(%rbx), %cl
movb %cl, 0x1a8(%r13)
movsd 0x3270(%rbx), %xmm0
cvttps2dq %xmm0, %xmm1
movdqa %xmm1, %xmm2
psrad $0x1f, %xmm2
subps 0x21d01(%rip), %xmm0    # 0x6e600
cvttps2dq %xmm0, %xmm0
pand %xmm2, %xmm0
por %xmm1, %xmm0
movq %xmm0, 0x1a0(%r13)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq