// File: /workspace/github_c_makefile_star2_O2/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 $0xa8, %rsp
movq %r8, %r12
movq %rcx, 0x90(%rsp)
movq %rdx, 0x70(%rsp)
movl %esi, %r15d
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andl $0x0, 0x38(%rsp)
testq %rdi, %rdi
jne 0x3eaff
movq 0x46516(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x2b228(%rip), %rsi     # 0x69d0c
leaq 0x2b23f(%rip), %rdx     # 0x69d2a
movl $0x57d6, %ecx           # imm = 0x57D6
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r13
testq %r13, %r13
jne 0x3eb3e
movq 0x464de(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x2b1f0(%rip), %rsi     # 0x69d0c
leaq 0x2b207(%rip), %rdx     # 0x69d2a
movl $0x57d7, %ecx           # imm = 0x57D7
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r13
cmpq $0x0, 0xa8(%r13)
jne 0x3eb86
movq 0x464a1(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x2b1b3(%rip), %rsi     # 0x69d0c
leaq 0x2b1ca(%rip), %rdx     # 0x69d2a
xorl %ebp, %ebp
movl $0x57d8, %ecx           # imm = 0x57D8
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r13
testq %r13, %r13
je 0x3eeba
movq 0xa8(%r13), %r14
testq %r14, %r14
je 0x3eeb8
movq %r12, 0x88(%rsp)
addq $0x68, %r13
movss 0x24b4(%rbx), %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x24b8(%rbx), %xmm0
movss %xmm0, 0x3c(%rsp)
movq 0x168(%rbx), %rax
movss 0x2000(%rbx), %xmm0
addss %xmm0, %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq 0x13ab0
pushq $0x1
popq %rsi
movq %rbx, %rdi
movss 0x20(%rsp), %xmm0
callq 0x12f50
movq %rbx, %rdi
callq 0x13df0
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x12990
movl %eax, %r12d
cmpl $0x1, %r15d
jne 0x3ec61
movl 0x1c58(%rbx), %eax
testl %eax, %eax
je 0x3ef03
cmpl $0x2, %eax
je 0x3eece
cmpl $0x1, %eax
jne 0x3ec6e
leaq 0x1c60(%rbx), %rbp
movss 0x200c(%rbx), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %r13, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x13660
jmp 0x3ec6e
movl 0x2448(%rbx), %eax
movl %eax, 0xa0(%rsp)
movl $0x1000, %eax           # imm = 0x1000
andl 0x4(%r14), %eax
xorl $0x1, %r12d
xorl %esi, %esi
orl %eax, %r12d
cmoveq %rbx, %rsi
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
leaq 0x38(%rsp), %rdi
movaps %xmm0, 0x20(%rsp)
xorl %edx, %edx
callq 0x4c99d
movq 0x88(%rsp), %r12
movl (%r12), %ecx
testl %eax, %eax
je 0x3ecd7
xorl %eax, %eax
cmpl $0x1, %ecx
setne %al
movl %eax, (%r12)
je 0x3ecdc
leaq 0x1fec(%rbx), %rax
cmpl $0x1, %r15d
movl $0x1c88, %ecx           # imm = 0x1C88
movl $0x1e38, %r8d           # imm = 0x1E38
jmp 0x3ecf2
cmpl $0x1, %ecx
je 0x3ecbf
leaq 0x1fe8(%rbx), %rax
cmpl $0x1, %r15d
movl $0x1d60, %ecx           # imm = 0x1D60
movl $0x1f10, %r8d           # imm = 0x1F10
cmoveq %rcx, %r8
movaps 0x20(%rsp), %xmm0
movl (%rax), %edx
addq %rbx, %r8
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm1
movaps %xmm1, 0x60(%rsp)
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movsd 0x1ffc(%rbx), %xmm2
addps %xmm2, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rax, (%rsp)
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
movaps %xmm1, 0x40(%rsp)
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x3c90b
movq 0x70(%rsp), %rsi
testq %rsi, %rsi
je 0x3edac
movaps 0x20(%rsp), %xmm0
movaps 0x60(%rsp), %xmm2
addss %xmm0, %xmm2
movss 0x27b48(%rip), %xmm1    # 0x668a8
mulss 0x50(%rsp), %xmm1
addss %xmm2, %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
pushq $-0x1
popq %rdx
movq %r13, %rdi
movaps %xmm0, 0x20(%rsp)
movaps 0x40(%rsp), %xmm1
callq 0x13660
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm0
movss 0x2004(%rbx), %xmm1
addss %xmm0, %xmm1
movaps 0x40(%rsp), %xmm2
movss %xmm1, %xmm2            # xmm2 = xmm1[0],xmm2[1,2,3]
movss 0x50(%rsp), %xmm1
jmp 0x3edc3
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm0
movss 0x50(%rsp), %xmm1
movaps 0x40(%rsp), %xmm2
movaps %xmm1, %xmm3
addss %xmm2, %xmm3
maxss 0x18(%rsp), %xmm3
movss %xmm3, 0x18(%rsp)
movaps 0x20(%rsp), %xmm4
addss %xmm2, %xmm4
addss %xmm1, %xmm4
movaps %xmm4, 0x70(%rsp)
movss 0x3c(%rsp), %xmm1
addss %xmm2, %xmm1
addss 0x1ff8(%rbx), %xmm1
subss %xmm1, %xmm3
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movaps %xmm3, 0x50(%rsp)
movss 0x200c(%rbx), %xmm0
movl 0x1c84(%rbx), %edi
callq 0x140a0
leaq 0x98(%rsp), %r15
movl %eax, 0xc(%r15)
andq $0x0, (%r15)
movq 0x90(%rsp), %rbp
movq %rbp, %rdi
callq 0x13040
movq 0x168(%rbx), %r9
movaps 0x20(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
pushq $0x11
popq %r8
movq %r13, %rdi
movaps 0x50(%rsp), %xmm1
movq %rbp, %rsi
movl %eax, %edx
movq %r15, %rcx
callq 0x41852
cmpl $0x1, (%r12)
jne 0x3eeb8
movq 0x18(%r14), %rax
movl (%rax), %eax
cvtsi2ss %rax, %xmm0
addss 0x10(%rsp), %xmm0
movss 0x1ff8(%rbx), %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x28(%r14)
movaps %xmm1, %xmm0
maxss 0x10(%r14), %xmm0
addss 0x24cc(%rbx), %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x10(%r14)
incl 0xb0(%r14)
pushq $0x1
popq %rbp
jmp 0x3eeba
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c60(%rbx), %rbp
movss 0x200c(%rbx), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %r13, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x14230
jmp 0x3ec6e
movss 0x200c(%rbx), %xmm0
movl 0x1c80(%rbx), %edi
callq 0x140a0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
xorps %xmm2, %xmm2
movq %r13, %rdi
movl %eax, %esi
callq 0x12f00
movss 0x1ff0(%rbx), %xmm2
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x4b175
movaps %xmm0, 0x20(%rsp)
movaps %xmm1, 0x40(%rsp)
movss 0x1ff4(%rbx), %xmm0
movss %xmm0, 0x60(%rsp)
movss 0x200c(%rbx), %xmm0
movl 0x1c60(%rbx), %edi
callq 0x140a0
movq %r13, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movss 0x60(%rsp), %xmm2
movl %eax, %esi
callq 0x12f00
jmp 0x3ec6e