// File: /workspace/github_c_makefile_star2_O2/space222[P]silo/./nuklear.h
// Function: nk_tree_state_base(nk_context*, nk_tree_type, nk_image*, char const*, nk_collapse_states*)
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;
        if (background->type == NK_STYLE_ITEM_IMAGE) {
            nk_draw_image(out, header, &background->data.image, nk_white);
            text.background = nk_rgba(0,0,0,0);
        } else {
            text.background = background->data.color;
            nk_fill_rect(out, header, 0, style->tab.border_color);
            nk_fill_rect(out, nk_shrink_rect(header, style->tab.border),
                style->tab.rounding, background->data.color);
        }
    } 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 = style->tab.text;
    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 $0xa8, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andl $0x0, 0x2c(%rsp)
testq %rdi, %rdi
je 0x1095a
movq %rdi, %rbx
movq 0x3fe8(%rdi), %r12
testq %r12, %r12
je 0x10979
movq %r8, 0x70(%rsp)
movq %rcx, 0x78(%rsp)
movq 0xa8(%r12), %r13
testq %r13, %r13
je 0x10998
movl %esi, %ebp
movq %rdx, %r14
addq $0x68, %r12
movss 0x1e8c(%rbx), %xmm0
movss %xmm0, 0x60(%rsp)
movss 0x1e90(%rbx), %xmm0
movss %xmm0, 0x4c(%rsp)
movq 0x168(%rbx), %rax
movss 0x1aa0(%rbx), %xmm0
addss %xmm0, %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0x30(%rsp)
movq %rbx, %rdi
callq 0xf320
pushq $0x1
popq %rsi
movq %rbx, %rdi
movss 0x30(%rsp), %xmm0
callq 0xf441
movq %rbx, %rdi
callq 0x90be
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xe786
movl %eax, %r15d
cmpl $0x1, %ebp
jne 0x106a8
cmpl $0x1, 0x17a0(%rbx)
jne 0x106b7
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
leaq 0x17a8(%rbx), %rsi
pushq $-0x1
popq %rdx
movq %r12, %rdi
callq 0x72e2
andl $0x0, 0x88(%rsp)
jmp 0x10710
movl 0x1e28(%rbx), %eax
movl %eax, 0x88(%rsp)
jmp 0x10710
movl 0x17a8(%rbx), %eax
movl %eax, 0x88(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movl 0x17c0(%rbx), %esi
xorps %xmm2, %xmm2
movq %r12, %rdi
callq 0x6858
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movss 0x1a90(%rbx), %xmm2
callq 0x19a20
movss 0x1a94(%rbx), %xmm2
movl 0x17a8(%rbx), %esi
movq %r12, %rdi
callq 0x6858
movl $0x1000, %eax           # imm = 0x1000
andl 0x4(%r13), %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
movaps %xmm0, 0x30(%rsp)
xorl %edx, %edx
callq 0x1ae58
movq 0x70(%rsp), %rdx
movl (%rdx), %ecx
testl %eax, %eax
je 0x10771
xorl %eax, %eax
cmpl $0x1, %ecx
setne %al
movl %eax, (%rdx)
je 0x10776
leaq 0x1a8c(%rbx), %rax
cmpl $0x1, %ebp
movl $0x17c8, %ecx           # imm = 0x17C8
movl $0x1928, %r8d           # imm = 0x1928
jmp 0x1078b
cmpl $0x1, %ecx
je 0x1075a
leaq 0x1a88(%rbx), %rax
cmpl $0x1, %ebp
movl $0x1878, %ecx           # imm = 0x1878
movl $0x19d8, %r8d           # imm = 0x19D8
cmoveq %rcx, %r8
movaps 0x30(%rsp), %xmm0
movl (%rax), %edx
addq %rbx, %r8
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm1
movaps %xmm1, 0x90(%rsp)
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movsd 0x1a9c(%rbx), %xmm2
addps %xmm2, %xmm0
movaps %xmm0, 0x30(%rsp)
movq %rax, (%rsp)
leaq 0x2c(%rsp), %rdi
movq %r12, %rsi
movaps %xmm1, 0x50(%rsp)
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0xee9a
testq %r14, %r14
je 0x10849
movaps 0x30(%rsp), %xmm0
movaps 0x90(%rsp), %xmm2
addss %xmm0, %xmm2
movss 0xfbf6(%rip), %xmm1     # 0x203f0
mulss 0x60(%rsp), %xmm1
addss %xmm2, %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
pushq $-0x1
popq %rdx
movq %r12, %rdi
movaps %xmm0, 0x30(%rsp)
movaps 0x50(%rsp), %xmm1
movq %r14, %rsi
callq 0x72e2
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm0
movss 0x1aa4(%rbx), %xmm1
addss %xmm0, %xmm1
movaps 0x50(%rsp), %xmm2
movss %xmm1, %xmm2            # xmm2 = xmm1[0],xmm2[1,2,3]
movss 0x60(%rsp), %xmm1
jmp 0x10860
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm0
movss 0x60(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
movaps %xmm1, %xmm3
addss %xmm2, %xmm3
maxss 0x18(%rsp), %xmm3
movss %xmm3, 0x18(%rsp)
movaps 0x30(%rsp), %xmm4
addss %xmm2, %xmm4
addss %xmm1, %xmm4
movaps %xmm4, 0x60(%rsp)
movss 0x4c(%rsp), %xmm1
addss %xmm2, %xmm1
addss 0x1a98(%rbx), %xmm1
subss %xmm1, %xmm3
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movaps %xmm3, 0x50(%rsp)
movl 0x17c4(%rbx), %eax
leaq 0x80(%rsp), %r15
movl %eax, 0xc(%r15)
andq $0x0, (%r15)
movq 0x78(%rsp), %rbp
movq %rbp, %rdi
callq 0x37f3
movq 0x168(%rbx), %r9
movaps 0x30(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
pushq $0x11
popq %r8
movq %r12, %rdi
movaps 0x50(%rsp), %xmm1
movq %rbp, %rsi
movl %eax, %edx
movq %r15, %rcx
callq 0x12660
xorl %eax, %eax
movq 0x70(%rsp), %rcx
cmpl $0x1, (%rcx)
jne 0x10948
movq 0x18(%r13), %rax
movl (%rax), %eax
cvtsi2ss %rax, %xmm0
addss 0x10(%rsp), %xmm0
movss 0x1a98(%rbx), %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x28(%r13)
movaps %xmm1, %xmm0
maxss 0x10(%r13), %xmm0
addss 0x1ea4(%rbx), %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x10(%r13)
incl 0xb0(%r13)
pushq $0x1
popq %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12d82(%rip), %rdi     # 0x236e3
leaq 0xfd3b(%rip), %rsi      # 0x206a3
leaq 0x14f60(%rip), %rcx     # 0x258cf
movl $0x47ba, %edx           # imm = 0x47BA
callq 0x20a0
leaq 0x117eb(%rip), %rdi     # 0x2216b
leaq 0xfd1c(%rip), %rsi      # 0x206a3
leaq 0x14f41(%rip), %rcx     # 0x258cf
movl $0x47bb, %edx           # imm = 0x47BB
callq 0x20a0
leaq 0x11948(%rip), %rdi     # 0x222e7
leaq 0xfcfd(%rip), %rsi      # 0x206a3
leaq 0x14f22(%rip), %rcx     # 0x258cf
movl $0x47bc, %edx           # imm = 0x47BC
callq 0x20a0