// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_tree_state_base
NK_INTERN int
nk_tree_state_base(struct nk_context *ctx, enum nk_tree_type type,
    struct nk_image *img, const char *title, enum nk_collapse_states *state)
{
    struct nk_window *win;
    struct nk_panel *layout;
    const struct nk_style *style;
    struct nk_command_buffer *out;
    const struct nk_input *in;
    const struct nk_style_button *button;
    enum nk_symbol_type symbol;
    float row_height;

    struct nk_vec2 item_spacing;
    struct nk_rect header = {0,0,0,0};
    struct nk_rect sym = {0,0,0,0};
    struct nk_text text;

    nk_flags ws = 0;
    enum nk_widget_layout_states widget_state;

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

    /* cache some data */
    win = ctx->current;
    layout = win->layout;
    out = &win->buffer;
    style = &ctx->style;
    item_spacing = style->window.spacing;

    /* calculate header bounds and draw background */
    row_height = style->font->height + 2 * style->tab.padding.y;
    nk_layout_set_min_row_height(ctx, row_height);
    nk_layout_row_dynamic(ctx, row_height, 1);
    nk_layout_reset_min_row_height(ctx);

    widget_state = nk_widget(&header, ctx);
    if (type == NK_TREE_TAB) {
        const struct nk_style_item *background = &style->tab.background;

        switch(background->type) {
            case NK_STYLE_ITEM_IMAGE:
                nk_draw_image(out, header, &background->data.image, nk_rgb_factor(nk_white, style->tab.color_factor));
                break;
            case NK_STYLE_ITEM_NINE_SLICE:
                nk_draw_nine_slice(out, header, &background->data.slice, nk_rgb_factor(nk_white, style->tab.color_factor));
                break;
            case NK_STYLE_ITEM_COLOR:
                nk_fill_rect(out, header, 0, nk_rgb_factor(style->tab.border_color, style->tab.color_factor));
                nk_fill_rect(out, nk_shrink_rect(header, style->tab.border),
                    style->tab.rounding, nk_rgb_factor(background->data.color, style->tab.color_factor));
                break;
        }
    } else text.background = style->window.background;

    /* update node state */
    in = (!(layout->flags & NK_WINDOW_ROM)) ? &ctx->input: 0;
    in = (in && widget_state == NK_WIDGET_VALID) ? &ctx->input : 0;
    if (nk_button_behavior(&ws, header, in, NK_BUTTON_DEFAULT))
        *state = (*state == NK_MAXIMIZED) ? NK_MINIMIZED : NK_MAXIMIZED;

    /* select correct button style */
    if (*state == NK_MAXIMIZED) {
        symbol = style->tab.sym_maximize;
        if (type == NK_TREE_TAB)
            button = &style->tab.tab_maximize_button;
        else button = &style->tab.node_maximize_button;
    } else {
        symbol = style->tab.sym_minimize;
        if (type == NK_TREE_TAB)
            button = &style->tab.tab_minimize_button;
        else button = &style->tab.node_minimize_button;
    }

    {/* draw triangle button */
    sym.w = sym.h = style->font->height;
    sym.y = header.y + style->tab.padding.y;
    sym.x = header.x + style->tab.padding.x;
    nk_do_button_symbol(&ws, &win->buffer, sym, symbol, NK_BUTTON_DEFAULT,
        button, 0, style->font);

    if (img) {
        /* draw optional image icon */
        sym.x = sym.x + sym.w + 4 * item_spacing.x;
        nk_draw_image(&win->buffer, sym, img, nk_white);
        sym.w = style->font->height + style->tab.spacing.x;}
    }

    {/* draw label */
    struct nk_rect label;
    header.w = NK_MAX(header.w, sym.w + item_spacing.x);
    label.x = sym.x + sym.w + item_spacing.x;
    label.y = sym.y;
    label.w = header.w - (sym.w + item_spacing.y + style->tab.indent);
    label.h = style->font->height;
    text.text = nk_rgb_factor(style->tab.text, style->tab.color_factor);
    text.padding = nk_vec2(0,0);
    nk_widget_text(out, label, title, nk_strlen(title), &text,
        NK_TEXT_LEFT, style->font);}

    /* increase x-axis cursor widget position pointer */
    if (*state == NK_MAXIMIZED) {
        layout->at_x = header.x + (float)*layout->offset_x + style->tab.indent;
        layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent);
        layout->bounds.w -= (style->tab.indent + style->window.padding.x);
        layout->row.tree_depth++;
        return nk_true;
    } else return nk_false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r8, %r12
movq %rcx, %r13
movq %rdx, 0x90(%rsp)
movl %esi, %ebp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movl $0x0, 0x2c(%rsp)
testq %rdi, %rdi
jne 0x42bb5
movq 0x45460(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x2f1f2(%rip), %rsi     # 0x71d8c
leaq 0x2f209(%rip), %rdx     # 0x71daa
movl $0x57d6, %ecx           # imm = 0x57D6
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%rbx)
jne 0x42beb
movq 0x4542a(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x2f1bc(%rip), %rsi     # 0x71d8c
leaq 0x2f1d3(%rip), %rdx     # 0x71daa
movl $0x57d7, %ecx           # imm = 0x57D7
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq 0x4780(%rbx), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x42c28
movq 0x453ed(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x2f17f(%rip), %rsi     # 0x71d8c
leaq 0x2f196(%rip), %rdx     # 0x71daa
movl $0x57d8, %ecx           # imm = 0x57D8
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x42fb1
movq %r13, %r14
movq 0x4780(%rbx), %r13
testq %r13, %r13
je 0x42fb1
movq 0xa8(%r13), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x42fb1
addq $0x68, %r13
movss 0x24b4(%rbx), %xmm0
movss %xmm0, 0x60(%rsp)
movss 0x24b8(%rbx), %xmm0
movss %xmm0, 0x4c(%rsp)
movq 0x168(%rbx), %rax
movss 0x2000(%rbx), %xmm0
addss %xmm0, %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0x30(%rsp)
movq %rbx, %rdi
callq 0x138c0
movq %rbx, %rdi
xorl %esi, %esi
movss 0x30(%rsp), %xmm0
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x41057
movq %rbx, %rdi
callq 0x13bf0
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x128e0
movl %eax, %r15d
cmpl $0x1, %ebp
jne 0x42d4c
movl 0x1c58(%rbx), %eax
testl %eax, %eax
je 0x43023
cmpl $0x2, %eax
je 0x42fc6
cmpl $0x1, %eax
jne 0x42d59
movss 0x200c(%rbx), %xmm0
ucomiss 0x2bbb3(%rip), %xmm0    # 0x6e8b4
mulss 0x2bbaf(%rip), %xmm0    # 0x6e8b8
cvttss2si %xmm0, %eax
movl $0xff, %ecx
cmovnel %eax, %ecx
leaq 0x1c60(%rbx), %rsi
cmovpl %eax, %ecx
movzbl %cl, %eax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
addl %eax, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %r13, %rdi
callq 0x134d0
jmp 0x42d59
movl 0x2448(%rbx), %eax
movl %eax, 0xb0(%rsp)
movl $0x1000, %eax           # imm = 0x1000
movq 0x78(%rsp), %rcx
andl 0x4(%rcx), %eax
xorl $0x1, %r15d
xorl %esi, %esi
orl %eax, %r15d
cmoveq %rbx, %rsi
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
leaq 0x2c(%rsp), %rdi
xorl %edx, %edx
callq 0x521be
testl %eax, %eax
je 0x42d9d
xorl %eax, %eax
cmpl $0x1, (%r12)
setne %al
movl %eax, (%r12)
cmpl $0x1, %ebp
movl $0x1c88, %eax           # imm = 0x1C88
movl $0x1e38, %ecx           # imm = 0x1E38
cmoveq %rax, %rcx
movl $0x1d60, %eax           # imm = 0x1D60
movl $0x1f10, %r8d           # imm = 0x1F10
cmoveq %rax, %r8
xorl %eax, %eax
cmpl $0x1, (%r12)
sete %al
cmoveq %rcx, %r8
movl 0x1fe8(%rbx,%rax,4), %edx
addq %rbx, %r8
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm1
movaps %xmm1, 0x80(%rsp)
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movsd 0x10(%rsp), %xmm2
movsd 0x1ffc(%rbx), %xmm0
addps %xmm2, %xmm0
movq %rax, (%rsp)
xorl %r15d, %r15d
leaq 0x2c(%rsp), %rdi
movq %r13, %rsi
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x50(%rsp)
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x40888
movq 0x90(%rsp), %rsi
testq %rsi, %rsi
movq %r12, %rbp
je 0x42e94
movaps 0x30(%rsp), %xmm0
movaps 0x80(%rsp), %xmm2
addss %xmm0, %xmm2
movss 0x2bae6(%rip), %xmm1    # 0x6e930
mulss 0x60(%rsp), %xmm1
addss %xmm2, %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movq %r13, %rdi
movaps %xmm0, 0x30(%rsp)
movaps 0x50(%rsp), %xmm1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x134d0
movss 0x60(%rsp), %xmm1
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm0
addss 0x2004(%rbx), %xmm0
movaps 0x50(%rsp), %xmm2
movss %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1,2,3]
jmp 0x42e9f
movss 0x60(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
movaps %xmm1, %xmm0
addss %xmm2, %xmm0
maxss 0x18(%rsp), %xmm0
movss %xmm0, 0x18(%rsp)
movaps %xmm0, %xmm3
movaps 0x30(%rsp), %xmm0
addss %xmm2, %xmm0
addss %xmm1, %xmm0
movaps %xmm0, 0x90(%rsp)
movss 0x4c(%rsp), %xmm0
addss %xmm2, %xmm0
addss 0x1ff8(%rbx), %xmm0
subss %xmm0, %xmm3
movq 0x168(%rbx), %rax
movss 0x200c(%rbx), %xmm0
movl 0x1c84(%rbx), %edi
movss 0x8(%rax), %xmm1
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movaps %xmm3, 0x60(%rsp)
callq 0x13e60
leaq 0xa8(%rsp), %r12
movl %eax, 0xc(%r12)
movq $0x0, (%r12)
movq %r14, %rdi
callq 0x12f10
movq 0x168(%rbx), %r9
movaps 0x30(%rsp), %xmm0
movaps 0x90(%rsp), %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movq %r13, %rdi
movaps 0x60(%rsp), %xmm1
movq %r14, %rsi
movl %eax, %edx
movq %r12, %rcx
movl $0x11, %r8d
callq 0x45d79
cmpl $0x1, (%rbp)
jne 0x42fb1
movq 0x78(%rsp), %rcx
movq 0x18(%rcx), %rax
movl (%rax), %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss 0x10(%rsp), %xmm0
movss 0x1ff8(%rbx), %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x28(%rcx)
movaps %xmm1, %xmm0
maxss 0x10(%rcx), %xmm0
movss %xmm0, 0x10(%rcx)
addss 0x24cc(%rbx), %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x10(%rcx)
incl 0xb0(%rcx)
movl $0x1, %r15d
movl %r15d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movss 0x200c(%rbx), %xmm0
ucomiss 0x2b8df(%rip), %xmm0    # 0x6e8b4
mulss 0x2b8db(%rip), %xmm0    # 0x6e8b8
cvttss2si %xmm0, %eax
movl $0xff, %ecx
cmovnel %eax, %ecx
leaq 0x1c60(%rbx), %rsi
cmovpl %eax, %ecx
movzbl %cl, %eax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
addl %eax, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %r13, %rdi
callq 0x13fe0
jmp 0x42d59
movss 0x200c(%rbx), %xmm0
movl 0x1c80(%rbx), %edi
callq 0x13e60
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
xorps %xmm2, %xmm2
movq %r13, %rdi
movl %eax, %esi
callq 0x12de0
movss 0x1ff0(%rbx), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movaps %xmm0, %xmm3
shufps $0x0, %xmm0, %xmm3      # xmm3 = xmm3[0,0],xmm0[0,0]
addps %xmm1, %xmm3
movaps %xmm3, 0x30(%rsp)
addss %xmm0, %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movaps %xmm0, %xmm1
maxps %xmm2, %xmm1
subps %xmm0, %xmm1
movaps %xmm1, 0x80(%rsp)
movss 0x1ff4(%rbx), %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x200c(%rbx), %xmm0
movl 0x1c60(%rbx), %edi
callq 0x13e60
movq %r13, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movss 0x50(%rsp), %xmm2
movl %eax, %esi
callq 0x12de0
jmp 0x42d59