// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_nonblock_begin
NK_LIB nk_bool
nk_nonblock_begin(struct nk_context *ctx,
    nk_flags flags, struct nk_rect body, struct nk_rect header,
    enum nk_panel_type panel_type)
{
    struct nk_window *popup;
    struct nk_window *win;
    struct nk_panel *panel;
    int is_active = nk_true;

    NK_ASSERT(ctx);
    NK_ASSERT(ctx->current);
    NK_ASSERT(ctx->current->layout);
    if (!ctx || !ctx->current || !ctx->current->layout)
        return 0;

    /* popups cannot have popups */
    win = ctx->current;
    panel = win->layout;
    NK_ASSERT(!((int)panel->type & (int)NK_PANEL_SET_POPUP));
    (void)panel;
    popup = win->popup.win;
    if (!popup) {
        /* create window for nonblocking popup */
        popup = (struct nk_window*)nk_create_window(ctx);
        popup->parent = win;
        win->popup.win = popup;
        win->popup.type = panel_type;
        nk_command_buffer_init(&popup->buffer, &ctx->memory, NK_CLIPPING_ON);
    } else {
        /* close the popup if user pressed outside or in the header */
        int pressed, in_body, in_header;
#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
        pressed = nk_input_is_mouse_released(&ctx->input, NK_BUTTON_LEFT);
#else
        pressed = nk_input_is_mouse_pressed(&ctx->input, NK_BUTTON_LEFT);
#endif
        in_body = nk_input_is_mouse_hovering_rect(&ctx->input, body);
        in_header = nk_input_is_mouse_hovering_rect(&ctx->input, header);
        if (pressed && (!in_body || in_header))
            is_active = nk_false;
    }
    win->popup.header = header;

    if (!is_active) {
        /* remove read only mode from all parent panels */
        struct nk_panel *root = win->layout;
        while (root) {
            root->flags |= NK_WINDOW_REMOVE_ROM;
            root = root->parent;
        }
        return is_active;
    }
    popup->bounds = body;
    popup->parent = win;
    popup->layout = (struct nk_panel*)nk_create_panel(ctx);
    popup->flags = flags;
    popup->flags |= NK_WINDOW_BORDER;
    popup->flags |= NK_WINDOW_DYNAMIC;
    popup->seq = ctx->seq;
    win->popup.active = 1;
    NK_ASSERT(popup->layout);

    nk_start_popup(ctx, win);
    popup->buffer = win->buffer;
    nk_push_scissor(&popup->buffer, nk_null_rect);
    ctx->current = popup;

    nk_panel_begin(ctx, 0, panel_type);
    win->buffer = popup->buffer;
    popup->layout->parent = win->layout;
    popup->layout->offset_x = &popup->scrollbar.x;
    popup->layout->offset_y = &popup->scrollbar.y;

    /* set read only mode to all parent panels */
    {struct nk_panel *root;
    root = win->layout;
    while (root) {
        root->flags |= NK_WINDOW_ROM;
        root = root->parent;
    }}
    return is_active;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %r15d
movaps %xmm3, 0x10(%rsp)
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movl %esi, %ebp
movq %rdi, %r14
movq 0x4780(%rdi), %r13
testq %r13, %r13
jne 0x3aa06
movq 0x4a616(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x2f328(%rip), %rsi     # 0x69d0c
leaq 0x2f33f(%rip), %rdx     # 0x69d2a
movl $0x5216, %ecx           # imm = 0x5216
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
movq 0x4780(%r14), %r13
cmpq $0x0, 0xa8(%r13)
jne 0x3aa4f
movq 0x4a5d9(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x2f2eb(%rip), %rsi     # 0x69d0c
leaq 0x2f302(%rip), %rdx     # 0x69d2a
xorl %r12d, %r12d
movl $0x5217, %ecx           # imm = 0x5217
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
movq 0x4780(%r14), %r13
testq %r13, %r13
je 0x3ab2a
movq 0xa8(%r13), %rax
xorl %r12d, %r12d
testq %rax, %rax
je 0x3ab2a
movl %r15d, 0x8(%rsp)
testb $-0xc, (%rax)
je 0x3aa98
movq 0x4a57d(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x2f28f(%rip), %rsi     # 0x69d0c
leaq 0x2f2a6(%rip), %rdx     # 0x69d2a
movl $0x521e, %ecx           # imm = 0x521E
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
leaq 0xa8(%r13), %rbx
movq 0x120(%r13), %r15
testq %r15, %r15
je 0x3ab3c
cmpl $0x0, 0x104(%r14)
je 0x3ab92
cmpl $0x0, 0x108(%r14)
je 0x3ab92
movq %r14, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0x143d0
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x143d0
movaps 0x20(%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movups %xmm0, 0x170(%r13)
testl %eax, %eax
je 0x3ab22
cmpl $0x0, 0xc(%rsp)
je 0x3aba5
jmp 0x3ab22
orb $0x1, 0x6(%rbx)
addq $0x1c8, %rbx            # imm = 0x1C8
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x3ab17
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x37368
movq %rax, %r15
movq %r13, 0x1d8(%rax)
movq %rax, 0x120(%r13)
movl 0x8(%rsp), %eax
movl %eax, 0x128(%r13)
leaq 0x2508(%r14), %rax
movq %rax, 0x68(%r15)
movl $0x1, 0x80(%r15)
movq 0x2560(%r14), %rax
movq %rax, 0x90(%r15)
movq %rax, 0x98(%r15)
movq %rax, 0xa0(%r15)
movaps 0x20(%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movups %xmm0, 0x170(%r13)
movaps 0x40(%rsp), %xmm0
unpcklpd 0x30(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movups %xmm0, 0x4c(%r15)
movq %r13, 0x1d8(%r15)
movq %r14, %rdi
callq 0x37500
movq %rax, 0xa8(%r15)
orl $0x801, %ebp            # imm = 0x801
movl %ebp, 0x48(%r15)
movl 0x4794(%r14), %ecx
movl %ecx, (%r15)
movl $0x1, 0x15c(%r13)
testq %rax, %rax
jne 0x3ac1d
movq 0x4a3fa(%rip), %r12     # 0x84ff0
movq (%r12), %rdi
leaq 0x2f10b(%rip), %rsi     # 0x69d0c
leaq 0x2f122(%rip), %rdx     # 0x69d2a
movl $0x5248, %ecx           # imm = 0x5248
xorl %eax, %eax
callq 0x12ea0
movq (%r12), %rdi
callq 0x13960
movdqu 0x98(%r13), %xmm0
movdqu %xmm0, 0x130(%r13)
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqu %xmm0, 0x140(%r13)
movl $0x1, 0x150(%r13)
leaq 0x68(%r15), %rdi
movups 0x68(%r13), %xmm0
movups 0x78(%r13), %xmm1
movups 0x88(%r13), %xmm2
movups 0x98(%r13), %xmm3
movups %xmm3, 0x98(%r15)
movups %xmm2, 0x88(%r15)
movups %xmm1, 0x78(%r15)
movups %xmm0, 0x68(%r15)
movaps 0x2b869(%rip), %xmm0    # 0x664f0
movaps 0x2b872(%rip), %xmm1    # 0x66500
callq 0x13c50
movq %r15, 0x4780(%r14)
movq %r14, %rdi
xorl %esi, %esi
movl 0x8(%rsp), %edx
callq 0x37520
movups 0x68(%r15), %xmm0
movups 0x78(%r15), %xmm1
movups 0x88(%r15), %xmm2
movups 0x98(%r15), %xmm3
movups %xmm0, 0x68(%r13)
movups %xmm1, 0x78(%r13)
movups %xmm2, 0x88(%r13)
movups %xmm3, 0x98(%r13)
movq 0xa8(%r13), %rax
movq 0xa8(%r15), %rcx
movq %rax, 0x1c8(%rcx)
leaq 0x5c(%r15), %rax
movq %rax, 0x18(%rcx)
addq $0x60, %r15
movq %r15, 0x20(%rcx)
pushq $0x1
popq %r12
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x3ab2a
orb $0x10, 0x5(%rbx)
addq $0x1c8, %rbx            # imm = 0x1C8
jmp 0x3ad05