// File: /workspace/github_c_makefile_star2_O1/0x0203[P]schack_poc/./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;
        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)
movl $0x0, 0x28(%rsp)
testq %rdi, %rdi
je 0x12179
movq %rdi, %rbx
movq 0x3fe8(%rdi), %r12
testq %r12, %r12
je 0x12198
movq %r8, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
movq 0xa8(%r12), %r13
testq %r13, %r13
je 0x121b7
movl %esi, %ebp
movq %rdx, %r14
addq $0x68, %r12
movss 0x1e8c(%rbx), %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x1e90(%rbx), %xmm0
movss %xmm0, 0x2c(%rsp)
movq 0x168(%rbx), %rax
movss 0x1aa0(%rbx), %xmm0
addss %xmm0, %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0x30(%rsp)
movq %rbx, %rdi
callq 0x10a23
movq %rbx, %rdi
xorl %esi, %esi
movss 0x30(%rsp), %xmm0
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x10b4c
movq %rbx, %rdi
callq 0xa0d7
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xfda9
movl %eax, %r15d
cmpl $0x1, %ebp
jne 0x11e75
cmpl $0x1, 0x17a0(%rbx)
jne 0x11e84
leaq 0x17a8(%rbx), %rsi
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7b23
movl $0x0, 0x78(%rsp)
jmp 0x11f10
movl 0x1e28(%rbx), %eax
movl %eax, 0x78(%rsp)
jmp 0x11f10
movl 0x17a8(%rbx), %eax
movl %eax, 0x78(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movl 0x17c0(%rbx), %esi
xorps %xmm2, %xmm2
movq %r12, %rdi
callq 0x6fee
movss 0x1a90(%rbx), %xmm2
movsd 0x10(%rsp), %xmm3
movsd 0x18(%rsp), %xmm0
movaps %xmm2, %xmm4
addss %xmm2, %xmm4
movaps %xmm4, %xmm1
maxss %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
maxss %xmm0, %xmm4
movaps %xmm2, %xmm0
addss %xmm3, %xmm0
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
addss %xmm2, %xmm3
unpcklps %xmm3, %xmm0            # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
mulss 0x164bd(%rip), %xmm2    # 0x283ac
addss %xmm2, %xmm1
addss %xmm4, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movss 0x1a94(%rbx), %xmm2
movl 0x17a8(%rbx), %esi
movq %r12, %rdi
callq 0x6fee
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 0x28(%rsp), %rdi
xorl %edx, %edx
callq 0x1e017
testl %eax, %eax
movq 0x60(%rsp), %rdx
je 0x11f51
xorl %eax, %eax
cmpl $0x1, (%rdx)
setne %al
movl %eax, (%rdx)
cmpl $0x1, %ebp
movl $0x17c8, %eax           # imm = 0x17C8
movl $0x1928, %ecx           # imm = 0x1928
cmoveq %rax, %rcx
movl $0x1878, %eax           # imm = 0x1878
movl $0x19d8, %r8d           # imm = 0x19D8
cmoveq %rax, %r8
xorl %eax, %eax
cmpl $0x1, (%rdx)
sete %al
cmoveq %rcx, %r8
movl 0x1a88(%rbx,%rax,4), %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]
movss 0x10(%rsp), %xmm0
movss 0x14(%rsp), %xmm2
addss 0x1aa0(%rbx), %xmm2
addss 0x1a9c(%rbx), %xmm0
movaps %xmm0, 0x80(%rsp)
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movq %rax, (%rsp)
xorl %ebp, %ebp
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x40(%rsp)
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x10525
testq %r14, %r14
je 0x12058
movaps 0x90(%rsp), %xmm0
addss 0x80(%rsp), %xmm0
movss 0x163a2(%rip), %xmm1    # 0x283a8
mulss 0x50(%rsp), %xmm1
addss %xmm0, %xmm1
movaps 0x30(%rsp), %xmm0
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movq %r12, %rdi
movaps %xmm0, 0x30(%rsp)
movaps 0x40(%rsp), %xmm1
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7b23
movss 0x50(%rsp), %xmm1
movq 0x168(%rbx), %rax
movss 0x8(%rax), %xmm0
addss 0x1aa4(%rbx), %xmm0
movaps 0x40(%rsp), %xmm2
movss %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1,2,3]
jmp 0x12063
movss 0x50(%rsp), %xmm1
movaps 0x40(%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, 0x50(%rsp)
movss 0x2c(%rsp), %xmm0
addss %xmm2, %xmm0
addss 0x1a98(%rbx), %xmm0
subss %xmm0, %xmm3
movq 0x168(%rbx), %rax
movl 0x17c4(%rbx), %ecx
movss 0x8(%rax), %xmm0
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movaps %xmm3, 0x40(%rsp)
leaq 0x70(%rsp), %r15
movl %ecx, 0xc(%r15)
movq $0x0, (%r15)
movq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x3879
movq 0x168(%rbx), %r9
movaps 0x30(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movq %r12, %rdi
movaps 0x40(%rsp), %xmm1
movq %r14, %rsi
movl %eax, %edx
movq %r15, %rcx
movl $0x11, %r8d
callq 0x13f12
movq 0x60(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x12165
movq 0x18(%r13), %rax
movl (%rax), %eax
xorps %xmm0, %xmm0
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
movss %xmm0, 0x10(%r13)
addss 0x1ea4(%rbx), %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x10(%r13)
incl 0xb0(%r13)
movl $0x1, %ebp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a395(%rip), %rdi     # 0x2c515
leaq 0x174fc(%rip), %rsi     # 0x29683
leaq 0x1dd49(%rip), %rcx     # 0x2fed7
movl $0x4735, %edx           # imm = 0x4735
callq 0x3100
leaq 0x18fa8(%rip), %rdi     # 0x2b147
leaq 0x174dd(%rip), %rsi     # 0x29683
leaq 0x1dd2a(%rip), %rcx     # 0x2fed7
movl $0x4736, %edx           # imm = 0x4736
callq 0x3100
leaq 0x19105(%rip), %rdi     # 0x2b2c3
leaq 0x174be(%rip), %rsi     # 0x29683
leaq 0x1dd0b(%rip), %rcx     # 0x2fed7
movl $0x4737, %edx           # imm = 0x4737
callq 0x3100