// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movaps %xmm0, 0x50(%rsp)
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x529a3
movq 0x34672(%rip), %r14     # 0x86ff0
movq (%r14), %rdi
leaq 0x1e414(%rip), %rsi     # 0x70d9c
leaq 0x1e42b(%rip), %rdx     # 0x70dba
movl $0x738c, %ecx           # imm = 0x738C
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq 0x4780(%rbx), %r14
testq %r14, %r14
jne 0x529e2
movq 0x3463a(%rip), %r14     # 0x86ff0
movq (%r14), %rdi
leaq 0x1e3dc(%rip), %rsi     # 0x70d9c
leaq 0x1e3f3(%rip), %rdx     # 0x70dba
movl $0x738d, %ecx           # imm = 0x738D
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq 0x4780(%rbx), %r14
cmpq $0x0, 0xa8(%r14)
jne 0x52a2a
movq 0x345fd(%rip), %r14     # 0x86ff0
movq (%r14), %rdi
leaq 0x1e39f(%rip), %rsi     # 0x70d9c
leaq 0x1e3b6(%rip), %rdx     # 0x70dba
xorl %ebp, %ebp
movl $0x738e, %ecx           # imm = 0x738E
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq 0x4780(%rbx), %r14
testq %r14, %r14
je 0x52d9a
xorl %ebp, %ebp
cmpq $0x0, 0xa8(%r14)
je 0x52d9a
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x128e0
testl %eax, %eax
je 0x52d9a
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 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movaps %xmm0, 0x20(%rsp)
movaps %xmm1, 0x30(%rsp)
xorl %edx, %edx
callq 0x5160c
movl %eax, %r15d
xorl %ebp, %ebp
testl %eax, %eax
setne %r13b
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), %rsi
movl (%rbx,%rax), %eax
testl %eax, %eax
je 0x52b91
cmpl $0x2, %eax
je 0x52b35
cmpl $0x1, %eax
jne 0x52c1e
addq $0x8, %rsi
movss 0x21b4(%rbx), %xmm0
movss 0x1adbb(%rip), %xmm1    # 0x6d8a8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movl $0xff, %ecx
andl %ecx, %eax
ucomiss 0x1ada1(%rip), %xmm0    # 0x6d8a4
leaq 0x68(%r14), %rdi
cmovnel %eax, %ecx
cmovpl %eax, %ecx
movl %ecx, %eax
shll $0x10, %eax
movl %ecx, %edx
shll $0x8, %edx
orl %eax, %edx
addl %ecx, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x134d0
jmp 0x52c1e
addq $0x8, %rsi
movss 0x21b4(%rbx), %xmm0
movss 0x1ad5f(%rip), %xmm1    # 0x6d8a8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movl $0xff, %ecx
andl %ecx, %eax
ucomiss 0x1ad45(%rip), %xmm0    # 0x6d8a4
leaq 0x68(%r14), %rdi
cmovnel %eax, %ecx
cmovpl %eax, %ecx
movl %ecx, %eax
shll $0x10, %eax
movl %ecx, %edx
shll $0x8, %edx
orl %eax, %edx
addl %ecx, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x13fe0
jmp 0x52c1e
leaq 0x68(%r14), %r12
movss 0x2198(%rbx), %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x21b4(%rbx), %xmm0
movl 0x8(%rsi), %edi
callq 0x13e60
movq %r12, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movss 0x1c(%rsp), %xmm2
movl %eax, %esi
callq 0x12de0
movss 0x2198(%rbx), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x2194(%rbx), %xmm0
movss %xmm0, 0x20(%rsp)
movss 0x21b4(%rbx), %xmm0
movl 0x2090(%rbx), %edi
callq 0x13e60
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r12, %rdi
movss 0x30(%rsp), %xmm2
movss 0x20(%rsp), %xmm3
movl %eax, %esi
callq 0x12060
leaq 0xb0(%rsp), %rsi
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 0x14(%rsp), %xmm2
movss 0x21a8(%rbx), %xmm4
movss 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
movaps %xmm0, %xmm3
addss %xmm1, %xmm3
subss %xmm2, %xmm3
subss %xmm4, %xmm3
movaps %xmm0, %xmm5
shufps $0x55, %xmm0, %xmm5     # xmm5 = xmm5[1,1],xmm0[1,1]
addss %xmm4, %xmm5
addss %xmm4, %xmm4
movaps %xmm2, %xmm6
subss %xmm4, %xmm6
movsd 0x2150(%rbx), %xmm4
unpcklps %xmm6, %xmm6            # xmm6 = xmm6[0,0,1,1]
movaps %xmm3, %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, 0x68(%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, %xmm2
movss %xmm2, 0x4c(%rsp)
addps %xmm4, %xmm0
movlps %xmm0, 0x40(%rsp)
testl %r15d, %r15d
je 0x52ce5
subss %xmm5, %xmm3
subss %xmm0, %xmm3
movaps %xmm3, %xmm1
jmp 0x52ced
addss %xmm4, %xmm4
subss %xmm4, %xmm1
movb %r13b, %bpl
movss %xmm1, 0x48(%rsp)
movss 0x21b4(%rbx), %xmm1
movss 0x1aba2(%rip), %xmm2    # 0x6d8a8
mulss %xmm1, %xmm2
cvttss2si %xmm2, %eax
movl $0xff, %ecx
andl %ecx, %eax
ucomiss 0x1ab88(%rip), %xmm1    # 0x6d8a4
cmovnel %eax, %ecx
cmovpl %eax, %ecx
leaq 0x68(%r14), %r12
movl %ecx, %eax
shll $0x10, %eax
movl %ecx, %edx
shll $0x8, %edx
orl %eax, %edx
addl %ecx, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movsd 0x48(%rsp), %xmm1
movq %r12, %rdi
callq 0x134d0
testl %r15d, %r15d
je 0x52d7a
leaq 0x20b0(%rbx), %r8
movl 0x2598(%rbx), %ecx
movq 0x168(%rbx), %rax
movq %rax, (%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq %r12, %rdi
movl %r15d, %r9d
callq 0x5173c
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movq %rbx, %rdi
movq %r14, %rsi
movaps 0x50(%rsp), %xmm0
movl %ebp, %edx
callq 0x517de
movl %eax, %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq