// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::CloseButton(unsigned int, ImVec2 const&)
bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)//, float size)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;

    // We intentionally allow interaction when clipped so that a mechanical Alt,Right,Validate sequence close a window.
    // (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible).
    const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
    bool is_clipped = !ItemAdd(bb, id);

    bool hovered, held;
    bool pressed = ButtonBehavior(bb, id, &hovered, &held);
    if (is_clipped)
        return pressed;

    // Render
    ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered);
    ImVec2 center = bb.GetCenter();
    if (hovered)
        window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12);

    float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
    ImU32 cross_col = GetColorU32(ImGuiCol_Text);
    center -= ImVec2(0.5f, 0.5f);
    window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
    window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);

    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xd80a7(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rax
movss 0x1980(%rax), %xmm1
leaq -0x48(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdi
callq 0x139090
movlpd %xmm0, -0x40(%rbp)
movq -0x18(%rbp), %rdi
addq $0x1598, %rdi           # imm = 0x1598
movss 0x370c8(%rip), %xmm0    # 0x171fcc
callq 0x13b210
movlpd %xmm0, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x139090
movq -0xb8(%rbp), %rsi
movlpd %xmm0, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0xe8660
movl -0x8(%rbp), %esi
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x51(%rbp)
movl -0x8(%rbp), %esi
leaq -0x30(%rbp), %rdi
leaq -0x52(%rbp), %rdx
leaq -0x53(%rbp), %rcx
xorl %r8d, %r8d
callq 0x139df0
andb $0x1, %al
movb %al, -0x54(%rbp)
testb $0x1, -0x51(%rbp)
je 0x13af7a
movb -0x54(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x13b1fc
movzbl -0x53(%rbp), %edi
andl $0x1, %edi
orl $0x16, %edi
movss 0x35cb0(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x58(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x15bad0
movlpd %xmm0, -0x60(%rbp)
testb $0x1, -0x52(%rbp)
je 0x13b003
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rax
movss 0x1980(%rax), %xmm1
movss 0x3700a(%rip), %xmm0    # 0x171fd8
mulss %xmm0, %xmm1
movss 0x35c62(%rip), %xmm0    # 0x170c3c
addss %xmm0, %xmm1
movss 0x36fe6(%rip), %xmm0    # 0x171fcc
callq 0x139050
movq -0xc8(%rbp), %rdi
movl -0x58(%rbp), %edx
leaq -0x60(%rbp), %rsi
movl $0xc, %ecx
callq 0x113600
movq -0x18(%rbp), %rax
movss 0x1980(%rax), %xmm0
movss 0x36fc1(%rip), %xmm1    # 0x171fd8
movss %xmm1, -0x124(%rbp)
mulss %xmm1, %xmm0
movss 0x531b5(%rip), %xmm1    # 0x18e1e0
mulss %xmm1, %xmm0
movss 0x36f49(%rip), %xmm1    # 0x171f80
addss %xmm1, %xmm0
movss %xmm0, -0x64(%rbp)
xorl %edi, %edi
movss 0x35bf2(%rip), %xmm0    # 0x170c3c
movss %xmm0, -0xfc(%rbp)
callq 0xc76e0
movss -0x124(%rbp), %xmm1
movl %eax, -0x68(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0x120(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x120(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x13b250
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x108(%rbp)
movss -0x64(%rbp), %xmm1
leaq -0x80(%rbp), %rdi
movq %rdi, -0x118(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x118(%rbp), %rsi
movq -0xe0(%rbp), %rdi
callq 0x139090
movlpd %xmm0, -0x78(%rbp)
movss -0x64(%rbp), %xmm1
movaps 0x36f16(%rip), %xmm0    # 0x171ff0
movaps %xmm0, -0xf0(%rbp)
pxor %xmm0, %xmm1
leaq -0x90(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x110(%rbp), %rsi
movq -0xe0(%rbp), %rdi
callq 0x139090
movq -0x108(%rbp), %rdi
movaps %xmm0, %xmm1
movss -0xfc(%rbp), %xmm0
movlpd %xmm1, -0x88(%rbp)
movl -0x68(%rbp), %ecx
leaq -0x78(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x112e20
movaps -0xf0(%rbp), %xmm2
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0xd0(%rbp)
movss -0x64(%rbp), %xmm0
movaps %xmm0, %xmm1
pxor %xmm2, %xmm1
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0xbf4c0
movq -0xf8(%rbp), %rsi
movq -0xe0(%rbp), %rdi
callq 0x139090
movaps -0xf0(%rbp), %xmm2
movlpd %xmm0, -0x98(%rbp)
movss -0x64(%rbp), %xmm1
movaps %xmm1, %xmm0
pxor %xmm2, %xmm0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0xbf4c0
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x139090
movq -0xd0(%rbp), %rdi
movlpd %xmm0, -0xa8(%rbp)
movl -0x68(%rbp), %ecx
leaq -0x98(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
movss 0x35a4d(%rip), %xmm0    # 0x170c3c
callq 0x112e20
movb -0x54(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)