// File: /workspace/github_c_makefile_star2_O3/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, %rbp
movq %rdx, %rbx
movl %esi, 0x4(%rsp)
movq %rdi, %r14
testq %rdi, %rdi
jne 0x4bd69
movq 0x3b2ac(%rip), %r15     # 0x86ff0
movq (%r15), %rdi
leaq 0x2504e(%rip), %rsi     # 0x70d9c
leaq 0x25065(%rip), %rdx     # 0x70dba
movl $0x6d70, %ecx           # imm = 0x6D70
xorl %eax, %eax
callq 0x12d80
movq (%r15), %rdi
callq 0x13780
testq %rbx, %rbx
jne 0x4bd9a
movq 0x3b27b(%rip), %r15     # 0x86ff0
movq (%r15), %rdi
leaq 0x2501d(%rip), %rsi     # 0x70d9c
leaq 0x25034(%rip), %rdx     # 0x70dba
movl $0x6d71, %ecx           # imm = 0x6D71
xorl %eax, %eax
callq 0x12d80
movq (%r15), %rdi
callq 0x13780
movq 0x4780(%r14), %r13
testq %r13, %r13
jne 0x4bdd9
movq 0x3b243(%rip), %r15     # 0x86ff0
movq (%r15), %rdi
leaq 0x24fe5(%rip), %rsi     # 0x70d9c
leaq 0x24ffc(%rip), %rdx     # 0x70dba
movl $0x6d72, %ecx           # imm = 0x6D72
xorl %eax, %eax
callq 0x12d80
movq (%r15), %rdi
callq 0x13780
movq 0x4780(%r14), %r13
cmpq $0x0, 0xa8(%r13)
jne 0x4be22
movq 0x3b206(%rip), %r15     # 0x86ff0
movq (%r15), %rdi
leaq 0x24fa8(%rip), %rsi     # 0x70d9c
leaq 0x24fbf(%rip), %rdx     # 0x70dba
xorl %r12d, %r12d
movl $0x6d73, %ecx           # imm = 0x6D73
xorl %eax, %eax
callq 0x12d80
movq (%r15), %rdi
callq 0x13780
movq 0x4780(%r14), %r13
testq %r13, %r13
je 0x4bfa3
cmpq $0x0, 0xa8(%r13)
je 0x4be56
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x128e0
movl %eax, %r12d
testl %eax, %eax
je 0x4bfa3
cmpl $0x3, %r12d
jne 0x4be5e
movl 0x4(%rsp), %edx
orl $0x1, %edx
movq %rbp, %rcx
jmp 0x4be65
xorl %r12d, %r12d
jmp 0x4bfa3
movq %rbp, %rcx
movl 0x4(%rsp), %edx
movq 0xa8(%r13), %rax
movl 0x4(%rax), %eax
movl 0x184(%r13), %ebp
leal 0x1(%rbp), %esi
movl %esi, 0x184(%r13)
movl 0x18c(%r13), %r15d
testl %r15d, %r15d
je 0x4bee1
cmpl 0x180(%r13), %ebp
jne 0x4bee1
testb $0x10, %dl
je 0x4bea6
movl 0x90(%rbx), %esi
movl %esi, 0xa8(%rbx)
testb $0x20, %dl
jne 0x4bebd
movl 0xa8(%rbx), %esi
movl %esi, 0xac(%rbx)
movl %esi, 0xb0(%rbx)
testb $0x40, %dl
je 0x4bee4
movq 0x2590(%r14), %rsi
movq %rsi, 0x10(%rbx)
movups 0x2580(%r14), %xmm0
movups %xmm0, (%rbx)
movl 0x18c(%r13), %r15d
jmp 0x4bee4
xorl %r15d, %r15d
andl $0x1000, %eax           # imm = 0x1000
movb %r15b, 0xb9(%rbx)
movb 0x1a8(%r13), %sil
movb %sil, 0xb4(%rbx)
testq %rcx, %rcx
jne 0x4bf0a
movq 0x3b0ce(%rip), %rcx     # 0x86fd8
movl %edx, %esi
andl $0x1, %esi
xorl %r10d, %r10d
orl %eax, %esi
cmoveq %r14, %r10
leaq 0x2598(%r14), %rdi
leaq 0x68(%r13), %rsi
leaq 0x1260(%r14), %r9
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %rbx, %r8
pushq 0x168(%r14)
pushq %r10
callq 0x4bfb5
addq $0x10, %rsp
movl %eax, %r12d
testb $0x10, 0x2598(%r14)
je 0x4bf66
movq 0x178(%r14), %rax
movq %rax, 0x1a8(%r14)
movb 0xb9(%rbx), %al
testb %al, %al
je 0x4bf89
cmpb %al, %r15b
je 0x4bf89
movl $0x1, 0x18c(%r13)
movl %ebp, 0x180(%r13)
jmp 0x4bfa3
testb %al, %al
setne %al
testb %r15b, %r15b
sete %cl
orb %al, %cl
jne 0x4bfa3
movl $0x0, 0x18c(%r13)
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq