// File: /workspace/github_c_makefile_star2_O3/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 0x4baa9
movq 0x3b56e(%rip), %r13     # 0x86ff0
movq (%r13), %rdi
leaq 0x2530f(%rip), %rsi     # 0x70d9c
leaq 0x25326(%rip), %rdx     # 0x70dba
movl $0x6d31, %ecx           # imm = 0x6D31
xorl %eax, %eax
callq 0x12d80
movq (%r13), %rdi
callq 0x13780
testq %r12, %r12
jne 0x4badc
movq 0x3b53b(%rip), %r13     # 0x86ff0
movq (%r13), %rdi
leaq 0x252dc(%rip), %rsi     # 0x70d9c
leaq 0x252f3(%rip), %rdx     # 0x70dba
movl $0x6d32, %ecx           # imm = 0x6D32
xorl %eax, %eax
callq 0x12d80
movq (%r13), %rdi
callq 0x13780
testq %r14, %r14
je 0x4bb8f
movl %ebp, %edx
testq %r12, %r12
sete %al
testq %rbx, %rbx
sete %cl
xorl %ebp, %ebp
orb %al, %cl
jne 0x4bd0c
testq %r15, %r15
jne 0x4bb09
movq 0x3b4cf(%rip), %r15     # 0x86fd8
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 0x21cf4(%rip), %xmm0    # 0x6d830
movupd %xmm0, 0x3278(%rbx)
movl $0x0, 0x328c(%rbx)
movl %edx, %ebp
btl $0xa, %edx
setae 0x3288(%rbx)
movq %r15, 0x3268(%rbx)
movq $0x0, 0x3270(%rbx)
cmpl $0x0, 0x18c(%r13)
je 0x4bbc2
cmpl 0x180(%r13), %eax
jne 0x4bbc2
testb $0x10, %bpl
jne 0x4bbc6
movl 0x194(%r13), %eax
jmp 0x4bbd1
movq 0x3b45a(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x251fc(%rip), %rsi     # 0x70d9c
leaq 0x25213(%rip), %rdx     # 0x70dba
xorl %ebp, %ebp
movl $0x6d33, %ecx           # imm = 0x6D33
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
jmp 0x4bd0c
xorl %eax, %eax
jmp 0x4bc39
movl (%r14), %esi
movq %r12, %rdi
callq 0x12730
movl %eax, 0x3278(%rbx)
testb $0x20, %bpl
jne 0x4bbed
movd 0x194(%r13), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
jmp 0x4bbf6
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 0x21bed(%rip), %xmm1    # 0x6d810
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 %eax, %ebp
movl 0x3240(%rbx), %eax
movl %eax, (%r14)
cmpb $0x0, 0x3289(%rbx)
je 0x4bd0c
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 0x21919(%rip), %xmm0    # 0x6d610
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