// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_combo_begin_image
NK_API nk_bool
nk_combo_begin_image(struct nk_context *ctx, struct nk_image img, struct nk_vec2 size)
{
    struct nk_window *win;
    struct nk_style *style;
    const 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;

    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 == NK_WIDGET_INVALID)
        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;
    else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
        background = &style->combo.hover;
    else background = &style->combo.normal;

    switch (background->type) {
        case NK_STYLE_ITEM_IMAGE:
            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:
            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:
            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 bounds = {0,0,0,0};
        struct nk_rect content;
        struct nk_rect button;
        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.y;
        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 image */
        bounds.h = header.h - 2 * style->combo.content_padding.y;
        bounds.y = header.y + style->combo.content_padding.y;
        bounds.x = header.x + style->combo.content_padding.x;
        if (draw_button_symbol)
            bounds.w = (button.x - style->combo.content_padding.y) - bounds.x;
        else
            bounds.w = header.w - 2 * style->combo.content_padding.x;
        nk_draw_image(&win->buffer, bounds, &img, nk_rgb_factor(nk_white, style->combo.color_factor));

        /* draw open/close button */
        if (draw_button_symbol)
            nk_draw_button_symbol(&win->buffer, &bounds, &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 $0x88, %rsp
movaps %xmm0, 0x60(%rsp)
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x4dbfd
movq 0x37418(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x1c12a(%rip), %rsi     # 0x69d0c
leaq 0x1c141(%rip), %rdx     # 0x69d2a
movl $0x738c, %ecx           # imm = 0x738C
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r14
testq %r14, %r14
jne 0x4dc3c
movq 0x373e0(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x1c0f2(%rip), %rsi     # 0x69d0c
leaq 0x1c109(%rip), %rdx     # 0x69d2a
movl $0x738d, %ecx           # imm = 0x738D
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r14
cmpq $0x0, 0xa8(%r14)
jne 0x4dc84
movq 0x373a3(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x1c0b5(%rip), %rsi     # 0x69d0c
leaq 0x1c0cc(%rip), %rdx     # 0x69d2a
xorl %ebp, %ebp
movl $0x738e, %ecx           # imm = 0x738E
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movq 0x4780(%rbx), %r14
testq %r14, %r14
je 0x4df82
xorl %ebp, %ebp
cmpq $0x0, 0xa8(%r14)
je 0x4df82
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x12990
testl %eax, %eax
je 0x4df82
movq 0xa8(%r14), %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 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x40(%rsp)
xorl %edx, %edx
callq 0x4c99d
movl %eax, %r15d
xorl %ebp, %ebp
testl %eax, %eax
setne 0x17(%rsp)
movl 0x2598(%rbx), %eax
testb $0x10, %al
movl $0x2018, %ecx           # imm = 0x2018
movl $0x2040, %edx           # imm = 0x2040
cmoveq %rcx, %rdx
testb $0x20, %al
movl $0x2068, %eax           # imm = 0x2068
cmoveq %rdx, %rax
leaq (%rbx,%rax), %r12
movl (%rbx,%rax), %eax
testl %eax, %eax
je 0x4dd98
cmpl $0x2, %eax
je 0x4dd64
cmpl $0x1, %eax
jne 0x4de27
leaq 0x68(%r14), %r13
addq $0x8, %r12
movss 0x21b4(%rbx), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movq %r13, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movq %r12, %rsi
movl %eax, %edx
callq 0x13660
jmp 0x4de27
leaq 0x68(%r14), %r13
addq $0x8, %r12
movss 0x21b4(%rbx), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movq %r13, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movq %r12, %rsi
movl %eax, %edx
callq 0x14230
jmp 0x4de27
leaq 0x68(%r14), %r13
movss 0x2198(%rbx), %xmm0
movss %xmm0, 0x2c(%rsp)
movss 0x21b4(%rbx), %xmm0
movl 0x8(%r12), %edi
callq 0x140a0
movq %r13, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movss 0x2c(%rsp), %xmm2
movl %eax, %esi
callq 0x12f00
movss 0x2198(%rbx), %xmm0
movss %xmm0, 0x40(%rsp)
movss 0x2194(%rbx), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x21b4(%rbx), %xmm0
movl 0x2090(%rbx), %edi
callq 0x140a0
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movq %r13, %rdi
movss 0x40(%rsp), %xmm2
movss 0x30(%rsp), %xmm3
movl %eax, %esi
callq 0x12070
leaq 0xc0(%rsp), %r12
xorl %eax, %eax
testl %r15d, %r15d
setne %al
testb $0x10, 0x2598(%rbx)
leaq 0x2188(,%rax,8), %rax
movl $0x218c, %ecx           # imm = 0x218C
cmoveq %rax, %rcx
movl (%rbx,%rcx), %r15d
movss 0x24(%rsp), %xmm1
movss 0x21a8(%rbx), %xmm4
movss 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm3
movaps %xmm3, %xmm2
addss %xmm0, %xmm2
subss %xmm1, %xmm2
subss %xmm4, %xmm2
movaps %xmm3, %xmm5
shufps $0x55, %xmm3, %xmm5     # xmm5 = xmm5[1,1],xmm3[1,1]
addss %xmm4, %xmm5
addss %xmm4, %xmm4
movaps %xmm1, %xmm6
subss %xmm4, %xmm6
movsd 0x2150(%rbx), %xmm4
unpcklps %xmm6, %xmm6            # xmm6 = xmm6[0,0,1,1]
movaps %xmm2, %xmm7
unpcklps %xmm5, %xmm7            # xmm7 = xmm7[0],xmm5[0],xmm7[1],xmm5[1]
addps %xmm4, %xmm7
addps %xmm4, %xmm4
subps %xmm4, %xmm6
movlhps %xmm6, %xmm7            # xmm7 = xmm7[0],xmm6[0]
movups %xmm7, 0x78(%rsp)
movsd 0x219c(%rbx), %xmm4
movaps %xmm4, %xmm5
shufps $0x55, %xmm4, %xmm5     # xmm5 = xmm5[1,1],xmm4[1,1]
movaps %xmm5, %xmm6
addss %xmm5, %xmm6
subss %xmm6, %xmm1
movss %xmm1, 0x5c(%rsp)
addps %xmm4, %xmm3
movlps %xmm3, 0x50(%rsp)
testl %r15d, %r15d
je 0x4deee
subss %xmm5, %xmm2
subss %xmm3, %xmm2
movaps %xmm2, %xmm0
jmp 0x4def6
addss %xmm4, %xmm4
subss %xmm4, %xmm0
movb 0x17(%rsp), %al
movb %al, %bpl
movss %xmm0, 0x58(%rsp)
leaq 0x68(%r14), %r13
movss 0x21b4(%rbx), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movq %r13, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x13660
testl %r15d, %r15d
je 0x4df62
leaq 0x20b0(%rbx), %r8
movl 0x2598(%rbx), %ecx
movq 0x168(%rbx), %rax
movq %rax, (%rsp)
leaq 0x50(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %r13, %rdi
movl %r15d, %r9d
callq 0x4ca9a
movsd 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movq %rbx, %rdi
movq %r14, %rsi
movaps 0x60(%rsp), %xmm0
movl %ebp, %edx
callq 0x4cb3c
movl %eax, %ebp
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq