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

    ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
    ItemAdd(bb, id);
    bool hovered, held;
    bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);

    // Render
    ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
    ImU32 text_col = GetColorU32(ImGuiCol_Text);
    ImVec2 center = bb.GetCenter();
    if (hovered || held)
        window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12);
    RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);

    // Switch to moving the window after mouse is moved beyond the initial drag threshold
    if (IsItemActive() && IsMouseDragging(0))
        StartMouseMovingWindow(window);

    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xd7c87(%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, -0x78(%rbp)
movq -0x18(%rbp), %rax
movss 0x1980(%rax), %xmm1
leaq -0x48(%rbp), %rdi
movq %rdi, -0x80(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0x139090
movlpd %xmm0, -0x40(%rbp)
movq -0x18(%rbp), %rdi
addq $0x1598, %rdi           # imm = 0x1598
movss 0x36cb4(%rip), %xmm0    # 0x171fcc
callq 0x13b210
movlpd %xmm0, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x139090
movq -0x78(%rbp), %rsi
movlpd %xmm0, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0xe8660
movl -0x4(%rbp), %esi
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
movl -0x4(%rbp), %esi
leaq -0x30(%rbp), %rdi
leaq -0x51(%rbp), %rdx
leaq -0x52(%rbp), %rcx
xorl %r8d, %r8d
callq 0x139df0
andb $0x1, %al
movb %al, -0x53(%rbp)
testb $0x1, -0x52(%rbp)
je 0x13b38a
testb $0x1, -0x51(%rbp)
je 0x13b38a
movl $0x17, %eax
movl %eax, -0x84(%rbp)
jmp 0x13b3a3
movb -0x51(%rbp), %dl
movl $0x15, %eax
movl $0x16, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %edi
movss 0x3588b(%rip), %xmm0    # 0x170c3c
movss %xmm0, -0x88(%rbp)
callq 0xc76e0
movss -0x88(%rbp), %xmm0
movl %eax, -0x58(%rbp)
xorl %edi, %edi
callq 0xc76e0
movl %eax, -0x5c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x15bad0
movlpd %xmm0, -0x64(%rbp)
testb $0x1, -0x51(%rbp)
jne 0x13b3ed
testb $0x1, -0x52(%rbp)
je 0x13b42d
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rdi
movq -0x18(%rbp), %rax
movss 0x1980(%rax), %xmm0
movss 0x36bcc(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss 0x35824(%rip), %xmm1    # 0x170c3c
addss %xmm1, %xmm0
movl -0x58(%rbp), %edx
leaq -0x64(%rbp), %rsi
movl $0xc, %ecx
callq 0x113600
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rsi
addq $0x1598, %rsi           # imm = 0x1598
leaq -0x30(%rbp), %rdi
callq 0x139090
movq -0x90(%rbp), %rdi
movlpd %xmm0, -0x6c(%rbp)
movl -0x5c(%rbp), %esi
movq -0x20(%rbp), %rax
movb 0x91(%rax), %al
notb %al
movzbl %al, %ecx
andl $0x1, %ecx
movl %ecx, %eax
leal 0x1(%rax,%rax), %edx
movsd -0x6c(%rbp), %xmm0
movss 0x357b5(%rip), %xmm1    # 0x170c3c
callq 0x11ca10
callq 0xd53c0
testb $0x1, %al
jne 0x13b497
jmp 0x13b4b5
xorl %edi, %edi
movss 0x36adf(%rip), %xmm0    # 0x171f80
callq 0xd4fe0
testb $0x1, %al
jne 0x13b4ac
jmp 0x13b4b5
movq -0x20(%rbp), %rdi
callq 0xcb2c0
movb -0x53(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)