// File: /workspace/github_c_makefile_star2_O1/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 0x5353a
movq 0x34adb(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x1e86d(%rip), %rsi     # 0x71d8c
leaq 0x1e884(%rip), %rdx     # 0x71daa
movl $0x738c, %ecx           # imm = 0x738C
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%rbx)
jne 0x53570
movq 0x34aa5(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x1e837(%rip), %rsi     # 0x71d8c
leaq 0x1e84e(%rip), %rdx     # 0x71daa
movl $0x738d, %ecx           # imm = 0x738D
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq 0x4780(%rbx), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x535ad
movq 0x34a68(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x1e7fa(%rip), %rsi     # 0x71d8c
leaq 0x1e811(%rip), %rdx     # 0x71daa
movl $0x738e, %ecx           # imm = 0x738E
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x53935
movq 0x4780(%rbx), %r14
testq %r14, %r14
je 0x53935
cmpq $0x0, 0xa8(%r14)
je 0x53935
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x128e0
testl %eax, %eax
je 0x53935
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 0x521be
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 0x53727
cmpl $0x2, %eax
je 0x536ce
cmpl $0x1, %eax
jne 0x537b4
addq $0x8, %rsi
movss 0x21b4(%rbx), %xmm0
ucomiss 0x1b22c(%rip), %xmm0    # 0x6e8b4
mulss 0x1b228(%rip), %xmm0    # 0x6e8b8
cvttss2si %xmm0, %eax
movl $0xff, %ecx
cmovnel %eax, %ecx
cmovpl %eax, %ecx
leaq 0x68(%r14), %rdi
movzbl %cl, %eax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
addl %eax, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x134d0
jmp 0x537b4
addq $0x8, %rsi
movss 0x21b4(%rbx), %xmm0
ucomiss 0x1b1d3(%rip), %xmm0    # 0x6e8b4
mulss 0x1b1cf(%rip), %xmm0    # 0x6e8b8
cvttss2si %xmm0, %eax
movl $0xff, %ecx
cmovnel %eax, %ecx
cmovpl %eax, %ecx
leaq 0x68(%r14), %rdi
movzbl %cl, %eax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
addl %eax, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x13fe0
jmp 0x537b4
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
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
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 0x53883
subss %xmm5, %xmm3
subss %xmm0, %xmm3
movaps %xmm3, %xmm1
jmp 0x5388b
addss %xmm4, %xmm4
subss %xmm4, %xmm1
movss %xmm1, 0x48(%rsp)
movss 0x21b4(%rbx), %xmm1
ucomiss 0x1b014(%rip), %xmm1    # 0x6e8b4
movb %r13b, %bpl
mulss 0x1b00d(%rip), %xmm1    # 0x6e8b8
leaq 0x68(%r14), %r12
cvttss2si %xmm1, %eax
movl $0xff, %ecx
cmovnel %eax, %ecx
cmovpl %eax, %ecx
movzbl %cl, %eax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
addl %eax, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movsd 0x48(%rsp), %xmm1
movq %r12, %rdi
callq 0x134d0
testl %r15d, %r15d
je 0x53915
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 0x522f0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movq %rbx, %rdi
movq %r14, %rsi
movaps 0x50(%rsp), %xmm0
movl %ebp, %edx
callq 0x52392
movl %eax, %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq