// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_contextual_begin
NK_API nk_bool
nk_contextual_begin(struct nk_context *ctx, nk_flags flags, struct nk_vec2 size,
    struct nk_rect trigger_bounds)
{
    struct nk_window *win;
    struct nk_window *popup;
    struct nk_rect body;
    struct nk_input* in;

    NK_STORAGE const struct nk_rect null_rect = {-1,-1,0,0};
    int is_clicked = 0;
    int is_open = 0;
    int ret = 0;

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

    win = ctx->current;
    ++win->popup.con_count;
    if (ctx->current != ctx->active)
        return 0;

    /* check if currently active contextual is active */
    popup = win->popup.win;
    is_open = (popup && win->popup.type == NK_PANEL_CONTEXTUAL);
    in = win->widgets_disabled ? 0 : &ctx->input;
    if (in) {
        is_clicked = nk_input_mouse_clicked(in, NK_BUTTON_RIGHT, trigger_bounds);
        if (win->popup.active_con && win->popup.con_count != win->popup.active_con)
            return 0;
        if (!is_open && win->popup.active_con)
            win->popup.active_con = 0;
        if ((!is_open && !is_clicked))
            return 0;

        /* calculate contextual position on click */
        win->popup.active_con = win->popup.con_count;
        if (is_clicked) {
            body.x = in->mouse.pos.x;
            body.y = in->mouse.pos.y;
        } else {
            body.x = popup->bounds.x;
            body.y = popup->bounds.y;
        }

        body.w = size.x;
        body.h = size.y;

        /* start nonblocking contextual popup */
        ret = nk_nonblock_begin(ctx, flags | NK_WINDOW_NO_SCROLLBAR, body,
            null_rect, NK_PANEL_CONTEXTUAL);
        if (ret) win->popup.type = NK_PANEL_CONTEXTUAL;
        else {
            win->popup.active_con = 0;
            win->popup.type = NK_PANEL_NONE;
            if (win->popup.win)
                win->popup.win->flags = 0;
        }
    }
    return ret;
}

// Assembly:
subq $0x78, %rsp
movlpd %xmm0, 0x6c(%rsp)
movlpd %xmm1, 0x5c(%rsp)
movlpd %xmm2, 0x64(%rsp)
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x5b782
movq 0x6989a(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x55c40(%rip), %rsi     # 0xb13a0
leaq 0x55c57(%rip), %rdx     # 0xb13be
movl $0x52c1, %ecx           # imm = 0x52C1
movb $0x0, %al
callq 0x13ec0
movq 0x69876(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x5b784
jmp 0x5b786
movq 0x50(%rsp), %rax
cmpq $0x0, 0x4780(%rax)
jne 0x5b7c8
movq 0x69854(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x55bfa(%rip), %rsi     # 0xb13a0
leaq 0x55c11(%rip), %rdx     # 0xb13be
movl $0x52c2, %ecx           # imm = 0x52C2
movb $0x0, %al
callq 0x13ec0
movq 0x69830(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x5b7ca
jmp 0x5b7cc
movq 0x50(%rsp), %rax
movq 0x4780(%rax), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x5b815
movq 0x69807(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x55bad(%rip), %rsi     # 0xb13a0
leaq 0x55bc4(%rip), %rdx     # 0xb13be
movl $0x52c3, %ecx           # imm = 0x52C3
movb $0x0, %al
callq 0x13ec0
movq 0x697e3(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x5b817
cmpq $0x0, 0x50(%rsp)
je 0x5b844
movq 0x50(%rsp), %rax
cmpq $0x0, 0x4780(%rax)
je 0x5b844
movq 0x50(%rsp), %rax
movq 0x4780(%rax), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x5b851
movl $0x0, 0x74(%rsp)
jmp 0x5babb
movq 0x50(%rsp), %rax
movq 0x4780(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movl 0x164(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x164(%rax)
movq 0x50(%rsp), %rax
movq 0x4780(%rax), %rax
movq 0x50(%rsp), %rcx
cmpq 0x4778(%rcx), %rax
je 0x5b89d
movl $0x0, 0x74(%rsp)
jmp 0x5babb
movq 0x40(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0x38(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x38(%rsp)
movb %al, 0x13(%rsp)
je 0x5b8cf
movq 0x40(%rsp), %rax
cmpl $0x10, 0x128(%rax)
sete %al
movb %al, 0x13(%rsp)
movb 0x13(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x18(%rsp)
movq 0x40(%rsp), %rax
cmpl $0x0, 0x1b0(%rax)
je 0x5b8f3
xorl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x5b8fd
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x5bab3
movq 0x20(%rsp), %rdi
movsd 0x5c(%rsp), %xmm0
movsd 0x64(%rsp), %xmm1
movl $0x2, %esi
callq 0x133d0
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
cmpl $0x0, 0x16c(%rax)
je 0x5b965
movq 0x40(%rsp), %rax
movl 0x164(%rax), %eax
movq 0x40(%rsp), %rcx
cmpl 0x16c(%rcx), %eax
je 0x5b965
movl $0x0, 0x74(%rsp)
jmp 0x5babb
cmpl $0x0, 0x18(%rsp)
jne 0x5b989
movq 0x40(%rsp), %rax
cmpl $0x0, 0x16c(%rax)
je 0x5b989
movq 0x40(%rsp), %rax
movl $0x0, 0x16c(%rax)
cmpl $0x0, 0x18(%rsp)
jne 0x5b9a4
cmpl $0x0, 0x1c(%rsp)
jne 0x5b9a4
movl $0x0, 0x74(%rsp)
jmp 0x5babb
movq 0x40(%rsp), %rax
movl 0x164(%rax), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x16c(%rax)
cmpl $0x0, 0x1c(%rsp)
je 0x5b9e9
movq 0x20(%rsp), %rax
movss 0x144(%rax), %xmm0
movss %xmm0, 0x28(%rsp)
movq 0x20(%rsp), %rax
movss 0x148(%rax), %xmm0
movss %xmm0, 0x2c(%rsp)
jmp 0x5ba09
movq 0x38(%rsp), %rax
movss 0x4c(%rax), %xmm0
movss %xmm0, 0x28(%rsp)
movq 0x38(%rsp), %rax
movss 0x50(%rax), %xmm0
movss %xmm0, 0x2c(%rsp)
movss 0x6c(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x70(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
orl $0x20, %esi
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movsd 0x5585f(%rip), %xmm2    # 0xb12a0
movsd 0x5585f(%rip), %xmm3    # 0xb12a8
movl $0x10, %edx
callq 0x5bad0
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x5ba6f
movq 0x40(%rsp), %rax
movl $0x10, 0x128(%rax)
jmp 0x5bab1
movq 0x40(%rsp), %rax
movl $0x0, 0x16c(%rax)
movq 0x40(%rsp), %rax
movl $0x0, 0x128(%rax)
movq 0x40(%rsp), %rax
cmpq $0x0, 0x120(%rax)
je 0x5baaf
movq 0x40(%rsp), %rax
movq 0x120(%rax), %rax
movl $0x0, 0x48(%rax)
jmp 0x5bab1
jmp 0x5bab3
movl 0x14(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)