// File: /workspace/github_cpp_makefile_star2_O2/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 0x3fce8(%rip), %r14     # 0x50480
movq 0x1758(%r14), %r13
movb $0x1, 0x72(%r13)
testb $0x20, %r15b
jne 0x1082f
movl %r8d, %ebx
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movl %r15d, %edx
andl $0x8, %edx
shrl $0x3, %edx
movl %r12d, %esi
callq 0x9d62
movl %eax, %esi
testb %al, %al
je 0x10889
movl %r12d, 0x1788(%r14)
testb %bl, %bl
je 0x10867
cmpb $0x1, 0x354(%r14)
jne 0x108f2
shrl %r15d
xorl %eax, %eax
andl $0x1, %r15d
movl %r12d, %ecx
cmovnel %eax, %ecx
cmoveq %r13, %rax
movq 0x3fc75(%rip), %rdx     # 0x50480
movl %ecx, 0x1790(%rdx)
movw $0x1, 0x1799(%rdx)
movq %rax, 0x17a0(%rdx)
movq %r13, %rdi
movl %esi, %ebx
callq 0xb5a3
movl %ebx, %esi
jmp 0x1088c
testq %rdx, %rdx
je 0x10837
movb $0x0, (%rdx)
testq %rcx, %rcx
je 0x1083f
movb $0x0, (%rcx)
cmpl %r12d, 0x1790(%r14)
jne 0x10862
andl $0x0, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
andq $0x0, 0x17a0(%r14)
xorl %r15d, %r15d
jmp 0x108e0
cmpb $0x0, 0x105(%r14)
jne 0x10889
cmpb $0x0, 0x106(%r14)
jne 0x10889
cmpb $0x0, 0x107(%r14)
je 0x107e3
xorl %r15d, %r15d
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
cmpl %r12d, 0x1790(%r14)
jne 0x108cf
movb $0x1, %al
cmpb $0x0, 0xf8(%r14)
jne 0x108d1
movq 0x3fbd0(%rip), %rax     # 0x50480
andl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
andq $0x0, 0x17a0(%rax)
xorl %eax, %eax
movl %esi, %r15d
jmp 0x108d1
xorl %eax, %eax
testq %rdx, %rdx
je 0x108d9
movb %sil, (%rdx)
testq %rcx, %rcx
je 0x108e0
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 0x10929
cmpb $0x0, 0x39d(%r14)
je 0x10929
movq 0x3fb77(%rip), %rax     # 0x50480
andl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
andq $0x0, 0x17a0(%rax)
movb $0x1, %r15b
jmp 0x1088c
testb $0x1, %r15b
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
je 0x1095e
cmpl %r12d, 0x1790(%r14)
jne 0x1095e
movl %esi, %ebx
pushq $0x1
popq %rsi
xorl %edi, %edi
callq 0xce47
movl %ebx, %esi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl %eax, %r15d
jmp 0x10894
xorl %r15d, %r15d
jmp 0x10894