// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_edit_buffer
NK_API nk_flags
nk_edit_buffer(struct nk_context *ctx, nk_flags flags,
    struct nk_text_edit *edit, nk_plugin_filter filter)
{
    struct nk_window *win;
    struct nk_style *style;
    struct nk_input *in;

    enum nk_widget_layout_states state;
    struct nk_rect bounds;

    nk_flags ret_flags = 0;
    unsigned char prev_state;
    nk_hash hash;

    /* make sure correct values */
    NK_ASSERT(ctx);
    NK_ASSERT(edit);
    NK_ASSERT(ctx->current);
    NK_ASSERT(ctx->current->layout);
    if (!ctx || !ctx->current || !ctx->current->layout)
        return 0;

    win = ctx->current;
    style = &ctx->style;
    state = nk_widget(&bounds, ctx);
    if (!state) return state;
    else if (state == NK_WIDGET_DISABLED)
        flags |= NK_EDIT_READ_ONLY;
    in = (win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;

    /* check if edit is currently hot item */
    hash = win->edit.seq++;
    if (win->edit.active && hash == win->edit.name) {
        if (flags & NK_EDIT_NO_CURSOR)
            edit->cursor = edit->string.len;
        if (!(flags & NK_EDIT_SELECTABLE)) {
            edit->select_start = edit->cursor;
            edit->select_end = edit->cursor;
        }
        if (flags & NK_EDIT_CLIPBOARD)
            edit->clip = ctx->clip;
        edit->active = (unsigned char)win->edit.active;
    } else edit->active = nk_false;
    edit->mode = win->edit.mode;

    filter = (!filter) ? nk_filter_default: filter;
    prev_state = (unsigned char)edit->active;
    in = (flags & NK_EDIT_READ_ONLY) ? 0: in;
    ret_flags = nk_do_edit(&ctx->last_widget_state, &win->buffer, bounds, flags,
                    filter, edit, &style->edit, in, style->font);

    if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
        ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_TEXT];
    if (edit->active && prev_state != edit->active) {
        /* current edit is now hot */
        win->edit.active = nk_true;
        win->edit.name = hash;
    } else if (prev_state && !edit->active) {
        /* current edit is now cold */
        win->edit.active = nk_false;
    } return ret_flags;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
testq %rdi, %rdi
jne 0x4c96f
movq 0x3b6a8(%rip), %r12     # 0x87ff0
movq (%r12), %rdi
leaq 0x25439(%rip), %rsi     # 0x71d8c
leaq 0x25450(%rip), %rdx     # 0x71daa
movl $0x6d70, %ecx           # imm = 0x6D70
xorl %eax, %eax
callq 0x12d80
movq (%r12), %rdi
callq 0x13780
testq %rbx, %rbx
jne 0x4c9a2
movq 0x3b675(%rip), %r12     # 0x87ff0
movq (%r12), %rdi
leaq 0x25406(%rip), %rsi     # 0x71d8c
leaq 0x2541d(%rip), %rdx     # 0x71daa
movl $0x6d71, %ecx           # imm = 0x6D71
xorl %eax, %eax
callq 0x12d80
movq (%r12), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%r14)
jne 0x4c9da
movq 0x3b63d(%rip), %r12     # 0x87ff0
movq (%r12), %rdi
leaq 0x253ce(%rip), %rsi     # 0x71d8c
leaq 0x253e5(%rip), %rdx     # 0x71daa
movl $0x6d72, %ecx           # imm = 0x6D72
xorl %eax, %eax
callq 0x12d80
movq (%r12), %rdi
callq 0x13780
movq 0x4780(%r14), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x4ca19
movq 0x3b5fe(%rip), %r12     # 0x87ff0
movq (%r12), %rdi
leaq 0x2538f(%rip), %rsi     # 0x71d8c
leaq 0x253a6(%rip), %rdx     # 0x71daa
movl $0x6d73, %ecx           # imm = 0x6D73
xorl %eax, %eax
callq 0x12d80
movq (%r12), %rdi
callq 0x13780
xorl %eax, %eax
testq %r14, %r14
je 0x4cbbb
movq 0x4780(%r14), %r12
testq %r12, %r12
je 0x4cbbb
cmpq $0x0, 0xa8(%r12)
je 0x4cbbb
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x128e0
testl %eax, %eax
je 0x4cbbb
cmpl $0x3, %eax
jne 0x4ca60
orl $0x1, %ebp
movq 0xa8(%r12), %rax
movl 0x4(%rax), %eax
movl 0x184(%r12), %edx
leal 0x1(%rdx), %ecx
movl %ecx, 0x184(%r12)
cmpl $0x0, 0x18c(%r12)
je 0x4cae3
cmpl 0x180(%r12), %edx
jne 0x4cae3
testb $0x10, %bpl
je 0x4caa5
movl 0x90(%rbx), %ecx
movl %ecx, 0xa8(%rbx)
testb $0x20, %bpl
jne 0x4cabd
movl 0xa8(%rbx), %ecx
movl %ecx, 0xac(%rbx)
movl %ecx, 0xb0(%rbx)
testb $0x40, %bpl
je 0x4cad9
movq 0x2590(%r14), %rcx
movq %rcx, 0x10(%rbx)
movups 0x2580(%r14), %xmm0
movups %xmm0, (%rbx)
movb 0x18c(%r12), %r13b
jmp 0x4cae6
xorl %r13d, %r13d
movq %rdx, (%rsp)
andl $0x1000, %eax           # imm = 0x1000
movb %r13b, 0xb9(%rbx)
movb 0x1a8(%r12), %cl
movb %cl, 0xb4(%rbx)
testq %r15, %r15
jne 0x4cb10
movq 0x3b4c8(%rip), %r15     # 0x87fd8
movl %ebp, %ecx
andl $0x1, %ecx
xorl %r10d, %r10d
orl %eax, %ecx
cmoveq %r14, %r10
leaq 0x2598(%r14), %rdi
leaq 0x68(%r12), %rsi
leaq 0x1260(%r14), %r9
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movl %ebp, %edx
movq %r15, %rcx
movq %rbx, %r8
pushq 0x168(%r14)
pushq %r10
callq 0x4cbca
addq $0x10, %rsp
testb $0x10, 0x2598(%r14)
je 0x4cb6f
movq 0x178(%r14), %rcx
movq %rcx, 0x1a8(%r14)
movb 0xb9(%rbx), %cl
testb %cl, %cl
sete %dl
cmpb %cl, %r13b
sete %sil
orb %dl, %sil
je 0x4cba3
testb %cl, %cl
setne %cl
testb %r13b, %r13b
sete %dl
orb %cl, %dl
jne 0x4cbbb
movl $0x0, 0x18c(%r12)
jmp 0x4cbbb
movl $0x1, 0x18c(%r12)
movq (%rsp), %rcx
movl %ecx, 0x180(%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq