// File: /workspace/github_c_makefile_star2_O3/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 0x39e18
movq 0x4d1fd(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36f9f(%rip), %rsi     # 0x70d9c
leaq 0x36fb6(%rip), %rdx     # 0x70dba
movl $0x4f8f, %ecx           # imm = 0x4F8F
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
testq %r12, %r12
jne 0x39e49
movq 0x4d1cc(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36f6e(%rip), %rsi     # 0x70d9c
leaq 0x36f85(%rip), %rdx     # 0x70dba
movl $0x4f90, %ecx           # imm = 0x4F90
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
testq %r15, %r15
jne 0x39e7a
movq 0x4d19b(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36f3d(%rip), %rsi     # 0x70d9c
leaq 0x36f54(%rip), %rdx     # 0x70dba
movl $0x4f91, %ecx           # imm = 0x4F91
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
movq 0x168(%r14), %rax
testq %rax, %rax
je 0x39e8d
cmpq $0x0, 0x10(%rax)
jne 0x39eb9
movq 0x4d15c(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36efe(%rip), %rsi     # 0x70d9c
leaq 0x36f15(%rip), %rdx     # 0x70dba
movl $0x4f92, %ecx           # imm = 0x4F92
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%r14)
je 0x39efc
movq 0x4d126(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36ec8(%rip), %rsi     # 0x70d9c
leaq 0x36edf(%rip), %rdx     # 0x70dba
movl $0x4f93, %ecx           # imm = 0x4F93
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%r14)
sete %al
jmp 0x39efe
movb $0x1, %al
testq %r12, %r12
je 0x3a176
testq %r15, %r15
je 0x3a176
testb %al, %al
je 0x3a176
cmpb $0x0, (%r12)
movq %r15, 0x8(%rsp)
je 0x39f35
xorl %r13d, %r13d
cmpb $0x0, 0x1(%r12,%r13)
leaq 0x1(%r13), %r13
jne 0x39f27
jmp 0x39f38
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 0x3a515
testq %rax, %rax
je 0x39ff6
movq %rax, %r15
movl $0xfffff800, %eax       # imm = 0xFFFFF800
andl 0x48(%r15), %eax
orl %ebp, %eax
movl %eax, 0x48(%r15)
testb $0x6, %bpl
jne 0x39f88
movaps 0x20(%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movups %xmm0, 0x4c(%r15)
movl 0x4794(%r14), %eax
cmpl %eax, (%r15)
jne 0x39fc7
movq 0x4d055(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36df7(%rip), %rsi     # 0x70d9c
leaq 0x36e0e(%rip), %rdx     # 0x70dba
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 0x3a0bd
testb $0x20, 0x49(%r15)
jne 0x3a0bd
movq %r15, 0x4778(%r14)
movq %r15, 0x4770(%r14)
jmp 0x3a0bd
movq %r14, %rdi
callq 0x56b07
testq %rax, %rax
je 0x3a14a
movq %rax, %r15
movl 0x4794(%r14), %eax
movl %eax, (%r15)
movl %ebp, %edx
shrl $0x8, %edx
andl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3a5ba
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
movq %r15, %rdi
addq $0x8, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x25a38
movb $0x0, 0x8(%r15,%rbx)
movq $0x0, 0x120(%r15)
movl $0x0, 0x1b0(%r15)
cmpq $0x0, 0x4778(%r14)
jne 0x3a0bd
movq %r15, 0x4778(%r14)
movl 0x48(%r15), %eax
btl $0xd, %eax
jb 0x3a136
movq 0x2560(%r14), %rcx
movq %rcx, 0x90(%r15)
movq %rcx, 0x98(%r15)
movq %rcx, 0xa0(%r15)
movups 0x337a6(%rip), %xmm0    # 0x6d890
movups %xmm0, 0x70(%r15)
btl $0xa, %eax
jb 0x3a3b1
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 0x3a17d
movsd 0x4c(%r15), %xmm1
movsd 0x54(%r15), %xmm2
jmp 0x3a18c
movq %r15, 0x4780(%r14)
movq $0x0, 0xa8(%r15)
jmp 0x3a176
movq 0x4ce9f(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x36c41(%rip), %rsi     # 0x70d9c
leaq 0x36c58(%rip), %rdx     # 0x70dba
movl $0x4fa0, %ecx           # imm = 0x4FA0
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
callq 0x13780
xorl %eax, %eax
jmp 0x3a3f0
movsd 0x4c(%r15), %xmm1
movss 0x54(%r15), %xmm2
unpcklps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movss 0x10c(%r14), %xmm4
xorl %ecx, %ecx
ucomiss %xmm1, %xmm4
movaps %xmm2, %xmm3
addss %xmm1, %xmm3
jb 0x3a1e7
ucomiss %xmm4, %xmm3
jbe 0x3a1e7
movaps %xmm1, %xmm5
shufps $0x55, %xmm1, %xmm5     # xmm5 = xmm5[1,1],xmm1[1,1]
movss 0x110(%r14), %xmm4
xorl %ecx, %ecx
ucomiss %xmm5, %xmm4
jb 0x3a1e7
movaps %xmm2, %xmm5
addps %xmm1, %xmm5
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
ucomiss %xmm4, %xmm5
jbe 0x3a1e7
cmpl $0x1, 0x104(%r14)
jne 0x3a1e5
cmpl $0x0, 0x108(%r14)
setne %cl
jmp 0x3a1e7
xorl %ecx, %ecx
movss 0x144(%r14), %xmm4
ucomiss %xmm1, %xmm4
jb 0x3a213
ucomiss %xmm4, %xmm3
jbe 0x3a213
movaps %xmm1, %xmm5
shufps $0x55, %xmm1, %xmm5     # xmm5 = xmm5[1,1],xmm1[1,1]
movss 0x148(%r14), %xmm7
ucomiss %xmm5, %xmm7
jae 0x3a3ff
leaq 0x4778(%r14), %rbx
movq %r15, %r12
testb %cl, %cl
je 0x3a347
cmpq 0x4770(%r14), %r15
je 0x3a347
movq 0x1c8(%r15), %r12
testq %r12, %r12
je 0x3a30e
addps %xmm1, %xmm2
movaps %xmm1, %xmm5
shufps $0x55, %xmm1, %xmm5     # xmm5 = xmm5[1,1],xmm1[1,1]
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
movl 0x48(%r12), %ecx
testw %cx, %cx
js 0x3a263
movsd 0x54(%r12), %xmm6
jmp 0x3a26d
movss 0x54(%r12), %xmm6
unpcklps %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0],xmm6[1],xmm0[1]
movsd 0x4c(%r12), %xmm7
ucomiss %xmm7, %xmm4
jb 0x3a2b7
movaps %xmm6, %xmm8
addss %xmm7, %xmm8
ucomiss %xmm4, %xmm8
jbe 0x3a2b7
btl $0xd, %ecx
jb 0x3a2b7
movaps %xmm7, %xmm9
shufps $0x55, %xmm7, %xmm9     # xmm9 = xmm9[1,1],xmm7[1,1]
movss 0x148(%r14), %xmm8
ucomiss %xmm9, %xmm8
jb 0x3a2b7
addps %xmm7, %xmm6
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
ucomiss %xmm8, %xmm6
ja 0x3a347
movq 0x120(%r12), %rdx
testq %rdx, %rdx
je 0x3a2fd
btl $0xd, %ecx
jb 0x3a2fd
cmpl $0x0, 0x15c(%r12)
je 0x3a2fd
movss 0x4c(%rdx), %xmm6
ucomiss %xmm6, %xmm3
jbe 0x3a2fd
addss 0x54(%rdx), %xmm6
ucomiss %xmm1, %xmm6
jbe 0x3a2fd
movss 0x50(%rdx), %xmm6
ucomiss %xmm6, %xmm2
jbe 0x3a2fd
addss 0x58(%rdx), %xmm6
ucomiss %xmm5, %xmm6
ja 0x3a347
movq 0x1c8(%r12), %r12
testq %r12, %r12
jne 0x3a250
cmpq %r15, 0x4770(%r14)
je 0x3a395
btl $0x8, %eax
jb 0x3a339
movq %r14, %rdi
movq %r15, %rsi
callq 0x39cdf
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3a5ba
movl 0x48(%r15), %eax
andl $0xffffefff, %eax       # imm = 0xFFFFEFFF
movl %eax, 0x48(%r15)
movq %r15, (%rbx)
jmp 0x3a395
movl %eax, %ecx
andl $0x1100, %ecx           # imm = 0x1100
cmpl $0x100, %ecx            # imm = 0x100
jne 0x3a395
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, (%rbx)
btl $0x8, %eax
jb 0x3a3b1
movq %r14, %rdi
movq %r12, %rsi
callq 0x39cdf
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3a5ba
jmp 0x3a3b1
cmpq %r15, 0x4770(%r14)
je 0x3a3b1
movl %eax, %ecx
andl $0x100, %ecx            # imm = 0x100
jne 0x3a3b1
orl $0x1000, %eax           # imm = 0x1000
movl %eax, 0x48(%r15)
movq %r14, %rdi
callq 0x3a740
movq %rax, 0xa8(%r15)
movq %r15, 0x4780(%r14)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0x3a7b3
leaq 0x5c(%r15), %rcx
movq 0xa8(%r15), %rdx
movq %rcx, 0x18(%rdx)
addq $0x60, %r15
movq %r15, 0x20(%rdx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4778(%r14), %rbx
cmpq 0x4778(%r14), %r15
je 0x3a21a
movaps %xmm2, %xmm6
addps %xmm1, %xmm6
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
ucomiss %xmm7, %xmm6
jbe 0x3a21a
cmpl $0x0, 0x104(%r14)
jne 0x3a21a
movq 0x1c8(%r15), %r12
testq %r12, %r12
je 0x3a30e
movaps %xmm2, %xmm7
addss %xmm1, %xmm7
movl 0x48(%r12), %edx
testw %dx, %dx
js 0x3a45e
movsd 0x54(%r12), %xmm8
jmp 0x3a469
movss 0x54(%r12), %xmm8
unpcklps %xmm0, %xmm8            # xmm8 = xmm8[0],xmm0[0],xmm8[1],xmm0[1]
movsd 0x4c(%r12), %xmm9
ucomiss %xmm9, %xmm3
jbe 0x3a4ad
movaps %xmm8, %xmm10
addss %xmm9, %xmm10
ucomiss %xmm1, %xmm10
jbe 0x3a4ad
btl $0xd, %edx
jb 0x3a4ad
movaps %xmm9, %xmm10
shufps $0x55, %xmm9, %xmm10    # xmm10 = xmm10[1,1],xmm9[1,1]
ucomiss %xmm10, %xmm6
jbe 0x3a4ad
addps %xmm9, %xmm8
shufps $0x55, %xmm8, %xmm8     # xmm8 = xmm8[1,1,1,1]
ucomiss %xmm5, %xmm8
ja 0x3a21d
movq 0x120(%r12), %rsi
testq %rsi, %rsi
je 0x3a4ff
btl $0xd, %edx
jb 0x3a4ff
cmpl $0x0, 0x15c(%r12)
je 0x3a4ff
movss 0x4c(%rsi), %xmm8
ucomiss %xmm8, %xmm7
jbe 0x3a4ff
addss 0x54(%rsi), %xmm8
ucomiss %xmm1, %xmm8
jbe 0x3a4ff
movss 0x50(%rsi), %xmm8
ucomiss %xmm8, %xmm6
jbe 0x3a4ff
addss 0x58(%rsi), %xmm8
ucomiss %xmm5, %xmm8
ja 0x3a21d
movq 0x1c8(%r12), %r12
testq %r12, %r12
jne 0x3a44b
jmp 0x3a30e