// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movl %ecx, %ebp
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
testq %rdi, %rdi
jne 0x3a559
movq 0x4dabc(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x3784e(%rip), %rsi     # 0x71d8c
leaq 0x37865(%rip), %rdx     # 0x71daa
movl $0x4f8f, %ecx           # imm = 0x4F8F
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
testq %r12, %r12
jne 0x3a58a
movq 0x4da8b(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x3781d(%rip), %rsi     # 0x71d8c
leaq 0x37834(%rip), %rdx     # 0x71daa
movl $0x4f90, %ecx           # imm = 0x4F90
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
testq %r15, %r15
jne 0x3a5bb
movq 0x4da5a(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x377ec(%rip), %rsi     # 0x71d8c
leaq 0x37803(%rip), %rdx     # 0x71daa
movl $0x4f91, %ecx           # imm = 0x4F91
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
movq 0x168(%r14), %rax
testq %rax, %rax
je 0x3a5ce
cmpq $0x0, 0x10(%rax)
jne 0x3a5fa
movq 0x4da1b(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x377ad(%rip), %rsi     # 0x71d8c
leaq 0x377c4(%rip), %rdx     # 0x71daa
movl $0x4f92, %ecx           # imm = 0x4F92
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%r14)
je 0x3a630
movq 0x4d9e5(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x37777(%rip), %rsi     # 0x71d8c
leaq 0x3778e(%rip), %rdx     # 0x71daa
movl $0x4f93, %ecx           # imm = 0x4F93
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
testq %r14, %r14
je 0x3a8f7
testq %r12, %r12
je 0x3a8f7
testq %r15, %r15
je 0x3a8f7
cmpq $0x0, 0x4780(%r14)
jne 0x3a8f7
cmpb $0x0, (%r12)
movq %r15, 0x8(%rsp)
je 0x3a676
xorl %r13d, %r13d
cmpb $0x0, 0x1(%r12,%r13)
leaq 0x1(%r13), %r13
jne 0x3a668
jmp 0x3a679
xorl %r13d, %r13d
movq %r12, %rdi
movl %r13d, %esi
movl $0x40, %edx
callq 0x12560
movl %eax, %ebx
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
callq 0x3ac95
testq %rax, %rax
je 0x3a737
movq %rax, %r15
movl $0xfffff800, %eax       # imm = 0xFFFFF800
andl 0x48(%r15), %eax
orl %ebp, %eax
movl %eax, 0x48(%r15)
testb $0x6, %bpl
jne 0x3a6c9
movaps 0x20(%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movups %xmm0, 0x4c(%r15)
movl (%r15), %eax
cmpl 0x4794(%r14), %eax
jne 0x3a701
movq 0x4d914(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x376a6(%rip), %rsi     # 0x71d8c
leaq 0x376bd(%rip), %rdx     # 0x71daa
movl $0x4fbf, %ecx           # imm = 0x4FBF
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
movl 0x4794(%r14), %eax
movl %eax, (%r15)
cmpq $0x0, 0x4778(%r14)
jne 0x3a805
testb $0x20, 0x49(%r15)
jne 0x3a805
movq %r15, 0x4778(%r14)
movq %r15, 0x4770(%r14)
jmp 0x3a805
movq %r14, %rdi
callq 0x576fb
testq %rax, %rax
je 0x3a753
movq %rax, %r15
movl 0x4794(%r14), %eax
movl %eax, (%r15)
jmp 0x3a756
xorl %r15d, %r15d
testq %r15, %r15
je 0x3a8cb
movl %ebp, %edx
shrl $0x8, %edx
andl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ad3d
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 0x20(%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movups %xmm0, 0x4c(%r15)
movl %ebx, 0x4(%r15)
cmpl $0x3f, %r13d
movl $0x3f, %ebx
cmovbl %r13d, %ebx
leaq 0x8(%r15), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x258b3
movb $0x0, 0x8(%r15,%rbx)
movq $0x0, 0x120(%r15)
movl $0x0, 0x1b0(%r15)
cmpq $0x0, 0x4778(%r14)
jne 0x3a805
movq %r15, 0x4778(%r14)
testb $0x20, 0x49(%r15)
jne 0x3a880
movq 0x2560(%r14), %rax
movq %rax, 0x90(%r15)
movq %rax, 0x98(%r15)
movq %rax, 0xa0(%r15)
movups 0x34071(%rip), %xmm0    # 0x6e8a0
movups %xmm0, 0x70(%r15)
movl 0x48(%r15), %eax
testl $0x2400, %eax           # imm = 0x2400
je 0x3a894
movq %r14, %rdi
callq 0x3aec3
movq %rax, 0xa8(%r15)
movq %r15, 0x4780(%r14)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0x3af4c
leaq 0x5c(%r15), %rcx
movq 0xa8(%r15), %rdx
movq %rcx, 0x18(%rdx)
addq $0x60, %r15
movq %r15, 0x20(%rdx)
jmp 0x3a8f9
movq %r15, 0x4780(%r14)
movq $0x0, 0xa8(%r15)
jmp 0x3a8f7
movq 0x168(%r14), %rcx
movss 0x2408(%r14), %xmm1
addss %xmm1, %xmm1
addss 0x8(%rcx), %xmm1
movss 0x2410(%r14), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
testw %ax, %ax
js 0x3a908
movsd 0x54(%r15), %xmm1
jmp 0x3a911
movq 0x4d71e(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x374b0(%rip), %rsi     # 0x71d8c
leaq 0x374c7(%rip), %rdx     # 0x71daa
movl $0x4fa0, %ecx           # imm = 0x4FA0
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movss 0x54(%r15), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movsd 0x4c(%r15), %xmm2
movss 0x10c(%r14), %xmm4
xorl %ecx, %ecx
ucomiss %xmm2, %xmm4
movaps %xmm1, %xmm3
addss %xmm2, %xmm3
jb 0x3a972
ucomiss %xmm4, %xmm3
jbe 0x3a972
movaps %xmm2, %xmm5
shufps $0x55, %xmm2, %xmm5     # xmm5 = xmm5[1,1],xmm2[1,1]
movss 0x110(%r14), %xmm4
xorl %ecx, %ecx
ucomiss %xmm5, %xmm4
jb 0x3a972
movaps %xmm1, %xmm5
addps %xmm2, %xmm5
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
ucomiss %xmm4, %xmm5
jbe 0x3a972
cmpl $0x1, 0x104(%r14)
jne 0x3a970
cmpl $0x0, 0x108(%r14)
setne %cl
jmp 0x3a972
xorl %ecx, %ecx
movss 0x144(%r14), %xmm4
xorl %edx, %edx
ucomiss %xmm2, %xmm4
jb 0x3a9b0
ucomiss %xmm4, %xmm3
jbe 0x3a9b0
movaps %xmm2, %xmm4
shufps $0x55, %xmm2, %xmm4     # xmm4 = xmm4[1,1],xmm2[1,1]
movss 0x148(%r14), %xmm3
ucomiss %xmm4, %xmm3
jae 0x3a9a0
xorl %edx, %edx
jmp 0x3a9b0
movaps %xmm1, %xmm4
addps %xmm2, %xmm4
shufps $0x55, %xmm4, %xmm4     # xmm4 = xmm4[1,1,1,1]
ucomiss %xmm3, %xmm4
seta %dl
movq %r15, %r12
cmpq 0x4778(%r14), %r15
je 0x3aad0
movq %r15, %r12
testb %dl, %dl
je 0x3aad0
cmpl $0x0, 0x104(%r14)
movq %r15, %r12
jne 0x3aad0
movq 0x1c8(%r15), %r12
movaps %xmm1, %xmm3
addps %xmm2, %xmm3
movaps %xmm3, %xmm4
shufps $0x55, %xmm3, %xmm4     # xmm4 = xmm4[1,1],xmm3[1,1]
movaps %xmm2, %xmm5
shufps $0x55, %xmm2, %xmm5     # xmm5 = xmm5[1,1],xmm2[1,1]
testq %r12, %r12
je 0x3aacd
movl 0x48(%r12), %edx
testw %dx, %dx
js 0x3aa13
movsd 0x54(%r12), %xmm6
jmp 0x3aa1d
movss 0x54(%r12), %xmm6
unpcklps %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0],xmm6[1],xmm0[1]
movsd 0x4c(%r12), %xmm7
ucomiss %xmm7, %xmm3
jbe 0x3aa63
movaps %xmm6, %xmm8
addss %xmm7, %xmm8
ucomiss %xmm2, %xmm8
jbe 0x3aa63
btl $0xd, %edx
jb 0x3aa63
movaps %xmm7, %xmm8
cmpltps %xmm3, %xmm8
pextrw $0x2, %xmm8, %esi
testb $0x1, %sil
je 0x3aa63
addps %xmm7, %xmm6
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
ucomiss %xmm5, %xmm6
jbe 0x3aa63
xorl %edx, %edx
jmp 0x3aac3
movq 0x120(%r12), %rsi
testq %rsi, %rsi
je 0x3aab9
btl $0xd, %edx
jb 0x3aab9
cmpl $0x0, 0x15c(%r12)
je 0x3aab9
movss 0x4c(%rsi), %xmm6
movss 0x4c(%r15), %xmm7
movaps %xmm1, %xmm8
addss %xmm7, %xmm8
ucomiss %xmm6, %xmm8
jbe 0x3aab9
addss 0x54(%rsi), %xmm6
ucomiss %xmm7, %xmm6
jbe 0x3aab9
movss 0x50(%rsi), %xmm6
ucomiss %xmm6, %xmm4
jbe 0x3aab9
addss 0x58(%rsi), %xmm6
ucomiss %xmm5, %xmm6
ja 0x3aa5f
movq 0x1c8(%r12), %r12
movb $0x1, %dl
testb %dl, %dl
jne 0x3a9f7
jmp 0x3aad0
xorl %r12d, %r12d
testq %r12, %r12
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x3abdb
cmpq 0x4770(%r14), %r15
je 0x3abdb
movq 0x1c8(%r15), %r12
addps %xmm2, %xmm1
movaps %xmm2, %xmm3
shufps $0x55, %xmm2, %xmm3     # xmm3 = xmm3[1,1],xmm2[1,1]
movaps %xmm1, %xmm4
shufps $0x55, %xmm1, %xmm4     # xmm4 = xmm4[1,1],xmm1[1,1]
testq %r12, %r12
je 0x3abd8
movl 0x48(%r12), %ecx
testw %cx, %cx
js 0x3ab22
movsd 0x54(%r12), %xmm5
jmp 0x3ab2c
movss 0x54(%r12), %xmm5
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
movsd 0x4c(%r12), %xmm6
movss 0x144(%r14), %xmm7
ucomiss %xmm6, %xmm7
jb 0x3ab7e
movaps %xmm5, %xmm8
addss %xmm6, %xmm8
ucomiss %xmm7, %xmm8
jbe 0x3ab7e
btl $0xd, %ecx
jb 0x3ab7e
movaps %xmm6, %xmm8
shufps $0x55, %xmm6, %xmm8     # xmm8 = xmm8[1,1],xmm6[1,1]
movss 0x148(%r14), %xmm7
ucomiss %xmm8, %xmm7
jb 0x3ab7e
addps %xmm6, %xmm5
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
ucomiss %xmm7, %xmm5
jbe 0x3ab7e
xorl %ecx, %ecx
jmp 0x3abce
movq 0x120(%r12), %rdx
testq %rdx, %rdx
je 0x3abc4
btl $0xd, %ecx
jb 0x3abc4
cmpl $0x0, 0x15c(%r12)
je 0x3abc4
movss 0x4c(%rdx), %xmm5
ucomiss %xmm5, %xmm1
jbe 0x3abc4
addss 0x54(%rdx), %xmm5
ucomiss %xmm2, %xmm5
jbe 0x3abc4
movss 0x50(%rdx), %xmm5
ucomiss %xmm5, %xmm4
jbe 0x3abc4
addss 0x58(%rdx), %xmm5
ucomiss %xmm3, %xmm5
ja 0x3ab7a
movq 0x1c8(%r12), %r12
movb $0x1, %cl
testb %cl, %cl
jne 0x3ab06
jmp 0x3abdb
xorl %r12d, %r12d
testq %r12, %r12
je 0x3ac39
movl %eax, %ecx
andl $0x1100, %ecx           # imm = 0x1100
cmpl $0x100, %ecx            # imm = 0x100
jne 0x3ac6c
orl $0x1000, %eax           # imm = 0x1000
movl %eax, 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 0x3a83f
movq %r14, %rdi
movq %r12, %rsi
callq 0x3a437
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3ad3d
jmp 0x3a83f
cmpq %r15, 0x4770(%r14)
je 0x3ac6c
btl $0x8, %eax
jb 0x3ac60
movq %r14, %rdi
movq %r15, %rsi
callq 0x3a437
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3ad3d
andb $-0x11, 0x49(%r15)
movq %r15, 0x4778(%r14)
cmpq %r15, 0x4770(%r14)
je 0x3a83f
movl 0x48(%r15), %eax
btl $0x8, %eax
jb 0x3a83f
orl $0x1000, %eax           # imm = 0x1000
movl %eax, 0x48(%r15)
jmp 0x3a83f