// File: /workspace/github_c_makefile_star2_O0/space222[P]silo/./nuklear.h
// Function: nk_contextual_begin
NK_API int
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;

    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);
    is_clicked = nk_input_mouse_clicked(&ctx->input, 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 = ctx->input.mouse.pos.x;
        body.y = ctx->input.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 $0xa8, %rsp
movlpd %xmm0, 0x9c(%rsp)
movlpd %xmm1, 0x8c(%rsp)
movlpd %xmm2, 0x94(%rsp)
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movl $0x0, 0x54(%rsp)
movl $0x0, 0x50(%rsp)
movl $0x0, 0x4c(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x1a5b3
jmp 0x1a5d2
leaq 0x2df65(%rip), %rdi     # 0x4851f
leaq 0x2adf2(%rip), %rsi     # 0x453b3
movl $0x42ae, %edx           # imm = 0x42AE
leaq 0x2d2ad(%rip), %rcx     # 0x4787a
callq 0x20a0
movq 0x80(%rsp), %rax
cmpq $0x0, 0x3fe8(%rax)
je 0x1a5e6
jmp 0x1a605
leaq 0x2c90c(%rip), %rdi     # 0x46ef9
leaq 0x2adbf(%rip), %rsi     # 0x453b3
movl $0x42af, %edx           # imm = 0x42AF
leaq 0x2d27a(%rip), %rcx     # 0x4787a
callq 0x20a0
movq 0x80(%rsp), %rax
movq 0x3fe8(%rax), %rax
cmpq $0x0, 0xa8(%rax)
je 0x1a620
jmp 0x1a63f
leaq 0x2ca4e(%rip), %rdi     # 0x47075
leaq 0x2ad85(%rip), %rsi     # 0x453b3
movl $0x42b0, %edx           # imm = 0x42B0
leaq 0x2d240(%rip), %rcx     # 0x4787a
callq 0x20a0
cmpq $0x0, 0x80(%rsp)
je 0x1a675
movq 0x80(%rsp), %rax
cmpq $0x0, 0x3fe8(%rax)
je 0x1a675
movq 0x80(%rsp), %rax
movq 0x3fe8(%rax), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x1a685
movl $0x0, 0xa4(%rsp)
jmp 0x1a8fd
movq 0x80(%rsp), %rax
movq 0x3fe8(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movl 0x164(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x164(%rax)
movq 0x80(%rsp), %rax
movq 0x3fe8(%rax), %rax
movq 0x80(%rsp), %rcx
cmpq 0x3fe0(%rcx), %rax
je 0x1a6dd
movl $0x0, 0xa4(%rsp)
jmp 0x1a8fd
movq 0x70(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0x68(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x68(%rsp)
movb %al, 0xf(%rsp)
je 0x1a70f
movq 0x70(%rsp), %rax
cmpl $0x10, 0x128(%rax)
sete %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
movzbl %al, %eax
andl $0x1, %eax
movl %eax, 0x50(%rsp)
movq 0x80(%rsp), %rdi
movups 0x8c(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movl $0x2, %esi
callq 0xd910
movl %eax, 0x54(%rsp)
movq 0x70(%rsp), %rax
cmpl $0x0, 0x16c(%rax)
je 0x1a782
movq 0x70(%rsp), %rax
movl 0x164(%rax), %eax
movq 0x70(%rsp), %rcx
cmpl 0x16c(%rcx), %eax
je 0x1a782
movl $0x0, 0xa4(%rsp)
jmp 0x1a8fd
cmpl $0x0, 0x50(%rsp)
jne 0x1a7a6
movq 0x70(%rsp), %rax
cmpl $0x0, 0x16c(%rax)
je 0x1a7a6
movq 0x70(%rsp), %rax
movl $0x0, 0x16c(%rax)
cmpl $0x0, 0x50(%rsp)
jne 0x1a7c4
cmpl $0x0, 0x54(%rsp)
jne 0x1a7c4
movl $0x0, 0xa4(%rsp)
jmp 0x1a8fd
movq 0x70(%rsp), %rax
movl 0x164(%rax), %ecx
movq 0x70(%rsp), %rax
movl %ecx, 0x16c(%rax)
cmpl $0x0, 0x54(%rsp)
je 0x1a80f
movq 0x80(%rsp), %rax
movss 0x144(%rax), %xmm0
movss %xmm0, 0x58(%rsp)
movq 0x80(%rsp), %rax
movss 0x148(%rax), %xmm0
movss %xmm0, 0x5c(%rsp)
jmp 0x1a82f
movq 0x68(%rsp), %rax
movss 0x4c(%rax), %xmm0
movss %xmm0, 0x58(%rsp)
movq 0x68(%rsp), %rax
movss 0x50(%rax), %xmm0
movss %xmm0, 0x5c(%rsp)
movss 0x9c(%rsp), %xmm0
movss %xmm0, 0x60(%rsp)
movss 0xa0(%rsp), %xmm0
movss %xmm0, 0x64(%rsp)
movq 0x80(%rsp), %rdi
movl 0x7c(%rsp), %esi
orl $0x20, %esi
movups 0x58(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movups 0x2aaa3(%rip), %xmm0    # 0x45310
movaps %xmm0, 0x10(%rsp)
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
movl $0x10, %edx
callq 0x1a910
movl %eax, 0x4c(%rsp)
cmpl $0x0, 0x4c(%rsp)
je 0x1a8b0
movq 0x70(%rsp), %rax
movl $0x10, 0x128(%rax)
jmp 0x1a8f2
movq 0x70(%rsp), %rax
movl $0x0, 0x16c(%rax)
movq 0x70(%rsp), %rax
movl $0x0, 0x128(%rax)
movq 0x70(%rsp), %rax
cmpq $0x0, 0x120(%rax)
je 0x1a8f0
movq 0x70(%rsp), %rax
movq 0x120(%rax), %rax
movl $0x0, 0x48(%rax)
jmp 0x1a8f2
movl 0x4c(%rsp), %eax
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopl (%rax)