// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::ColorPickerOptionsPopup(float const*, int)
void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags)
{
    bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask);
    bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);
    if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context"))
        return;
    ImGuiContext& g = *GImGui;
    if (allow_opt_picker)
    {
        ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function
        PushItemWidth(picker_size.x);
        for (int picker_type = 0; picker_type < 2; picker_type++)
        {
            // Draw small/thumbnail version of each picker type (over an invisible button for selection)
            if (picker_type > 0) Separator();
            PushID(picker_type);
            ImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoSidePreview | (flags & ImGuiColorEditFlags_NoAlpha);
            if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar;
            if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;
            ImVec2 backup_pos = GetCursorScreenPos();
            if (Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup
                g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask);
            SetCursorScreenPos(backup_pos);
            ImVec4 previewing_ref_col;
            memcpy(&previewing_ref_col, ref_col, sizeof(float) * ((picker_flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4));
            ColorPicker4("##previewing_picker", &previewing_ref_col.x, picker_flags);
            PopID();
        }
        PopItemWidth();
    }
    if (allow_opt_alpha_bar)
    {
        if (allow_opt_picker) Separator();
        CheckboxFlags("Alpha Bar", &g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);
    }
    EndPopup();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x6000000, %eax        # imm = 0x6000000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0xd(%rbp)
movl -0xc(%rbp), %ecx
andl $0x2, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
jne 0x150367
movl -0xc(%rbp), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movb %al, -0xe(%rbp)
testb $0x1, -0xd(%rbp)
jne 0x15037b
testb $0x1, -0xe(%rbp)
je 0x15038d
leaq 0x24f25(%rip), %rdi     # 0x1752a7
xorl %esi, %esi
callq 0xde5f0
testb $0x1, %al
jne 0x150392
jmp 0x15056b
leaq 0xc2ba7(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x18(%rbp)
testb $0x1, -0xd(%rbp)
je 0x150539
movq -0x18(%rbp), %rax
movss 0x2238e(%rip), %xmm0    # 0x172744
mulss 0x1980(%rax), %xmm0
movss %xmm0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movss 0x1980(%rax), %xmm0
movss %xmm0, -0x4c(%rbp)
callq 0xdd050
movaps %xmm0, %xmm1
movss -0x4c(%rbp), %xmm0
movq -0x18(%rbp), %rax
addss 0x15b0(%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
movss 0x22342(%rip), %xmm2    # 0x172744
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss 0x2082a(%rip), %xmm1    # 0x170c3c
callq 0x139050
movaps %xmm0, %xmm1
movss -0x48(%rbp), %xmm0
leaq -0x20(%rbp), %rdi
callq 0xbf4c0
movss -0x20(%rbp), %xmm0
callq 0xdcb10
movl $0x0, -0x24(%rbp)
cmpl $0x2, -0x24(%rbp)
jge 0x150534
cmpl $0x0, -0x24(%rbp)
jle 0x15044e
callq 0x13dec0
movl -0x24(%rbp), %edi
callq 0xdb550
movl -0xc(%rbp), %eax
andl $0x2, %eax
orl $0x1a8, %eax            # imm = 0x1A8
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x150475
movl -0x28(%rbp), %eax
orl $0x2000000, %eax        # imm = 0x2000000
movl %eax, -0x28(%rbp)
cmpl $0x1, -0x24(%rbp)
jne 0x150486
movl -0x28(%rbp), %eax
orl $0x4000000, %eax        # imm = 0x4000000
movl %eax, -0x28(%rbp)
callq 0xdc6c0
movlpd %xmm0, -0x30(%rbp)
leaq 0x3f86b(%rip), %rdi     # 0x18fd02
xorl %edx, %edx
leaq -0x20(%rbp), %rcx
movl %edx, %esi
callq 0x13f2b0
testb $0x1, %al
jne 0x1504aa
jmp 0x1504ce
movq -0x18(%rbp), %rax
movl 0x306c(%rax), %ecx
andl $0xf9ffffff, %ecx       # imm = 0xF9FFFFFF
movl -0x28(%rbp), %eax
andl $0x6000000, %eax        # imm = 0x6000000
orl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x306c(%rax)
leaq -0x30(%rbp), %rdi
callq 0xdc6f0
leaq -0x40(%rbp), %rdi
callq 0xe7e00
movq -0x8(%rbp), %rsi
movl -0x28(%rbp), %edx
andl $0x2, %edx
movl $0x4, %eax
movl $0x3, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
leaq -0x40(%rbp), %rdi
callq 0xd0a0
leaq -0x40(%rbp), %rsi
movl -0x28(%rbp), %edx
leaq 0x3f7f7(%rip), %rdi     # 0x18fd0f
xorl %eax, %eax
movl %eax, %ecx
callq 0x14dd20
callq 0xdb640
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x150439
callq 0xdcd30
testb $0x1, -0xe(%rbp)
je 0x150566
testb $0x1, -0xd(%rbp)
je 0x15054a
callq 0x13dec0
movq -0x18(%rbp), %rsi
addq $0x306c, %rsi           # imm = 0x306C
leaq 0x2be2c(%rip), %rdi     # 0x17c388
movl $0x10000, %edx          # imm = 0x10000
callq 0x13cd30
callq 0xde4e0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)