// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_begin_titled
NK_API nk_bool
nk_begin_titled(struct nk_context *ctx, const char *name, const char *title,
    struct nk_rect bounds, nk_flags flags)
{
    struct nk_window *win;
    struct nk_style *style;
    nk_hash name_hash;
    int name_len;
    int ret = 0;

    NK_ASSERT(ctx);
    NK_ASSERT(name);
    NK_ASSERT(title);
    NK_ASSERT(ctx->style.font && ctx->style.font->width && "if this triggers you forgot to add a font");
    NK_ASSERT(!ctx->current && "if this triggers you missed a `nk_end` call");
    if (!ctx || ctx->current || !title || !name)
        return 0;

    /* find or create window */
    style = &ctx->style;
    name_len = (int)nk_strlen(name);
    name_hash = nk_murmur_hash(name, (int)name_len, NK_WINDOW_TITLE);
    win = nk_find_window(ctx, name_hash, name);
    if (!win) {
        /* create new window */
        nk_size name_length = (nk_size)name_len;
        win = (struct nk_window*)nk_create_window(ctx);
        NK_ASSERT(win);
        if (!win) return 0;

        if (flags & NK_WINDOW_BACKGROUND)
            nk_insert_window(ctx, win, NK_INSERT_FRONT);
        else nk_insert_window(ctx, win, NK_INSERT_BACK);
        nk_command_buffer_init(&win->buffer, &ctx->memory, NK_CLIPPING_ON);

        win->flags = flags;
        win->bounds = bounds;
        win->name = name_hash;
        name_length = NK_MIN(name_length, NK_WINDOW_MAX_NAME-1);
        NK_MEMCPY(win->name_string, name, name_length);
        win->name_string[name_length] = 0;
        win->popup.win = 0;
        win->widgets_disabled = nk_false;
        if (!ctx->active)
            ctx->active = win;
    } else {
        /* update window */
        win->flags &= ~(nk_flags)(NK_WINDOW_PRIVATE-1);
        win->flags |= flags;
        if (!(win->flags & (NK_WINDOW_MOVABLE | NK_WINDOW_SCALABLE)))
            win->bounds = bounds;
        /* If this assert triggers you either:
         *
         * I.) Have more than one window with the same name or
         * II.) You forgot to actually draw the window.
         *      More specific you did not call `nk_clear` (nk_clear will be
         *      automatically called for you if you are using one of the
         *      provided demo backends). */
        NK_ASSERT(win->seq != ctx->seq);
        win->seq = ctx->seq;
        if (!ctx->active && !(win->flags & NK_WINDOW_HIDDEN)) {
            ctx->active = win;
            ctx->end = win;
        }
    }
    if (win->flags & NK_WINDOW_HIDDEN) {
        ctx->current = win;
        win->layout = 0;
        return 0;
    } else nk_start(ctx, win);

    /* window overlapping */
    if (!(win->flags & NK_WINDOW_HIDDEN) && !(win->flags & NK_WINDOW_NO_INPUT))
    {
        int inpanel, ishovered;
        struct nk_window *iter = win;
        float h = ctx->style.font->height + 2.0f * style->window.header.padding.y +
            (2.0f * style->window.header.label_padding.y);
        struct nk_rect win_bounds = (!(win->flags & NK_WINDOW_MINIMIZED))?
            win->bounds: nk_rect(win->bounds.x, win->bounds.y, win->bounds.w, h);

        /* activate window if hovered and no other window is overlapping this window */
        inpanel = nk_input_has_mouse_click_down_in_rect(&ctx->input, NK_BUTTON_LEFT, win_bounds, nk_true);
        inpanel = inpanel && ctx->input.mouse.buttons[NK_BUTTON_LEFT].clicked;
        ishovered = nk_input_is_mouse_hovering_rect(&ctx->input, win_bounds);
        if ((win != ctx->active) && ishovered && !ctx->input.mouse.buttons[NK_BUTTON_LEFT].down) {
            iter = win->next;
            while (iter) {
                struct nk_rect iter_bounds = (!(iter->flags & NK_WINDOW_MINIMIZED))?
                    iter->bounds: nk_rect(iter->bounds.x, iter->bounds.y, iter->bounds.w, h);
                if (NK_INTERSECT(win_bounds.x, win_bounds.y, win_bounds.w, win_bounds.h,
                    iter_bounds.x, iter_bounds.y, iter_bounds.w, iter_bounds.h) &&
                    (!(iter->flags & NK_WINDOW_HIDDEN)))
                    break;

                if (iter->popup.win && iter->popup.active && !(iter->flags & NK_WINDOW_HIDDEN) &&
                    NK_INTERSECT(win->bounds.x, win_bounds.y, win_bounds.w, win_bounds.h,
                    iter->popup.win->bounds.x, iter->popup.win->bounds.y,
                    iter->popup.win->bounds.w, iter->popup.win->bounds.h))
                    break;
                iter = iter->next;
            }
        }

        /* activate window if clicked */
        if (iter && inpanel && (win != ctx->end)) {
            iter = win->next;
            while (iter) {
                /* try to find a panel with higher priority in the same position */
                struct nk_rect iter_bounds = (!(iter->flags & NK_WINDOW_MINIMIZED))?
                iter->bounds: nk_rect(iter->bounds.x, iter->bounds.y, iter->bounds.w, h);
                if (NK_INBOX(ctx->input.mouse.pos.x, ctx->input.mouse.pos.y,
                    iter_bounds.x, iter_bounds.y, iter_bounds.w, iter_bounds.h) &&
                    !(iter->flags & NK_WINDOW_HIDDEN))
                    break;
                if (iter->popup.win && iter->popup.active && !(iter->flags & NK_WINDOW_HIDDEN) &&
                    NK_INTERSECT(win_bounds.x, win_bounds.y, win_bounds.w, win_bounds.h,
                    iter->popup.win->bounds.x, iter->popup.win->bounds.y,
                    iter->popup.win->bounds.w, iter->popup.win->bounds.h))
                    break;
                iter = iter->next;
            }
        }
        if (iter && !(win->flags & NK_WINDOW_ROM) && (win->flags & NK_WINDOW_BACKGROUND)) {
            win->flags |= (nk_flags)NK_WINDOW_ROM;
            iter->flags &= ~(nk_flags)NK_WINDOW_ROM;
            ctx->active = iter;
            if (!(iter->flags & NK_WINDOW_BACKGROUND)) {
                /* current window is active in that position so transfer to top
                 * at the highest priority in stack */
                nk_remove_window(ctx, iter);
                nk_insert_window(ctx, iter, NK_INSERT_BACK);
            }
        } else {
            if (!iter && ctx->end != win) {
                if (!(win->flags & NK_WINDOW_BACKGROUND)) {
                    /* current window is active in that position so transfer to top
                     * at the highest priority in stack */
                    nk_remove_window(ctx, win);
                    nk_insert_window(ctx, win, NK_INSERT_BACK);
                }
                win->flags &= ~(nk_flags)NK_WINDOW_ROM;
                ctx->active = win;
            }
            if (ctx->end != win && !(win->flags & NK_WINDOW_BACKGROUND))
                win->flags |= NK_WINDOW_ROM;
        }
    }
    win->layout = (struct nk_panel*)nk_create_panel(ctx);
    ctx->current = win;
    ret = nk_panel_begin(ctx, title, NK_PANEL_WINDOW);
    win->layout->offset_x = &win->scrollbar.x;
    win->layout->offset_y = &win->scrollbar.y;
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
testq %rdi, %rdi
jne 0x36c27
movq 0x4e3ee(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x33100(%rip), %rsi     # 0x69d0c
leaq 0x33117(%rip), %rdx     # 0x69d2a
movl $0x4f8f, %ecx           # imm = 0x4F8F
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
testq %r12, %r12
jne 0x36c58
movq 0x4e3bd(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x330cf(%rip), %rsi     # 0x69d0c
leaq 0x330e6(%rip), %rdx     # 0x69d2a
movl $0x4f90, %ecx           # imm = 0x4F90
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
testq %r15, %r15
jne 0x36c89
movq 0x4e38c(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x3309e(%rip), %rsi     # 0x69d0c
leaq 0x330b5(%rip), %rdx     # 0x69d2a
movl $0x4f91, %ecx           # imm = 0x4F91
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
movq 0x168(%r14), %rax
testq %rax, %rax
je 0x36c9c
cmpq $0x0, 0x10(%rax)
jne 0x36cc8
movq 0x4e34d(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x3305f(%rip), %rsi     # 0x69d0c
leaq 0x33076(%rip), %rdx     # 0x69d2a
movl $0x4f92, %ecx           # imm = 0x4F92
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
cmpq $0x0, 0x4780(%r14)
je 0x36d0b
movq 0x4e317(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x33029(%rip), %rsi     # 0x69d0c
leaq 0x33040(%rip), %rdx     # 0x69d2a
movl $0x4f93, %ecx           # imm = 0x4F93
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
cmpq $0x0, 0x4780(%r14)
sete %al
jmp 0x36d0d
movb $0x1, %al
testq %r12, %r12
je 0x36f5e
testq %r15, %r15
je 0x36f5e
testb %al, %al
je 0x36f5e
movq %r15, 0x28(%rsp)
movq %r12, %rdi
callq 0x13040
movl %eax, %r13d
pushq $0x40
popq %rdx
movq %r12, %rdi
movl %eax, %esi
callq 0x125c0
movl %eax, %ebx
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
callq 0x372d0
movaps (%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
testq %rax, %rax
je 0x36df1
movq %rax, %r15
movl $0xfffff800, %eax       # imm = 0xFFFFF800
andl 0x48(%r15), %eax
orl %ebp, %eax
movl %eax, 0x48(%r15)
testb $0x6, %bpl
jne 0x36d83
movups %xmm0, 0x4c(%r15)
movl 0x4794(%r14), %eax
cmpl %eax, (%r15)
jne 0x36dc2
movq 0x4e25a(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x32f6c(%rip), %rsi     # 0x69d0c
leaq 0x32f83(%rip), %rdx     # 0x69d2a
movl $0x4fbf, %ecx           # imm = 0x4FBF
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
movl 0x4794(%r14), %eax
movl %eax, (%r15)
cmpq $0x0, 0x4778(%r14)
jne 0x36ea3
testb $0x20, 0x49(%r15)
jne 0x36ea3
movq %r15, 0x4778(%r14)
movq %r15, 0x4770(%r14)
jmp 0x36ea3
movaps %xmm0, (%rsp)
movq %r14, %rdi
callq 0x37368
testq %rax, %rax
je 0x36f32
movq %rax, %r15
movl %ebp, %edx
shrl $0x8, %edx
andl $0x1, %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0x37380
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)
movl %ebp, 0x48(%r15)
movaps (%rsp), %xmm0
movups %xmm0, 0x4c(%r15)
movl %ebx, 0x4(%r15)
cmpl $0x3f, %r13d
pushq $0x3f
popq %rbx
cmovbl %r13d, %ebx
movq %r15, %rdi
addq $0x8, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x24323
movb $0x0, 0x8(%r15,%rbx)
andq $0x0, 0x120(%r15)
andl $0x0, 0x1b0(%r15)
cmpq $0x0, 0x4778(%r14)
jne 0x36ea3
movq %r15, 0x4778(%r14)
movl 0x48(%r15), %ebx
btl $0xd, %ebx
jb 0x36f21
movq 0x2560(%r14), %rax
movq %rax, 0x90(%r15)
movq %rax, 0x98(%r15)
movq %rax, 0xa0(%r15)
movups 0x2f950(%rip), %xmm0    # 0x66820
movups %xmm0, 0x70(%r15)
btl $0xa, %ebx
jb 0x37284
movq 0x168(%r14), %rax
movss 0x2408(%r14), %xmm0
addss %xmm0, %xmm0
addss 0x8(%rax), %xmm0
movss 0x2410(%r14), %xmm2
addss %xmm2, %xmm2
addss %xmm0, %xmm2
testw %bx, %bx
movaps %xmm2, 0x30(%rsp)
js 0x36f65
movsd 0x4c(%r15), %xmm0
movsd 0x54(%r15), %xmm1
jmp 0x36f74
movq %r15, 0x4780(%r14)
andq $0x0, 0xa8(%r15)
jmp 0x36f5e
movq 0x4e0b7(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x32dc9(%rip), %rsi     # 0x69d0c
leaq 0x32de0(%rip), %rdx     # 0x69d2a
movl $0x4fa0, %ecx           # imm = 0x4FA0
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
callq 0x13960
xorl %eax, %eax
jmp 0x372c1
movsd 0x4c(%r15), %xmm0
movss 0x54(%r15), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
xorl %ebp, %ebp
pushq $0x1
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
movaps %xmm0, (%rsp)
movaps %xmm1, 0x10(%rsp)
callq 0x12750
testl %eax, %eax
je 0x36f9c
cmpl $0x0, 0x108(%r14)
setne %bpl
movq %r14, %rdi
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0x143d0
movaps (%rsp), %xmm8
movaps %xmm8, %xmm0
shufps $0x55, %xmm8, %xmm0     # xmm0 = xmm0[1,1],xmm8[1,1]
movq %r15, %r12
cmpq 0x4778(%r14), %r15
movaps 0x30(%rsp), %xmm7
je 0x36fe4
movq %r15, %r12
testl %eax, %eax
je 0x36fe4
cmpl $0x0, 0x104(%r14)
movq %r15, %r12
je 0x37145
testb %bpl, %bpl
je 0x370e9
movq 0x4770(%r14), %rax
cmpq %rax, %r15
movaps 0x10(%rsp), %xmm6
je 0x370e9
addps %xmm8, %xmm6
movaps %xmm6, %xmm1
shufps $0x55, %xmm6, %xmm1     # xmm1 = xmm1[1,1],xmm6[1,1]
movq %r15, %r12
movq 0x1c8(%r12), %r12
testq %r12, %r12
je 0x37230
movl 0x48(%r12), %ecx
testw %cx, %cx
js 0x37034
movsd 0x54(%r12), %xmm2
jmp 0x3703e
movss 0x54(%r12), %xmm2
unpcklps %xmm7, %xmm2            # xmm2 = xmm2[0],xmm7[0],xmm2[1],xmm7[1]
movsd 0x4c(%r12), %xmm3
movss 0x144(%r14), %xmm4
ucomiss %xmm3, %xmm4
jb 0x37086
movaps %xmm2, %xmm5
addss %xmm3, %xmm5
ucomiss %xmm4, %xmm5
jbe 0x37086
btl $0xd, %ecx
jb 0x37086
movaps %xmm3, %xmm5
shufps $0x55, %xmm3, %xmm5     # xmm5 = xmm5[1,1],xmm3[1,1]
movss 0x148(%r14), %xmm4
ucomiss %xmm5, %xmm4
jb 0x37086
addps %xmm3, %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
ucomiss %xmm4, %xmm2
ja 0x370e9
movq 0x120(%r12), %rdx
testq %rdx, %rdx
je 0x37010
btl $0xd, %ecx
jb 0x37010
cmpl $0x0, 0x15c(%r12)
je 0x37010
movss 0x4c(%rdx), %xmm2
ucomiss %xmm2, %xmm6
jbe 0x37010
addss 0x54(%rdx), %xmm2
ucomiss %xmm8, %xmm2
jbe 0x37010
movss 0x50(%rdx), %xmm2
ucomiss %xmm2, %xmm1
jbe 0x37010
addss 0x58(%rdx), %xmm2
ucomiss %xmm0, %xmm2
jbe 0x37010
movl %ebx, %eax
andl $0x1100, %eax           # imm = 0x1100
cmpl $0x100, %eax            # imm = 0x100
jne 0x37268
orl $0x1000, %ebx           # imm = 0x1000
movl %ebx, 0x48(%r15)
movl 0x48(%r12), %eax
movl %eax, %ecx
andl $0xffffefff, %ecx       # imm = 0xFFFFEFFF
movl %ecx, 0x48(%r12)
movq %r12, 0x4778(%r14)
btl $0x8, %eax
jb 0x37284
movq %r14, %rdi
movq %r12, %rsi
callq 0x36b0e
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x37380
jmp 0x37284
movaps 0x10(%rsp), %xmm3
movaps %xmm3, %xmm1
addps %xmm8, %xmm1
movaps %xmm1, %xmm2
shufps $0x55, %xmm1, %xmm2     # xmm2 = xmm2[1,1],xmm1[1,1]
addss %xmm8, %xmm3
movq %r15, %r12
movq 0x1c8(%r12), %r12
testq %r12, %r12
je 0x37229
movl 0x48(%r12), %eax
testw %ax, %ax
js 0x37184
movsd 0x54(%r12), %xmm4
jmp 0x3718e
movss 0x54(%r12), %xmm4
unpcklps %xmm7, %xmm4            # xmm4 = xmm4[0],xmm7[0],xmm4[1],xmm7[1]
movsd 0x4c(%r12), %xmm5
ucomiss %xmm5, %xmm1
jbe 0x371c9
movaps %xmm4, %xmm6
addss %xmm5, %xmm6
ucomiss %xmm8, %xmm6
jbe 0x371c9
btl $0xd, %eax
jb 0x371c9
movaps %xmm5, %xmm6
shufps $0x55, %xmm5, %xmm6     # xmm6 = xmm6[1,1],xmm5[1,1]
ucomiss %xmm6, %xmm2
jbe 0x371c9
addps %xmm5, %xmm4
shufps $0x55, %xmm4, %xmm4     # xmm4 = xmm4[1,1,1,1]
ucomiss %xmm0, %xmm4
ja 0x36fe4
movq 0x120(%r12), %rcx
testq %rcx, %rcx
je 0x37160
btl $0xd, %eax
jb 0x37160
cmpl $0x0, 0x15c(%r12)
je 0x37160
movss 0x4c(%rcx), %xmm4
ucomiss %xmm4, %xmm3
jbe 0x37160
addss 0x54(%rcx), %xmm4
ucomiss %xmm8, %xmm4
jbe 0x37160
movss 0x50(%rcx), %xmm4
ucomiss %xmm4, %xmm2
jbe 0x37160
addss 0x58(%rcx), %xmm4
ucomiss %xmm0, %xmm4
jbe 0x37160
jmp 0x36fe4
movq 0x4770(%r14), %rax
cmpq %r15, %rax
je 0x37268
btl $0x8, %ebx
jb 0x37257
movq %r14, %rdi
movq %r15, %rsi
callq 0x36b0e
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x37380
movl 0x48(%r15), %ebx
andl $0xffffefff, %ebx       # imm = 0xFFFFEFFF
movl %ebx, 0x48(%r15)
movq %r15, 0x4778(%r14)
cmpq %r15, 0x4770(%r14)
je 0x37284
movl %ebx, %eax
andl $0x100, %eax            # imm = 0x100
jne 0x37284
orl $0x1000, %ebx           # imm = 0x1000
movl %ebx, 0x48(%r15)
movq %r14, %rdi
callq 0x37500
movq %rax, 0xa8(%r15)
movq %r15, 0x4780(%r14)
pushq $0x1
popq %rdx
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x37520
leaq 0x5c(%r15), %rcx
movq 0xa8(%r15), %rdx
movq %rcx, 0x18(%rdx)
addq $0x60, %r15
movq %r15, 0x20(%rdx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq