// File: /workspace/github_cpp_makefile_star2_O1/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 0x416e5(%rip), %r14     # 0x55490
movq 0x1758(%r14), %r13
movb $0x1, 0x72(%r13)
testb $0x20, %r15b
jne 0x13e42
movl %r8d, %ebx
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movl %r15d, %edx
andl $0x8, %edx
shrl $0x3, %edx
movl %r12d, %esi
callq 0xae36
movl %eax, %esi
testb %al, %al
je 0x13e80
movl %r12d, 0x1788(%r14)
testb %bl, %bl
je 0x13ef1
cmpb $0x1, 0x354(%r14)
jne 0x13f1e
xorl %eax, %eax
andl $0x2, %r15d
movl $0x0, %ecx
cmovel %r12d, %ecx
cmoveq %r13, %rax
shrl %r15d
movl %ecx, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq %rax, 0x17a0(%r14)
movq %r13, %rdi
movl %esi, %ebx
callq 0xd00c
movl %ebx, %esi
movb $0x1, %bl
jmp 0x13e85
testq %rdx, %rdx
je 0x13e4a
movb $0x0, (%rdx)
testq %rcx, %rcx
je 0x13e52
movb $0x0, (%rcx)
cmpl %r12d, 0x1790(%r14)
jne 0x13e7b
movl $0x0, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq $0x0, 0x17a0(%r14)
xorl %r15d, %r15d
jmp 0x13edf
xorl %ebx, %ebx
xorl %r15d, %r15d
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
cmpl %r12d, 0x1790(%r14)
jne 0x13ece
movb $0x1, %al
cmpb $0x0, 0xf8(%r14)
jne 0x13ed0
movq 0x415e7(%rip), %rax     # 0x55490
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
xorl %eax, %eax
movl %ebx, %r15d
jmp 0x13ed0
xorl %eax, %eax
testq %rdx, %rdx
je 0x13ed8
movb %sil, (%rdx)
testq %rcx, %rcx
je 0x13edf
movb %al, (%rcx)
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bl
cmpb $0x0, 0x105(%r14)
jne 0x13e82
cmpb $0x0, 0x106(%r14)
jne 0x13e82
cmpb $0x0, 0x107(%r14)
je 0x13df6
jmp 0x13e82
testb $0x4, %r15b
je 0x13f58
cmpb $0x0, 0x39d(%r14)
je 0x13f58
movl $0x0, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq $0x0, 0x17a0(%r14)
movb $0x1, %bl
movb $0x1, %r15b
jmp 0x13e85
movb $0x1, %bl
testb $0x1, %r15b
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
je 0x13f93
cmpl %r12d, 0x1790(%r14)
jne 0x13f93
xorl %edi, %edi
movl %esi, %r15d
movl $0x1, %esi
callq 0xf1dd
movl %r15d, %esi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl %eax, %r15d
jmp 0x13e8d
xorl %r15d, %r15d
jmp 0x13e8d