// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_combo_begin_image_text
NK_API nk_bool
nk_combo_begin_image_text(struct nk_context *ctx, const char *selected, int len,
    struct nk_image img, struct nk_vec2 size)
{
    struct nk_window *win;
    struct nk_style *style;
    struct nk_input *in;

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

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

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

    in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_DISABLED || 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;
    }

    text.text = nk_rgb_factor(text.text, style->combo.color_factor);

    switch(background->type) {
        case NK_STYLE_ITEM_IMAGE:
            text.background = nk_rgba(0, 0, 0, 0);
            nk_draw_image(&win->buffer, header, &background->data.image, nk_rgb_factor(nk_white, style->combo.color_factor));
            break;
        case NK_STYLE_ITEM_NINE_SLICE:
            text.background = nk_rgba(0, 0, 0, 0);
            nk_draw_nine_slice(&win->buffer, header, &background->data.slice, nk_rgb_factor(nk_white, style->combo.color_factor));
            break;
        case NK_STYLE_ITEM_COLOR:
            text.background = background->data.color;
            nk_fill_rect(&win->buffer, header, style->combo.rounding, nk_rgb_factor(background->data.color, style->combo.color_factor));
            nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, nk_rgb_factor(style->combo.border_color, style->combo.color_factor));
            break;
    }
    {
        struct nk_rect content;
        struct nk_rect button;
        struct nk_rect label;
        struct nk_rect image;
        int draw_button_symbol;

        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;

        /* represents whether or not the combo's button symbol should be drawn */
        draw_button_symbol = sym != NK_SYMBOL_NONE;

        /* 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;
        if (draw_button_symbol)
            nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
                &ctx->style.combo.button, sym, style->font);

        /* draw image */
        image.x = header.x + style->combo.content_padding.x;
        image.y = header.y + style->combo.content_padding.y;
        image.h = header.h - 2 * style->combo.content_padding.y;
        image.w = image.h;
        nk_draw_image(&win->buffer, image, &img, nk_rgb_factor(nk_white, style->combo.color_factor));

        /* draw label */
        text.padding = nk_vec2(0,0);
        label.x = image.x + image.w + style->combo.spacing.x + style->combo.content_padding.x;
        label.y = header.y + style->combo.content_padding.y;
        label.h = header.h - 2 * style->combo.content_padding.y;
        if (draw_button_symbol)
            label.w = (button.x - style->combo.content_padding.x) - label.x;
        else
            label.w = (header.x + header.w - style->combo.content_padding.x) - label.x;
        nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, 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 $0xb8, %rsp
movaps %xmm0, 0xa0(%rsp)
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x4dfe9
movq 0x3702c(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x1bd3e(%rip), %rsi     # 0x69d0c
leaq 0x1bd55(%rip), %rdx     # 0x69d2a
movl $0x73e9, %ecx           # imm = 0x73E9
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r15
testq %r15, %r15
jne 0x4e028
movq 0x36ff4(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x1bd06(%rip), %rsi     # 0x69d0c
leaq 0x1bd1d(%rip), %rdx     # 0x69d2a
movl $0x73ea, %ecx           # imm = 0x73EA
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r15
cmpq $0x0, 0xa8(%r15)
jne 0x4e070
movq 0x36fb7(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x1bcc9(%rip), %rsi     # 0x69d0c
leaq 0x1bce0(%rip), %rdx     # 0x69d2a
xorl %ebp, %ebp
movl $0x73eb, %ecx           # imm = 0x73EB
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r15
testq %r15, %r15
je 0x4e476
xorl %ebp, %ebp
cmpq $0x0, 0xa8(%r15)
je 0x4e476
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x12990
testl %eax, %eax
je 0x4e476
movq %r13, 0x58(%rsp)
movl %r12d, 0x54(%rsp)
movq 0xa8(%r15), %rcx
movl $0x1000, %edx           # imm = 0x1000
andl 0x4(%rcx), %edx
xorl $0x1, %eax
xorl %ecx, %ecx
orl %edx, %eax
movq %rbx, %rsi
cmovneq %rcx, %rsi
leaq 0x2598(%rbx), %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movaps %xmm0, 0x40(%rsp)
movaps %xmm1, 0x30(%rsp)
xorl %edx, %edx
callq 0x4c99d
movl %eax, %r13d
xorl %r12d, %r12d
testl %eax, %eax
setne 0x70(%rsp)
movl 0x2598(%rbx), %eax
movl %eax, %ecx
andl $0x10, %ecx
movl $0x2018, %edx           # imm = 0x2018
movl $0x2040, %esi           # imm = 0x2040
cmoveq %rdx, %rsi
shrl $0x2, %ecx
addq $0x2094, %rcx           # imm = 0x2094
testb $0x20, %al
movl $0x2068, %r14d          # imm = 0x2068
cmoveq %rsi, %r14
movl $0x209c, %eax           # imm = 0x209C
cmoveq %rcx, %rax
leaq (%rbx,%r14), %rbp
movl (%rbx,%rax), %edi
movss 0x21b4(%rbx), %xmm0
movss %xmm0, 0x2c(%rsp)
callq 0x140a0
movl %eax, 0x6c(%rsp)
movl (%rbx,%r14), %eax
testl %eax, %eax
je 0x4e1c7
cmpl $0x2, %eax
je 0x4e190
cmpl $0x1, %eax
jne 0x4e256
andl $0x0, 0x68(%rsp)
leaq 0x68(%r15), %r14
addq $0x8, %rbp
pushq $-0x1
popq %rdi
movss 0x2c(%rsp), %xmm0
callq 0x140a0
movq %r14, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movq %rbp, %rsi
movl %eax, %edx
callq 0x13660
jmp 0x4e256
andl $0x0, 0x68(%rsp)
leaq 0x68(%r15), %r14
addq $0x8, %rbp
pushq $-0x1
popq %rdi
movss 0x2c(%rsp), %xmm0
callq 0x140a0
movq %r14, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movq %rbp, %rsi
movl %eax, %edx
callq 0x14230
jmp 0x4e256
movl 0x8(%rbp), %edi
movl %edi, 0x68(%rsp)
leaq 0x68(%r15), %r14
movss 0x2198(%rbx), %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x2c(%rsp), %xmm0
callq 0x140a0
movq %r14, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movss 0x50(%rsp), %xmm2
movl %eax, %esi
callq 0x12f00
movss 0x2198(%rbx), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x2194(%rbx), %xmm0
movss %xmm0, 0x40(%rsp)
movss 0x21b4(%rbx), %xmm0
movl 0x2090(%rbx), %edi
callq 0x140a0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %r14, %rdi
movss 0x30(%rsp), %xmm2
movss 0x40(%rsp), %xmm3
movl %eax, %esi
callq 0x12070
leaq 0xf0(%rsp), %r14
xorl %eax, %eax
testl %r13d, %r13d
setne %al
movl 0x2598(%rbx), %ecx
testb $0x10, %cl
leaq 0x2188(,%rax,8), %rax
movl $0x218c, %edx           # imm = 0x218C
cmoveq %rax, %rdx
movl (%rbx,%rdx), %r13d
movss 0x1c(%rsp), %xmm4
movss 0x21a8(%rbx), %xmm0
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
movaps %xmm4, %xmm2
subss %xmm1, %xmm2
movss %xmm2, 0x88(%rsp)
movss 0x10(%rsp), %xmm3
movss 0x14(%rsp), %xmm5
addss 0x18(%rsp), %xmm3
subss %xmm4, %xmm3
subss 0x21a4(%rbx), %xmm3
movss %xmm3, 0x80(%rsp)
addss %xmm5, %xmm0
movss %xmm0, 0x84(%rsp)
movss %xmm2, 0x8c(%rsp)
movsd 0x2150(%rbx), %xmm1
movaps %xmm3, 0x40(%rsp)
addss %xmm1, %xmm3
movss %xmm3, 0x90(%rsp)
movaps %xmm1, %xmm3
shufps $0x55, %xmm1, %xmm3     # xmm3 = xmm3[1,1],xmm1[1,1]
addss %xmm0, %xmm3
movss %xmm3, 0x94(%rsp)
unpcklps %xmm2, %xmm2            # xmm2 = xmm2[0,0,1,1]
addps %xmm1, %xmm1
subps %xmm1, %xmm2
movlps %xmm2, 0x98(%rsp)
testl %r13d, %r13d
je 0x4e364
leaq 0x20b0(%rbx), %r8
leaq 0x68(%r15), %rdi
movq 0x168(%rbx), %rax
movq %rax, (%rsp)
leaq 0x80(%rsp), %rsi
leaq 0x90(%rsp), %rdx
movl %r13d, %r9d
callq 0x4ca9a
movss 0x14(%rsp), %xmm5
movss 0x1c(%rsp), %xmm4
movb 0x70(%rsp), %al
movb %al, %r12b
movaps 0x10(%rsp), %xmm0
movsd 0x219c(%rbx), %xmm1
movlhps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm5     # xmm5 = xmm5[2,0],xmm0[2,3]
addps %xmm1, %xmm5
movaps %xmm5, 0x30(%rsp)
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
addss %xmm1, %xmm1
subss %xmm1, %xmm4
movaps %xmm4, 0x70(%rsp)
leaq 0x68(%r15), %rbp
movss 0x21b4(%rbx), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movaps 0x70(%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movq %rbp, %rdi
movaps 0x30(%rsp), %xmm0
movq %r14, %rsi
movl %eax, %edx
callq 0x13660
movaps 0x70(%rsp), %xmm0
andq $0x0, 0x60(%rsp)
addss 0x30(%rsp), %xmm0
addss 0x21ac(%rbx), %xmm0
movsd 0x219c(%rbx), %xmm4
movss 0x14(%rsp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
addps %xmm4, %xmm0
movss 0x1c(%rsp), %xmm3
movaps %xmm4, %xmm2
shufps $0x55, %xmm4, %xmm2     # xmm2 = xmm2[1,1],xmm4[1,1]
addss %xmm2, %xmm2
subss %xmm2, %xmm3
testl %r13d, %r13d
je 0x4e41a
movq 0x58(%rsp), %rsi
movaps 0x40(%rsp), %xmm1
jmp 0x4e42b
movss 0x10(%rsp), %xmm1
addss 0x18(%rsp), %xmm1
movq 0x58(%rsp), %rsi
subss %xmm4, %xmm1
subss %xmm0, %xmm1
unpcklps %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movq 0x168(%rbx), %r9
leaq 0x60(%rsp), %rcx
pushq $0x11
popq %r8
movq %rbp, %rdi
movl 0x54(%rsp), %edx
callq 0x41852
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movq %rbx, %rdi
movq %r15, %rsi
movaps 0xa0(%rsp), %xmm0
movl %r12d, %edx
callq 0x4cb3c
movl %eax, %ebp
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq