// File: /workspace/github_c_makefile_star2_O3/space222[P]silo/./nuklear.h
// Function: nk_combo_begin_text
NK_API int
nk_combo_begin_text(struct nk_context *ctx, const char *selected, int len,
    struct nk_vec2 size)
{
    const struct nk_input *in;
    struct nk_window *win;
    struct nk_style *style;

    enum nk_widget_layout_states s;
    int is_clicked = nk_false;
    struct nk_rect header;
    const struct nk_style_item *background;
    struct nk_text text;

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

    win = ctx->current;
    style = &ctx->style;
    s = nk_widget(&header, ctx);
    if (s == NK_WIDGET_INVALID)
        return 0;

    in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
    if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT))
        is_clicked = nk_true;

    /* draw combo box header background and border */
    if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) {
        background = &style->combo.active;
        text.text = style->combo.label_active;
    } else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) {
        background = &style->combo.hover;
        text.text = style->combo.label_hover;
    } else {
        background = &style->combo.normal;
        text.text = style->combo.label_normal;
    }
    if (background->type == NK_STYLE_ITEM_IMAGE) {
        text.background = nk_rgba(0,0,0,0);
        nk_draw_image(&win->buffer, header, &background->data.image, nk_white);
    } else {
        text.background = background->data.color;
        nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color);
        nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color);
    }
    {
        /* print currently selected text item */
        struct nk_rect label;
        struct nk_rect button;
        struct nk_rect content;

        enum nk_symbol_type sym;
        if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
            sym = style->combo.sym_hover;
        else if (is_clicked)
            sym = style->combo.sym_active;
        else sym = style->combo.sym_normal;

        /* calculate button */
        button.w = header.h - 2 * style->combo.button_padding.y;
        button.x = (header.x + header.w - header.h) - style->combo.button_padding.x;
        button.y = header.y + style->combo.button_padding.y;
        button.h = button.w;

        content.x = button.x + style->combo.button.padding.x;
        content.y = button.y + style->combo.button.padding.y;
        content.w = button.w - 2 * style->combo.button.padding.x;
        content.h = button.h - 2 * style->combo.button.padding.y;

        /* draw selected label */
        text.padding = nk_vec2(0,0);
        label.x = header.x + style->combo.content_padding.x;
        label.y = header.y + style->combo.content_padding.y;
        label.w = button.x - (style->combo.content_padding.x + style->combo.spacing.x) - label.x;;
        label.h = header.h - 2 * style->combo.content_padding.y;
        nk_widget_text(&win->buffer, label, selected, len, &text,
            NK_TEXT_LEFT, ctx->style.font);

        /* draw open/close button */
        nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
            &ctx->style.combo.button, sym, style->font);
    }
    return nk_combo_begin(ctx, win, size, is_clicked, header);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
testq %rdi, %rdi
je 0x1d5d5
movq %rsi, %r12
testq %rsi, %rsi
je 0x1d5f4
movq %rdi, %rbx
movq 0x3fe8(%rdi), %r14
testq %r14, %r14
je 0x1d613
movaps %xmm0, 0x60(%rsp)
cmpq $0x0, 0xa8(%r14)
je 0x1d632
movl %edx, %r15d
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xfe72
testl %eax, %eax
je 0x1d406
movq 0xa8(%r14), %rcx
xorl %edx, %edx
testl $0x1000, 0x4(%rcx)      # imm = 0x1000
movq %rbx, %rsi
cmovneq %rdx, %rsi
cmpl $0x2, %eax
cmoveq %rdx, %rsi
leaq 0x1f70(%rbx), %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x20(%rsp)
xorl %edx, %edx
callq 0x1d651
movl %eax, %ebp
xorl %edi, %edi
testl %eax, %eax
setne %dil
movl 0x1f70(%rbx), %eax
movl %eax, %ecx
andl $0x10, %ecx
shrl $0x4, %ecx
leaq 0x1b14(,%rcx,4), %rdx
shll $0x5, %ecx
addq $0x1ab0, %rcx           # imm = 0x1AB0
testb $0x20, %al
movl $0x1af0, %eax           # imm = 0x1AF0
cmoveq %rcx, %rax
movl $0x1b1c, %ecx           # imm = 0x1B1C
cmoveq %rdx, %rcx
leaq (%rbx,%rax), %rsi
movl (%rbx,%rcx), %ecx
movl %ecx, 0x4c(%rsp)
cmpl $0x1, (%rbx,%rax)
movl %r15d, 0x1c(%rsp)
movq %r12, 0x38(%rsp)
movl %edi, 0x18(%rsp)
jne 0x1d40d
movl $0x0, 0x48(%rsp)
leaq 0x68(%r14), %rdi
addq $0x8, %rsi
movaps 0x50(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7c36
jmp 0x1d45c
xorl %eax, %eax
jmp 0x1d5c3
movl 0x8(%rsi), %esi
movl %esi, 0x48(%rsp)
leaq 0x68(%r14), %r15
movss 0x1bf0(%rbx), %xmm2
movq %r15, %rdi
movaps 0x50(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
callq 0x7178
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movss 0x1bf0(%rbx), %xmm2
movss 0x1bec(%rbx), %xmm3
movl 0x1b10(%rbx), %esi
movq %r15, %rdi
callq 0x702d
xorl %eax, %eax
testl %ebp, %ebp
setne %al
testb $0x10, 0x1f70(%rbx)
leaq 0x1be0(,%rax,8), %rax
movl $0x1be4, %ecx           # imm = 0x1BE4
cmoveq %rax, %rcx
movl (%rbx,%rcx), %eax
movl %eax, 0x20(%rsp)
movss 0x14(%rsp), %xmm2
movss 0x1c00(%rbx), %xmm4
movaps %xmm4, %xmm0
addss %xmm4, %xmm0
movaps %xmm2, %xmm3
subss %xmm0, %xmm3
leaq 0x88(%rsp), %rbp
movss %xmm3, 0x8(%rbp)
movsd 0x8(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
addss %xmm0, %xmm1
subss %xmm2, %xmm1
subss 0x1bfc(%rbx), %xmm1
movaps %xmm0, %xmm5
shufps $0x55, %xmm0, %xmm5     # xmm5 = xmm5[1,1],xmm0[1,1]
addss %xmm4, %xmm5
movss %xmm3, 0xc(%rbp)
leaq 0x1b30(%rbx), %r13
movsd 0x1bb0(%rbx), %xmm4
movaps %xmm4, %xmm6
shufps $0x55, %xmm4, %xmm6     # xmm6 = xmm6[1,1],xmm4[1,1]
unpcklps %xmm3, %xmm3            # xmm3 = xmm3[0,0,1,1]
movaps %xmm1, %xmm7
addss %xmm4, %xmm7
addps %xmm4, %xmm4
subps %xmm4, %xmm3
leaq 0x78(%rsp), %r15
movlps %xmm3, 0x8(%r15)
leaq 0x40(%rsp), %rcx
movq $0x0, (%rcx)
movss %xmm1, (%rbp)
movss %xmm5, 0x4(%rbp)
movss %xmm7, (%r15)
addss %xmm6, %xmm5
movss %xmm5, 0x4(%r15)
movsd 0x1bf4(%rbx), %xmm3
addps %xmm3, %xmm0
movss 0x1c04(%rbx), %xmm4
addss %xmm3, %xmm4
subss %xmm4, %xmm1
subss %xmm0, %xmm1
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
addss %xmm3, %xmm3
subss %xmm3, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
leaq 0x68(%r14), %r12
movq 0x168(%rbx), %r9
movq %r12, %rdi
movq 0x38(%rsp), %rsi
movl 0x1c(%rsp), %edx
movl $0x11, %r8d
callq 0x13fa7
movl 0x1f70(%rbx), %ecx
movq 0x168(%rbx), %rax
movq %rax, (%rsp)
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %r8
movl 0x20(%rsp), %r9d
callq 0x1d780
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movq %rbx, %rdi
movq %r14, %rsi
movaps 0x60(%rsp), %xmm0
movl 0x18(%rsp), %edx
callq 0x1d807
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9137(%rip), %rdi      # 0x26713
leaq 0x60f0(%rip), %rsi      # 0x236d3
leaq 0xa626(%rip), %rcx      # 0x27c10
movl $0x6010, %edx           # imm = 0x6010
callq 0x20a0
leaq 0xa665(%rip), %rdi      # 0x27c60
leaq 0x60d1(%rip), %rsi      # 0x236d3
leaq 0xa607(%rip), %rcx      # 0x27c10
movl $0x6011, %edx           # imm = 0x6011
callq 0x20a0
leaq 0x7b81(%rip), %rdi      # 0x2519b
leaq 0x60b2(%rip), %rsi      # 0x236d3
leaq 0xa5e8(%rip), %rcx      # 0x27c10
movl $0x6012, %edx           # imm = 0x6012
callq 0x20a0
leaq 0x7cde(%rip), %rdi      # 0x25317
leaq 0x6093(%rip), %rsi      # 0x236d3
leaq 0xa5c9(%rip), %rcx      # 0x27c10
movl $0x6013, %edx           # imm = 0x6013
callq 0x20a0