// File: /workspace/github_cpp_makefile_star2_O3/donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::ButtonBehavior(ImRect const&, unsigned int, bool*, bool*, bool, int)
bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, ImGuiButtonFlags flags)
{
    ImGuiState& g = *GImGui;
    ImGuiWindow* window = GetCurrentWindow();

    if (flags & ImGuiButtonFlags_Disabled)
    {
        if (out_hovered) *out_hovered = false;
        if (out_held) *out_held = false;
        if (g.ActiveId == id) SetActiveID(0);
        return false;
    }

    bool pressed = false;
    const bool hovered = IsHovered(bb, id, (flags & ImGuiButtonFlags_FlattenChilds) != 0);
    if (hovered)
    {
        g.HoveredId = id;
        if (allow_key_modifiers || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
        {
            if (g.IO.MouseClicked[0])
            {
                if (flags & ImGuiButtonFlags_PressedOnClick)
                {
                    pressed = true;
                    SetActiveID(0);
                }
                else
                {
                    SetActiveID(id, window);
                }
                FocusWindow(window);
            }
            else if (g.IO.MouseReleased[0] && (flags & ImGuiButtonFlags_PressedOnRelease))
            {
                pressed = true;
                SetActiveID(0);
            }
            else if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && ImGui::IsMouseClicked(0, true))
            {
                pressed = true;
            }
        }
    }

    bool held = false;
    if (g.ActiveId == id)
    {
        if (g.IO.MouseDown[0])
        {
            held = true;
        }
        else
        {
            if (hovered)
                pressed = true;
            SetActiveID(0);
        }
    }

    if (out_hovered) *out_hovered = hovered;
    if (out_held) *out_held = held;

    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r15d
movl %esi, %r12d
movq 0x41a19(%rip), %r14     # 0x55480
movq 0x1758(%r14), %r13
movb $0x1, 0x72(%r13)
testb $0x20, %r15b
jne 0x13af5
movl %r8d, %ebx
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movl %r15d, %edx
andl $0x8, %edx
shrl $0x3, %edx
movl %r12d, %esi
callq 0xad1f
movl %eax, %esi
testb %al, %al
je 0x13b55
movl %r12d, 0x1788(%r14)
testb %bl, %bl
je 0x13b33
cmpb $0x1, 0x354(%r14)
jne 0x13bc4
shrl %r15d
xorl %eax, %eax
andl $0x1, %r15d
movl %r12d, %ecx
cmovnel %eax, %ecx
cmoveq %r13, %rax
movl %ecx, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq %rax, 0x17a0(%r14)
movq %r13, %rdi
movl %esi, %ebx
callq 0xce68
movl %ebx, %esi
jmp 0x13b58
testq %rdx, %rdx
je 0x13afd
movb $0x0, (%rdx)
testq %rcx, %rcx
je 0x13b05
movb $0x0, (%rcx)
cmpl %r12d, 0x1790(%r14)
jne 0x13b2e
movl $0x0, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq $0x0, 0x17a0(%r14)
xorl %r15d, %r15d
jmp 0x13bb2
cmpb $0x0, 0x105(%r14)
jne 0x13b55
cmpb $0x0, 0x106(%r14)
jne 0x13b55
cmpb $0x0, 0x107(%r14)
je 0x13aae
xorl %r15d, %r15d
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
cmpl %r12d, 0x1790(%r14)
jne 0x13ba1
movb $0x1, %al
cmpb $0x0, 0xf8(%r14)
jne 0x13ba3
movq 0x41904(%rip), %rax     # 0x55480
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
xorl %eax, %eax
movl %esi, %r15d
jmp 0x13ba3
xorl %eax, %eax
testq %rdx, %rdx
je 0x13bab
movb %sil, (%rdx)
testq %rcx, %rcx
je 0x13bb2
movb %al, (%rcx)
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x4, %r15b
je 0x13bfc
cmpb $0x0, 0x39d(%r14)
je 0x13bfc
movl $0x0, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq $0x0, 0x17a0(%r14)
movb $0x1, %r15b
jmp 0x13b58
testb $0x1, %r15b
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
je 0x13c33
cmpl %r12d, 0x1790(%r14)
jne 0x13c33
xorl %edi, %edi
movl %esi, %ebx
movl $0x1, %esi
callq 0xef5c
movl %ebx, %esi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl %eax, %r15d
jmp 0x13b60
xorl %r15d, %r15d
jmp 0x13b60