// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::ButtonBehavior(ImRect const&, unsigned int, bool*, bool*, int)
bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags)
{
    ImGuiContext& 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) ClearActiveID();
        return false;
    }

    // Default only reacts to left mouse button
    if ((flags & ImGuiButtonFlags_MouseButtonMask_) == 0)
        flags |= ImGuiButtonFlags_MouseButtonDefault_;

    // Default behavior requires click + release inside bounding box
    if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)
        flags |= ImGuiButtonFlags_PressedOnDefault_;

    ImGuiWindow* backup_hovered_window = g.HoveredWindow;
    const bool flatten_hovered_children = (flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window;
    if (flatten_hovered_children)
        g.HoveredWindow = window;

#ifdef IMGUI_ENABLE_TEST_ENGINE
    if (id != 0 && window->DC.LastItemId != id)
        IMGUI_TEST_ENGINE_ITEM_ADD(bb, id);
#endif

    bool pressed = false;
    bool hovered = ItemHoverable(bb, id);

    // Drag source doesn't report as hovered
    if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
        hovered = false;

    // Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
    if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))
        if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
        {
            hovered = true;
            SetHoveredID(id);
            if (CalcTypematicRepeatAmount(g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, g.HoveredIdTimer + 0.0001f, DRAGDROP_HOLD_TO_OPEN_TIMER, 0.00f))
            {
                pressed = true;
                g.DragDropHoldJustPressedId = id;
                FocusWindow(window);
            }
        }

    if (flatten_hovered_children)
        g.HoveredWindow = backup_hovered_window;

    // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
    if (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))
        hovered = false;

    // Mouse handling
    if (hovered)
    {
        if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
        {
            // Poll buttons
            int mouse_button_clicked = -1;
            int mouse_button_released = -1;
            if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseClicked[0])         { mouse_button_clicked = 0; }
            else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseClicked[1])   { mouse_button_clicked = 1; }
            else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseClicked[2])  { mouse_button_clicked = 2; }
            if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseReleased[0])        { mouse_button_released = 0; }
            else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseReleased[1])  { mouse_button_released = 1; }
            else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseReleased[2]) { mouse_button_released = 2; }

            if (mouse_button_clicked != -1 && g.ActiveId != id)
            {
                if (flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere))
                {
                    SetActiveID(id, window);
                    g.ActiveIdMouseButton = mouse_button_clicked;
                    if (!(flags & ImGuiButtonFlags_NoNavFocus))
                        SetFocusID(id, window);
                    FocusWindow(window);
                }
                if ((flags & ImGuiButtonFlags_PressedOnClick) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[mouse_button_clicked]))
                {
                    pressed = true;
                    if (flags & ImGuiButtonFlags_NoHoldingActiveId)
                        ClearActiveID();
                    else
                        SetActiveID(id, window); // Hold on ID
                    g.ActiveIdMouseButton = mouse_button_clicked;
                    FocusWindow(window);
                }
            }
            if ((flags & ImGuiButtonFlags_PressedOnRelease) && mouse_button_released != -1)
            {
                // Repeat mode trumps on release behavior
                const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
                if (!has_repeated_at_least_once)
                    pressed = true;
                ClearActiveID();
            }

            // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above).
            // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.
            if (g.ActiveId == id && (flags & ImGuiButtonFlags_Repeat))
                if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, true))
                    pressed = true;
        }

        if (pressed)
            g.NavDisableHighlight = true;
    }

    // Gamepad/Keyboard navigation
    // We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse.
    if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover && (g.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId))
        if (!(flags & ImGuiButtonFlags_NoHoveredOnFocus))
            hovered = true;
    if (g.NavActivateDownId == id)
    {
        bool nav_activated_by_code = (g.NavActivateId == id);
        bool nav_activated_by_inputs = IsNavInputTest(ImGuiNavInput_Activate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiInputReadMode_Repeat : ImGuiInputReadMode_Pressed);
        if (nav_activated_by_code || nav_activated_by_inputs)
            pressed = true;
        if (nav_activated_by_code || nav_activated_by_inputs || g.ActiveId == id)
        {
            // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button.
            g.NavActivateId = id; // This is so SetActiveId assign a Nav source
            SetActiveID(id, window);
            if ((nav_activated_by_code || nav_activated_by_inputs) && !(flags & ImGuiButtonFlags_NoNavFocus))
                SetFocusID(id, window);
        }
    }

    // Process while held
    bool held = false;
    if (g.ActiveId == id)
    {
        if (g.ActiveIdSource == ImGuiInputSource_Mouse)
        {
            if (g.ActiveIdIsJustActivated)
                g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;

            const int mouse_button = g.ActiveIdMouseButton;
            IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT);
            if (g.IO.MouseDown[mouse_button])
            {
                held = true;
            }
            else
            {
                bool release_in = hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease) != 0;
                bool release_anywhere = (flags & ImGuiButtonFlags_PressedOnClickReleaseAnywhere) != 0;
                if ((release_in || release_anywhere) && !g.DragDropActive)
                {
                    // Report as pressed when releasing the mouse (this is the most common path)
                    bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDownWasDoubleClick[mouse_button];
                    bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps <on release>
                    if (!is_double_click_release && !is_repeating_already)
                        pressed = true;
                }
                ClearActiveID();
            }
            if (!(flags & ImGuiButtonFlags_NoNavFocus))
                g.NavDisableHighlight = true;
        }
        else if (g.ActiveIdSource == ImGuiInputSource_Nav)
        {
            // When activated using Nav, we hold on the ActiveID until activation button is released
            if (g.NavActivateDownId != id)
                ClearActiveID();
        }
        if (pressed)
            g.ActiveIdHasBeenPressedBefore = true;
    }

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

    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
leaq 0xd912e(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0xeb270
movq %rax, -0x40(%rbp)
movl -0x2c(%rbp), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x139e68
cmpq $0x0, -0x20(%rbp)
je 0x139e3d
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x139e4b
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x139e5f
callq 0xca040
movb $0x0, -0x1(%rbp)
jmp 0x13a628
movl -0x2c(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
jne 0x139e7c
movl -0x2c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0x3f0, %eax            # imm = 0x3F0
cmpl $0x0, %eax
jne 0x139e92
movl -0x2c(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq 0x1ae8(%rax), %rax
movq %rax, -0x48(%rbp)
movl -0x2c(%rbp), %ecx
andl $0x800, %ecx            # imm = 0x800
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x69(%rbp)
je 0x139ec9
movq -0x38(%rbp), %rax
movq 0x1af0(%rax), %rax
cmpq -0x40(%rbp), %rax
sete %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
andb $0x1, %al
movb %al, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
je 0x139ee6
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x1ae8(%rax)
movb $0x0, -0x4a(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xca460
andb $0x1, %al
movb %al, -0x4b(%rbp)
testb $0x1, -0x4b(%rbp)
je 0x139f33
movq -0x38(%rbp), %rax
testb $0x1, 0x2004(%rax)
je 0x139f33
movq -0x38(%rbp), %rax
movl 0x2024(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x139f33
movq -0x38(%rbp), %rax
movl 0x2008(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x139f33
movb $0x0, -0x4b(%rbp)
movq -0x38(%rbp), %rax
testb $0x1, 0x2004(%rax)
je 0x139feb
movl -0x2c(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x139feb
movq -0x38(%rbp), %rax
movl 0x2008(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x139feb
movl $0x20, %edi
callq 0xca1c0
testb $0x1, %al
jne 0x139f7b
jmp 0x139fe9
movb $0x1, -0x4b(%rbp)
movl -0x14(%rbp), %edi
callq 0xca060
movq -0x38(%rbp), %rax
movss 0x38801(%rip), %xmm0    # 0x172794
addss 0x1b28(%rax), %xmm0
movq -0x38(%rbp), %rax
subss 0x18(%rax), %xmm0
movq -0x38(%rbp), %rax
movss 0x387e4(%rip), %xmm1    # 0x172794
addss 0x1b28(%rax), %xmm1
movss 0x38800(%rip), %xmm2    # 0x1727c0
xorps %xmm3, %xmm3
callq 0xd49f0
cmpl $0x0, %eax
je 0x139fe7
movb $0x1, -0x4a(%rbp)
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x2080(%rax)
movq -0x40(%rbp), %rdi
callq 0xcb380
jmp 0x139fe9
jmp 0x139feb
testb $0x1, -0x49(%rbp)
je 0x13a000
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x1ae8(%rax)
testb $0x1, -0x4b(%rbp)
je 0x13a033
movl -0x2c(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x13a033
movq -0x38(%rbp), %rax
movl 0x1b20(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x13a033
movq -0x38(%rbp), %rax
cmpl $0x0, 0x1b20(%rax)
je 0x13a033
movb $0x0, -0x4b(%rbp)
testb $0x1, -0x4b(%rbp)
je 0x13a2ee
movl -0x2c(%rbp), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
je 0x13a07d
movq -0x38(%rbp), %rax
testb $0x1, 0x140(%rax)
jne 0x13a2db
movq -0x38(%rbp), %rax
testb $0x1, 0x141(%rax)
jne 0x13a2db
movq -0x38(%rbp), %rax
testb $0x1, 0x142(%rax)
jne 0x13a2db
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x54(%rbp) # imm = 0xFFFFFFFF
movl -0x2c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x13a0ac
movq -0x38(%rbp), %rax
testb $0x1, 0x420(%rax)
je 0x13a0ac
movl $0x0, -0x50(%rbp)
jmp 0x13a0f0
movl -0x2c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x13a0cd
movq -0x38(%rbp), %rax
testb $0x1, 0x421(%rax)
je 0x13a0cd
movl $0x1, -0x50(%rbp)
jmp 0x13a0ee
movl -0x2c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x13a0ec
movq -0x38(%rbp), %rax
testb $0x1, 0x422(%rax)
je 0x13a0ec
movl $0x2, -0x50(%rbp)
jmp 0x13a0ee
jmp 0x13a0f0
movl -0x2c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x13a111
movq -0x38(%rbp), %rax
testb $0x1, 0x42a(%rax)
je 0x13a111
movl $0x0, -0x54(%rbp)
jmp 0x13a155
movl -0x2c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x13a132
movq -0x38(%rbp), %rax
testb $0x1, 0x42b(%rax)
je 0x13a132
movl $0x1, -0x54(%rbp)
jmp 0x13a153
movl -0x2c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x13a151
movq -0x38(%rbp), %rax
testb $0x1, 0x42c(%rax)
je 0x13a151
movl $0x2, -0x54(%rbp)
jmp 0x13a153
jmp 0x13a155
cmpl $-0x1, -0x50(%rbp)
je 0x13a21e
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x13a21e
movl -0x2c(%rbp), %eax
andl $0x60, %eax
cmpl $0x0, %eax
je 0x13a1b8
movl -0x14(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xc9ec0
movl -0x50(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1b6c(%rax)
movl -0x2c(%rbp), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
jne 0x13a1af
movl -0x14(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xdf460
movq -0x40(%rbp), %rdi
callq 0xcb380
movl -0x2c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x13a1e2
movl -0x2c(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x13a21c
movq -0x38(%rbp), %rax
movslq -0x50(%rbp), %rcx
testb $0x1, 0x425(%rax,%rcx)
je 0x13a21c
movb $0x1, -0x4a(%rbp)
movl -0x2c(%rbp), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
je 0x13a1fa
callq 0xca040
jmp 0x13a206
movl -0x14(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xc9ec0
movl -0x50(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1b6c(%rax)
movq -0x40(%rbp), %rdi
callq 0xcb380
jmp 0x13a21e
movl -0x2c(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x13a27d
cmpl $-0x1, -0x54(%rbp)
je 0x13a27d
movl -0x2c(%rbp), %ecx
andl $0x400, %ecx            # imm = 0x400
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x6a(%rbp)
je 0x13a266
movq -0x38(%rbp), %rax
movslq -0x54(%rbp), %rcx
movss 0x450(%rax,%rcx,4), %xmm0
movq -0x38(%rbp), %rax
ucomiss 0x94(%rax), %xmm0
setae %al
movb %al, -0x6a(%rbp)
movb -0x6a(%rbp), %al
andb $0x1, %al
movb %al, -0x55(%rbp)
testb $0x1, -0x55(%rbp)
jne 0x13a278
movb $0x1, -0x4a(%rbp)
callq 0xca040
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x13a2d9
movl -0x2c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x13a2d9
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rcx
movslq 0x1b6c(%rcx), %rcx
movss 0x43c(%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x13a2d7
movq -0x38(%rbp), %rax
movl 0x1b6c(%rax), %edi
movl $0x1, %esi
callq 0xd4d60
testb $0x1, %al
jne 0x13a2d3
jmp 0x13a2d7
movb $0x1, -0x4a(%rbp)
jmp 0x13a2d9
jmp 0x13a2db
testb $0x1, -0x4a(%rbp)
je 0x13a2ec
movq -0x38(%rbp), %rax
movb $0x1, 0x1ce6(%rax)
jmp 0x13a2ee
movq -0x38(%rbp), %rax
movl 0x1c98(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x13a359
movq -0x38(%rbp), %rax
testb $0x1, 0x1ce6(%rax)
jne 0x13a359
movq -0x38(%rbp), %rax
testb $0x1, 0x1ce7(%rax)
je 0x13a359
movq -0x38(%rbp), %rax
cmpl $0x0, 0x1b30(%rax)
je 0x13a346
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x13a346
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
movq -0x40(%rbp), %rcx
cmpl 0x54(%rcx), %eax
jne 0x13a359
movl -0x2c(%rbp), %eax
andl $0x80000, %eax          # imm = 0x80000
cmpl $0x0, %eax
jne 0x13a357
movb $0x1, -0x4b(%rbp)
jmp 0x13a359
movq -0x38(%rbp), %rax
movl 0x1ca4(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x13a413
movq -0x38(%rbp), %rax
movl 0x1ca0(%rax), %eax
cmpl -0x14(%rbp), %eax
sete %al
andb $0x1, %al
movb %al, -0x56(%rbp)
movl -0x2c(%rbp), %ecx
andl $0x400, %ecx            # imm = 0x400
movl $0x1, %esi
movl $0x3, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
xorl %edi, %edi
callq 0xee780
andb $0x1, %al
movb %al, -0x57(%rbp)
testb $0x1, -0x56(%rbp)
jne 0x13a3b2
testb $0x1, -0x57(%rbp)
je 0x13a3b6
movb $0x1, -0x4a(%rbp)
testb $0x1, -0x56(%rbp)
jne 0x13a3d1
testb $0x1, -0x57(%rbp)
jne 0x13a3d1
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x13a411
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1ca0(%rax)
movl -0x14(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xc9ec0
testb $0x1, -0x56(%rbp)
jne 0x13a3f6
testb $0x1, -0x57(%rbp)
je 0x13a40f
movl -0x2c(%rbp), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
jne 0x13a40f
movl -0x14(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xdf460
jmp 0x13a411
jmp 0x13a413
movb $0x0, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x13a5fa
movq -0x38(%rbp), %rax
cmpl $0x1, 0x1b68(%rax)
jne 0x13a5c2
movq -0x38(%rbp), %rax
testb $0x1, 0x1b3c(%rax)
je 0x13a470
movq -0x38(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
movq -0x10(%rbp), %rsi
callq 0x1390e0
movlpd %xmm0, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x1b58(%rax)
movq -0x38(%rbp), %rax
movl 0x1b6c(%rax), %eax
movl %eax, -0x64(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x64(%rbp)
movb %al, -0x6b(%rbp)
jl 0x13a492
cmpl $0x5, -0x64(%rbp)
setl %al
movb %al, -0x6b(%rbp)
movb -0x6b(%rbp), %al
testb $0x1, %al
jne 0x13a49b
jmp 0x13a49d
jmp 0x13a4bc
leaq 0x53f9b(%rip), %rdi     # 0x18e43f
leaq 0x53f35(%rip), %rsi     # 0x18e3e0
movl $0x273, %edx            # imm = 0x273
leaq 0x53fc3(%rip), %rcx     # 0x18e47a
callq 0xd180
movq -0x38(%rbp), %rax
movslq -0x64(%rbp), %rcx
testb $0x1, 0x130(%rax,%rcx)
je 0x13a4d7
movb $0x1, -0x58(%rbp)
jmp 0x13a5a8
xorl %eax, %eax
testb $0x1, -0x4b(%rbp)
movb %al, -0x6c(%rbp)
je 0x13a4f1
movl -0x2c(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x6c(%rbp)
movb -0x6c(%rbp), %al
andb $0x1, %al
movb %al, -0x65(%rbp)
movl -0x2c(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x66(%rbp)
testb $0x1, -0x65(%rbp)
jne 0x13a51a
testb $0x1, -0x66(%rbp)
je 0x13a5a3
movq -0x38(%rbp), %rax
testb $0x1, 0x2004(%rax)
jne 0x13a5a3
movl -0x2c(%rbp), %ecx
andl $0x100, %ecx            # imm = 0x100
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x6d(%rbp)
je 0x13a54c
movq -0x38(%rbp), %rax
movslq -0x64(%rbp), %rcx
movb 0x434(%rax,%rcx), %al
movb %al, -0x6d(%rbp)
movb -0x6d(%rbp), %al
andb $0x1, %al
movb %al, -0x67(%rbp)
movl -0x2c(%rbp), %ecx
andl $0x400, %ecx            # imm = 0x400
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x6e(%rbp)
je 0x13a589
movq -0x38(%rbp), %rax
movslq -0x64(%rbp), %rcx
movss 0x450(%rax,%rcx,4), %xmm0
movq -0x38(%rbp), %rax
ucomiss 0x94(%rax), %xmm0
setae %al
movb %al, -0x6e(%rbp)
movb -0x6e(%rbp), %al
andb $0x1, %al
movb %al, -0x68(%rbp)
testb $0x1, -0x67(%rbp)
jne 0x13a5a1
testb $0x1, -0x68(%rbp)
jne 0x13a5a1
movb $0x1, -0x4a(%rbp)
jmp 0x13a5a3
callq 0xca040
movl -0x2c(%rbp), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
jne 0x13a5c0
movq -0x38(%rbp), %rax
movb $0x1, 0x1ce6(%rax)
jmp 0x13a5e7
movq -0x38(%rbp), %rax
cmpl $0x2, 0x1b68(%rax)
jne 0x13a5e5
movq -0x38(%rbp), %rax
movl 0x1ca4(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x13a5e3
callq 0xca040
jmp 0x13a5e5
jmp 0x13a5e7
testb $0x1, -0x4a(%rbp)
je 0x13a5f8
movq -0x38(%rbp), %rax
movb $0x1, 0x1b3f(%rax)
jmp 0x13a5fa
cmpq $0x0, -0x20(%rbp)
je 0x13a60d
movb -0x4b(%rbp), %cl
movq -0x20(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x13a620
movb -0x58(%rbp), %cl
movq -0x28(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movb -0x4a(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)