// File: Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::BeginTableEx(char const*, unsigned int, int, int, ImVec2 const&, float)
bool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImGuiTableFlags flags, const ImVec2& outer_size, float inner_width)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* outer_window = GetCurrentWindow();
    if (outer_window->SkipItems) // Consistent with other tables + beneficial side effect that assert on miscalling EndTable() will be more visible.
        return false;

    // Sanity checks
    IM_ASSERT(columns_count > 0 && columns_count <= IMGUI_TABLE_MAX_COLUMNS && "Only 1..64 columns allowed!");
    if (flags & ImGuiTableFlags_ScrollX)
        IM_ASSERT(inner_width >= 0.0f);

    // If an outer size is specified ahead we will be able to early out when not visible. Exact clipping rules may evolve.
    const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;
    const ImVec2 avail_size = GetContentRegionAvail();
    ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
    ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
    if (use_child_window && IsClippedEx(outer_rect, 0, false))
    {
        ItemSize(outer_rect);
        return false;
    }

    // Acquire storage for the table
    ImGuiTable* table = g.Tables.GetOrAddByKey(id);
    const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1;
    const ImGuiID instance_id = id + instance_no;
    const ImGuiTableFlags table_last_flags = table->Flags;
    if (instance_no > 0)
        IM_ASSERT(table->ColumnsCount == columns_count && "BeginTable(): Cannot change columns count mid-frame while preserving same ID");

    // Fix flags
    table->IsDefaultSizingPolicy = (flags & ImGuiTableFlags_SizingMask_) == 0;
    flags = TableFixFlags(flags, outer_window);

    // Initialize
    table->ID = id;
    table->Flags = flags;
    table->InstanceCurrent = (ImS16)instance_no;
    table->LastFrameActive = g.FrameCount;
    table->OuterWindow = table->InnerWindow = outer_window;
    table->ColumnsCount = columns_count;
    table->IsLayoutLocked = false;
    table->InnerWidth = inner_width;
    table->UserOuterSize = outer_size;

    // When not using a child window, WorkRect.Max will grow as we append contents.
    if (use_child_window)
    {
        // Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent
        // (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing)
        ImVec2 override_content_size(FLT_MAX, FLT_MAX);
        if ((flags & ImGuiTableFlags_ScrollX) && !(flags & ImGuiTableFlags_ScrollY))
            override_content_size.y = FLT_MIN;

        // Ensure specified width (when not specified, Stretched columns will act as if the width == OuterWidth and
        // never lead to any scrolling). We don't handle inner_width < 0.0f, we could potentially use it to right-align
        // based on the right side of the child window work rect, which would require knowing ahead if we are going to
        // have decoration taking horizontal spaces (typically a vertical scrollbar).
        if ((flags & ImGuiTableFlags_ScrollX) && inner_width > 0.0f)
            override_content_size.x = inner_width;

        if (override_content_size.x != FLT_MAX || override_content_size.y != FLT_MAX)
            SetNextWindowContentSize(ImVec2(override_content_size.x != FLT_MAX ? override_content_size.x : 0.0f, override_content_size.y != FLT_MAX ? override_content_size.y : 0.0f));

        // Reset scroll if we are reactivating it
        if ((table_last_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0)
            SetNextWindowScroll(ImVec2(0.0f, 0.0f));

        // Create scrolling region (without border and zero window padding)
        ImGuiWindowFlags child_flags = (flags & ImGuiTableFlags_ScrollX) ? ImGuiWindowFlags_HorizontalScrollbar : ImGuiWindowFlags_None;
        BeginChildEx(name, instance_id, outer_rect.GetSize(), false, child_flags);
        table->InnerWindow = g.CurrentWindow;
        table->WorkRect = table->InnerWindow->WorkRect;
        table->OuterRect = table->InnerWindow->Rect();
        table->InnerRect = table->InnerWindow->InnerRect;
        IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f);
    }
    else
    {
        // For non-scrolling tables, WorkRect == OuterRect == InnerRect.
        // But at this point we do NOT have a correct value for .Max.y (unless a height has been explicitly passed in). It will only be updated in EndTable().
        table->WorkRect = table->OuterRect = table->InnerRect = outer_rect;
    }

    // Push a standardized ID for both child-using and not-child-using tables
    PushOverrideID(instance_id);

    // Backup a copy of host window members we will modify
    ImGuiWindow* inner_window = table->InnerWindow;
    table->HostIndentX = inner_window->DC.Indent.x;
    table->HostClipRect = inner_window->ClipRect;
    table->HostSkipItems = inner_window->SkipItems;
    table->HostBackupWorkRect = inner_window->WorkRect;
    table->HostBackupParentWorkRect = inner_window->ParentWorkRect;
    table->HostBackupColumnsOffset = outer_window->DC.ColumnsOffset;
    table->HostBackupPrevLineSize = inner_window->DC.PrevLineSize;
    table->HostBackupCurrLineSize = inner_window->DC.CurrLineSize;
    table->HostBackupCursorMaxPos = inner_window->DC.CursorMaxPos;
    table->HostBackupItemWidth = outer_window->DC.ItemWidth;
    table->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size;
    inner_window->DC.PrevLineSize = inner_window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);

    // Padding and Spacing
    // - None               ........Content..... Pad .....Content........
    // - PadOuter           | Pad ..Content..... Pad .....Content.. Pad |
    // - PadInner           ........Content.. Pad | Pad ..Content........
    // - PadOuter+PadInner  | Pad ..Content.. Pad | Pad ..Content.. Pad |
    const bool pad_outer_x = (flags & ImGuiTableFlags_NoPadOuterX) ? false : (flags & ImGuiTableFlags_PadOuterX) ? true : (flags & ImGuiTableFlags_BordersOuterV) != 0;
    const bool pad_inner_x = (flags & ImGuiTableFlags_NoPadInnerX) ? false : true;
    const float inner_spacing_for_border = (flags & ImGuiTableFlags_BordersInnerV) ? TABLE_BORDER_SIZE : 0.0f;
    const float inner_spacing_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) == 0) ? g.Style.CellPadding.x : 0.0f;
    const float inner_padding_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) != 0) ? g.Style.CellPadding.x : 0.0f;
    table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border;
    table->CellSpacingX2 = inner_spacing_explicit;
    table->CellPaddingX = inner_padding_explicit;
    table->CellPaddingY = g.Style.CellPadding.y;

    const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
    const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f;
    table->OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table->CellPaddingX;

    table->CurrentColumn = -1;
    table->CurrentRow = -1;
    table->RowBgColorCounter = 0;
    table->LastRowFlags = ImGuiTableRowFlags_None;
    table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect;
    table->InnerClipRect.ClipWith(table->WorkRect);     // We need this to honor inner_width
    table->InnerClipRect.ClipWithFull(table->HostClipRect);
    table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : inner_window->ClipRect.Max.y;

    table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow
    table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()
    table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any
    table->FreezeColumnsRequest = table->FreezeColumnsCount = 0;
    table->IsUnfrozenRows = true;
    table->DeclColumnsCount = 0;

    // Using opaque colors facilitate overlapping elements of the grid
    table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong);
    table->BorderColorLight = GetColorU32(ImGuiCol_TableBorderLight);

    // Make table current
    const int table_idx = g.Tables.GetIndex(table);
    g.CurrentTableStack.push_back(ImGuiPtrOrIndex(table_idx));
    g.CurrentTable = table;
    outer_window->DC.CurrentTableIdx = table_idx;
    if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.
        inner_window->DC.CurrentTableIdx = table_idx;

    if ((table_last_flags & ImGuiTableFlags_Reorderable) && (flags & ImGuiTableFlags_Reorderable) == 0)
        table->IsResetDisplayOrderRequest = true;

    // Mark as used
    if (table_idx >= g.TablesLastTimeActive.Size)
        g.TablesLastTimeActive.resize(table_idx + 1, -1.0f);
    g.TablesLastTimeActive[table_idx] = (float)g.Time;
    table->MemoryCompacted = false;

    // Setup memory buffer (clear data if columns count changed)
    const int stored_size = table->Columns.size();
    if (stored_size != 0 && stored_size != columns_count)
    {
        IM_FREE(table->RawData);
        table->RawData = NULL;
    }
    if (table->RawData == NULL)
    {
        TableBeginInitMemory(table, columns_count);
        table->IsInitializing = table->IsSettingsRequestLoad = true;
    }
    if (table->IsResetAllRequest)
        TableResetSettings(table);
    if (table->IsInitializing)
    {
        // Initialize
        table->SettingsOffset = -1;
        table->IsSortSpecsDirty = true;
        table->InstanceInteracted = -1;
        table->ContextPopupColumn = -1;
        table->ReorderColumn = table->ResizedColumn = table->LastResizedColumn = -1;
        table->AutoFitSingleColumn = -1;
        table->HoveredColumnBody = table->HoveredColumnBorder = -1;
        for (int n = 0; n < columns_count; n++)
        {
            ImGuiTableColumn* column = &table->Columns[n];
            float width_auto = column->WidthAuto;
            *column = ImGuiTableColumn();
            column->WidthAuto = width_auto;
            column->IsPreserveWidthAuto = true; // Preserve WidthAuto when reinitializing a live table: not technically necessary but remove a visible flicker
            column->DisplayOrder = table->DisplayOrderToIndex[n] = (ImGuiTableColumnIdx)n;
            column->IsEnabled = column->IsEnabledNextFrame = true;
        }
    }

    // Load settings
    if (table->IsSettingsRequestLoad)
        TableLoadSettings(table);

    // Handle DPI/font resize
    // This is designed to facilitate DPI changes with the assumption that e.g. style.CellPadding has been scaled as well.
    // It will also react to changing fonts with mixed results. It doesn't need to be perfect but merely provide a decent transition.
    // FIXME-DPI: Provide consistent standards for reference size. Perhaps using g.CurrentDpiScale would be more self explanatory.
    // This is will lead us to non-rounded WidthRequest in columns, which should work but is a poorly tested path.
    const float new_ref_scale_unit = g.FontSize; // g.Font->GetCharAdvance('A') ?
    if (table->RefScale != 0.0f && table->RefScale != new_ref_scale_unit)
    {
        const float scale_factor = new_ref_scale_unit / table->RefScale;
        //IMGUI_DEBUG_LOG("[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\n", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor);
        for (int n = 0; n < columns_count; n++)
            table->Columns[n].WidthRequest = table->Columns[n].WidthRequest * scale_factor;
    }
    table->RefScale = new_ref_scale_unit;

    // Disable output until user calls TableNextRow() or TableNextColumn() leading to the TableUpdateLayout() call..
    // This is not strictly necessary but will reduce cases were "out of table" output will be misleading to the user.
    // Because we cannot safely assert in EndTable() when no rows have been created, this seems like our best option.
    inner_window->SkipItems = true;

    // Clear names
    // At this point the ->NameOffset field of each column will be invalid until TableUpdateLayout() or the first call to TableSetupColumn()
    if (table->ColumnsNames.Buf.Size > 0)
        table->ColumnsNames.Buf.resize(0);

    // Apply queued resizing/reordering/hiding requests
    TableBeginApplyRequests(table);

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movss %xmm0, -0x2c(%rbp)
leaq 0xe99c8(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0xeb270
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x12959e
movb $0x0, -0x1(%rbp)
jmp 0x12a608
xorl %eax, %eax
cmpl $0x0, -0x18(%rbp)
movb %al, -0x191(%rbp)
jle 0x1295c4
xorl %eax, %eax
cmpl $0x40, -0x18(%rbp)
movb %al, -0x191(%rbp)
jg 0x1295c4
movb $0x1, %al
movb %al, -0x191(%rbp)
jmp 0x1295c4
movb -0x191(%rbp), %al
testb $0x1, %al
jne 0x1295d0
jmp 0x1295d2
jmp 0x1295f1
leaq 0x6297f(%rip), %rdi     # 0x18bf58
leaq 0x629c2(%rip), %rsi     # 0x18bfa2
movl $0x133, %edx            # imm = 0x133
leaq 0x629d5(%rip), %rcx     # 0x18bfc1
callq 0xd180
movl -0x1c(%rbp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0x12962e
movss -0x2c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x12960d
jmp 0x12962c
leaq 0x62a0a(%rip), %rdi     # 0x18c01e
leaq 0x62987(%rip), %rsi     # 0x18bfa2
movl $0x135, %edx            # imm = 0x135
leaq 0x6299a(%rip), %rcx     # 0x18bfc1
callq 0xd180
jmp 0x12962e
movl -0x1c(%rbp), %eax
testl $0x3000000, %eax        # imm = 0x3000000
setne -0x41(%rbp)
callq 0xd5b40
movlpd %xmm0, -0x4c(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x5c(%rbp)
movss -0x4c(%rbp), %xmm0
movss 0x475e0(%rip), %xmm1    # 0x170c3c
callq 0x12a620
movss %xmm0, -0x198(%rbp)
testb $0x1, -0x41(%rbp)
je 0x12968b
movss -0x48(%rbp), %xmm0
movss 0x475c0(%rip), %xmm1    # 0x170c3c
callq 0x12a620
movss %xmm0, -0x19c(%rbp)
jmp 0x129698
xorps %xmm0, %xmm0
movss %xmm0, -0x19c(%rbp)
jmp 0x129698
movss -0x198(%rbp), %xmm1
movss -0x19c(%rbp), %xmm2
movsd -0x5c(%rbp), %xmm0
callq 0xdcef0
movlpd %xmm0, -0x54(%rbp)
movq -0x40(%rbp), %rdi
addq $0xd8, %rdi
movq %rdi, -0x1a8(%rbp)
leaq -0x54(%rbp), %rsi
callq 0x12a660
movq -0x1a8(%rbp), %rsi
movlpd %xmm0, -0x74(%rbp)
leaq -0x6c(%rbp), %rdi
leaq -0x74(%rbp), %rdx
callq 0xe8660
testb $0x1, -0x41(%rbp)
je 0x12971e
leaq -0x6c(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0xca6e0
testb $0x1, %al
jne 0x129704
jmp 0x12971e
leaq -0x6c(%rbp), %rdi
movss 0x48870(%rip), %xmm0    # 0x171f80
callq 0xdc300
movb $0x0, -0x1(%rbp)
jmp 0x12a608
movq -0x38(%rbp), %rdi
addq $0x20b0, %rdi           # imm = 0x20B0
movl -0x14(%rbp), %esi
callq 0x136d40
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl 0x68(%rax), %eax
movq -0x38(%rbp), %rcx
cmpl 0x1a68(%rcx), %eax
je 0x129752
xorl %eax, %eax
movl %eax, -0x1ac(%rbp)
jmp 0x129763
movq -0x80(%rbp), %rax
movswl 0x78(%rax), %eax
addl $0x1, %eax
movl %eax, -0x1ac(%rbp)
movl -0x1ac(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x14(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x80(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x84(%rbp)
jle 0x1297e1
movq -0x80(%rbp), %rax
movl 0x6c(%rax), %ecx
xorl %eax, %eax
cmpl -0x18(%rbp), %ecx
movb %al, -0x1ad(%rbp)
jne 0x1297b2
movb $0x1, %al
movb %al, -0x1ad(%rbp)
jmp 0x1297b2
movb -0x1ad(%rbp), %al
testb $0x1, %al
jne 0x1297be
jmp 0x1297c0
jmp 0x1297df
leaq 0x628b8(%rip), %rdi     # 0x18c07f
leaq 0x627d4(%rip), %rsi     # 0x18bfa2
movl $0x148, %edx            # imm = 0x148
leaq 0x627e7(%rip), %rcx     # 0x18bfc1
callq 0xd180
jmp 0x1297e1
movl -0x1c(%rbp), %eax
andl $0xe000, %eax           # imm = 0xE000
cmpl $0x0, %eax
sete %cl
movq -0x80(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x254(%rax)
movl -0x1c(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0x136db0
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %ecx
movq -0x80(%rbp), %rax
movl %ecx, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x84(%rbp), %eax
movw %ax, %cx
movq -0x80(%rbp), %rax
movw %cx, 0x78(%rax)
movq -0x38(%rbp), %rax
movl 0x1a68(%rax), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x68(%rax)
movq -0x40(%rbp), %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x1d0(%rax)
movq -0x80(%rbp), %rax
movq %rcx, 0x1c8(%rax)
movl -0x18(%rbp), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x6c(%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x248(%rax)
movss -0x2c(%rbp), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xd4(%rax)
movq -0x28(%rbp), %rcx
movq -0x80(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, 0x1b4(%rax)
testb $0x1, -0x41(%rbp)
je 0x129b99
leaq -0x94(%rbp), %rdi
movss 0x48709(%rip), %xmm1    # 0x171fb4
movaps %xmm1, %xmm0
callq 0xbf4c0
movl -0x1c(%rbp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0x1298dd
movl -0x1c(%rbp), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
jne 0x1298dd
movss 0x62663(%rip), %xmm0    # 0x18bf38
movss %xmm0, -0x90(%rbp)
movl -0x1c(%rbp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0x129904
movss -0x2c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x129904
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0x94(%rbp)
movss -0x94(%rbp), %xmm0
movss 0x486a0(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0x129937
jp 0x129937
movss -0x90(%rbp), %xmm0
movss 0x48689(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0x129937
jp 0x129937
jmp 0x1299df
movss -0x94(%rbp), %xmm0
movss 0x4866d(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0x129950
jp 0x129950
jmp 0x129962
movss -0x94(%rbp), %xmm0
movss %xmm0, -0x1b4(%rbp)
jmp 0x12996f
xorps %xmm0, %xmm0
movss %xmm0, -0x1b4(%rbp)
jmp 0x12996f
movss -0x1b4(%rbp), %xmm0
movss %xmm0, -0x1b8(%rbp)
movss -0x90(%rbp), %xmm0
movss 0x48625(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0x129998
jp 0x129998
jmp 0x1299aa
movss -0x90(%rbp), %xmm0
movss %xmm0, -0x1bc(%rbp)
jmp 0x1299b7
xorps %xmm0, %xmm0
movss %xmm0, -0x1bc(%rbp)
jmp 0x1299b7
movss -0x1b8(%rbp), %xmm0
movss -0x1bc(%rbp), %xmm1
leaq -0x9c(%rbp), %rdi
callq 0xbf4c0
leaq -0x9c(%rbp), %rdi
callq 0xdac90
movl -0x8c(%rbp), %eax
andl $0x3000000, %eax        # imm = 0x3000000
cmpl $0x0, %eax
jne 0x129a0d
leaq -0xa4(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0xa4(%rbp), %rdi
callq 0xdace0
movl -0x1c(%rbp), %eax
andl $0x1000000, %eax        # imm = 0x1000000
shrl $0xd, %eax
movl %eax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0x1c4(%rbp)
leaq -0x6c(%rbp), %rdi
callq 0xeb560
movq -0x1d0(%rbp), %rdi
movl -0x1c4(%rbp), %esi
movlpd %xmm0, -0xb0(%rbp)
movl -0xa8(%rbp), %r8d
leaq -0xb0(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd58c0
movq -0x38(%rbp), %rax
movq 0x1ae0(%rax), %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x1d0(%rax)
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rcx
movups 0x238(%rcx), %xmm0
movups %xmm0, 0x10c(%rax)
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rdi
callq 0xeb880
movlpd %xmm0, -0xc0(%rbp)
movlpd %xmm1, -0xb8(%rbp)
movq -0x80(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rcx, 0xec(%rax)
movq -0xb8(%rbp), %rcx
movq %rcx, 0xf4(%rax)
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rcx
movq -0x80(%rbp), %rax
movq 0x218(%rcx), %rdx
movq %rdx, 0xfc(%rax)
movq 0x220(%rcx), %rcx
movq %rcx, 0x104(%rax)
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rax
movss 0x40(%rax), %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
movb %al, -0x1bd(%rbp)
jne 0x129b6a
jp 0x129b6a
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rax
movss 0x44(%rax), %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
movb %al, -0x1bd(%rbp)
jne 0x129b6a
jp 0x129b6a
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rax
movss 0x4c(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
sete %al
setnp %cl
andb %cl, %al
movb %al, -0x1bd(%rbp)
movb -0x1bd(%rbp), %al
testb $0x1, %al
jne 0x129b76
jmp 0x129b78
jmp 0x129b97
leaq 0x62577(%rip), %rdi     # 0x18c0f6
leaq 0x6241c(%rip), %rsi     # 0x18bfa2
movl $0x177, %edx            # imm = 0x177
leaq 0x6242f(%rip), %rcx     # 0x18bfc1
callq 0xd180
jmp 0x129bf3
movq -0x80(%rbp), %rax
movq -0x6c(%rbp), %rcx
movq %rcx, 0xfc(%rax)
movq -0x64(%rbp), %rcx
movq %rcx, 0x104(%rax)
movq -0x80(%rbp), %rcx
movq 0xfc(%rax), %rdx
movq %rdx, 0xec(%rcx)
movq 0x104(%rax), %rax
movq %rax, 0xf4(%rcx)
movq -0x80(%rbp), %rax
movq 0xec(%rcx), %rdx
movq %rdx, 0x10c(%rax)
movq 0xf4(%rcx), %rcx
movq %rcx, 0x114(%rax)
movl -0x88(%rbp), %edi
callq 0xdb5a0
movq -0x80(%rbp), %rax
movq 0x1d0(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movss 0x118(%rax), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xb0(%rax)
movq -0xc8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq 0x258(%rcx), %rdx
movq %rdx, 0x15c(%rax)
movq 0x260(%rcx), %rcx
movq %rcx, 0x164(%rax)
movq -0xc8(%rbp), %rax
movb 0x93(%rax), %cl
movq -0x80(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x256(%rax)
movq -0xc8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq 0x238(%rcx), %rdx
movq %rdx, 0x16c(%rax)
movq 0x240(%rcx), %rcx
movq %rcx, 0x174(%rax)
movq -0xc8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq 0x248(%rcx), %rdx
movq %rdx, 0x17c(%rax)
movq 0x250(%rcx), %rcx
movq %rcx, 0x184(%rax)
movq -0x40(%rbp), %rcx
movq -0x80(%rbp), %rax
movl 0x11c(%rcx), %ecx
movl %ecx, 0x1bc(%rax)
movq -0xc8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq 0x108(%rcx), %rcx
movq %rcx, 0x19c(%rax)
movq -0xc8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq 0x100(%rcx), %rcx
movq %rcx, 0x1a4(%rax)
movq -0xc8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq 0xf0(%rcx), %rcx
movq %rcx, 0x1ac(%rax)
movq -0x40(%rbp), %rax
movss 0x1d0(%rax), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0x1c0(%rax)
movq -0x40(%rbp), %rax
movl 0x1d8(%rax), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x1c4(%rax)
leaq -0xd0(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0xc8(%rbp), %rcx
movq -0xd0(%rbp), %rax
movq %rax, 0x100(%rcx)
movq -0xc8(%rbp), %rax
movq 0x100(%rcx), %rcx
movq %rcx, 0x108(%rax)
movl -0x1c(%rbp), %eax
andl $0x400000, %eax         # imm = 0x400000
cmpl $0x0, %eax
je 0x129d98
xorl %eax, %eax
movb %al, -0x1d1(%rbp)
jmp 0x129dcf
movl -0x1c(%rbp), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
je 0x129daf
movb $0x1, %al
movb %al, -0x1d2(%rbp)
jmp 0x129dc3
movl -0x1c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
setne %al
movb %al, -0x1d2(%rbp)
movb -0x1d2(%rbp), %al
movb %al, -0x1d1(%rbp)
movb -0x1d1(%rbp), %al
andb $0x1, %al
movb %al, -0xd1(%rbp)
movb -0x1a(%rbp), %cl
andb $-0x80, %cl
xorl %eax, %eax
subb $0x1, %cl
sbbl %eax, %eax
andb $0x1, %al
movb %al, -0xd2(%rbp)
movl -0x1c(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
movss 0x46e3a(%rip), %xmm0    # 0x170c3c
xorps %xmm1, %xmm1
movss %xmm1, -0x1dc(%rbp)
cmpl $0x0, %eax
movss %xmm0, -0x1d8(%rbp)
jne 0x129e2a
movss -0x1dc(%rbp), %xmm0
movss %xmm0, -0x1d8(%rbp)
movss -0x1d8(%rbp), %xmm0
movss %xmm0, -0xd8(%rbp)
testb $0x1, -0xd2(%rbp)
je 0x129e66
movl -0x1c(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x129e66
movq -0x38(%rbp), %rax
movss 0x15b8(%rax), %xmm0
movss %xmm0, -0x1e0(%rbp)
jmp 0x129e73
xorps %xmm0, %xmm0
movss %xmm0, -0x1e0(%rbp)
jmp 0x129e73
movss -0x1e0(%rbp), %xmm0
movss %xmm0, -0xdc(%rbp)
testb $0x1, -0xd2(%rbp)
je 0x129eaf
movl -0x1c(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x129eaf
movq -0x38(%rbp), %rax
movss 0x15b8(%rax), %xmm0
movss %xmm0, -0x1e4(%rbp)
jmp 0x129ebc
xorps %xmm0, %xmm0
movss %xmm0, -0x1e4(%rbp)
jmp 0x129ebc
movss -0x1e4(%rbp), %xmm0
movss %xmm0, -0xe0(%rbp)
movss -0xdc(%rbp), %xmm0
addss -0xd8(%rbp), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xc4(%rax)
movss -0xdc(%rbp), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xc8(%rax)
movss -0xe0(%rbp), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xbc(%rax)
movq -0x38(%rbp), %rax
movss 0x15bc(%rax), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xc0(%rax)
movl -0x1c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
movss 0x46d04(%rip), %xmm0    # 0x170c3c
xorps %xmm1, %xmm1
movss %xmm1, -0x1ec(%rbp)
cmpl $0x0, %eax
movss %xmm0, -0x1e8(%rbp)
jne 0x129f60
movss -0x1ec(%rbp), %xmm0
movss %xmm0, -0x1e8(%rbp)
movss -0x1e8(%rbp), %xmm0
movss %xmm0, -0xe4(%rbp)
testb $0x1, -0xd1(%rbp)
je 0x129f8f
movq -0x38(%rbp), %rax
movss 0x15b8(%rax), %xmm0
movss %xmm0, -0x1f0(%rbp)
jmp 0x129f9c
xorps %xmm0, %xmm0
movss %xmm0, -0x1f0(%rbp)
jmp 0x129f9c
movss -0x1f0(%rbp), %xmm0
movss %xmm0, -0xe8(%rbp)
movss -0xe4(%rbp), %xmm0
addss -0xe8(%rbp), %xmm0
movq -0x80(%rbp), %rax
subss 0xbc(%rax), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xb8(%rax)
movq -0x80(%rbp), %rax
movl $0xffffffff, 0x74(%rax) # imm = 0xFFFFFFFF
movq -0x80(%rbp), %rax
movl $0xffffffff, 0x70(%rax) # imm = 0xFFFFFFFF
movq -0x80(%rbp), %rax
movl $0x0, 0x94(%rax)
movq -0x80(%rbp), %rax
movl 0x90(%rax), %ecx
andl $0xffff, %ecx           # imm = 0xFFFF
orl $0x0, %ecx
movl %ecx, 0x90(%rax)
movq -0xc8(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0x12a031
movq -0x80(%rbp), %rax
addq $0x10c, %rax            # imm = 0x10C
movq %rax, -0x1f8(%rbp)
jmp 0x12a045
movq -0xc8(%rbp), %rax
addq $0x258, %rax            # imm = 0x258
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rcx
movq -0x80(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, 0x11c(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x124(%rax)
movq -0x80(%rbp), %rdi
addq $0x11c, %rdi            # imm = 0x11C
movq -0x80(%rbp), %rsi
addq $0x10c, %rsi            # imm = 0x10C
callq 0xe8970
movq -0x80(%rbp), %rdi
addq $0x11c, %rdi            # imm = 0x11C
movq -0x80(%rbp), %rsi
addq $0x15c, %rsi            # imm = 0x15C
callq 0xeb8d0
movl -0x1c(%rbp), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
je 0x12a0d2
movq -0x80(%rbp), %rax
movss 0x128(%rax), %xmm0
movq -0xc8(%rbp), %rax
movss 0x244(%rax), %xmm1
callq 0x12a6b0
movss %xmm0, -0x1fc(%rbp)
jmp 0x12a0e9
movq -0xc8(%rbp), %rax
movss 0x264(%rax), %xmm0
movss %xmm0, -0x1fc(%rbp)
movss -0x1fc(%rbp), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0x128(%rax)
movq -0x80(%rbp), %rax
movss 0x110(%rax), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0x80(%rax)
movq -0x80(%rbp), %rax
movss %xmm0, 0x7c(%rax)
movq -0x80(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x88(%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x241(%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x240(%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x243(%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x242(%rax)
movq -0x80(%rbp), %rax
movb $0x1, 0x253(%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x233(%rax)
movl $0x2b, %edi
movss 0x46ac0(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0xa0(%rax)
movl $0x2c, %edi
movss 0x46aa2(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0xa4(%rax)
movq -0x38(%rbp), %rdi
addq $0x20b0, %rdi           # imm = 0x20B0
movq -0x80(%rbp), %rsi
callq 0x136eb0
movl %eax, -0xec(%rbp)
movq -0x38(%rbp), %rax
addq $0x20d8, %rax           # imm = 0x20D8
movq %rax, -0x208(%rbp)
movl -0xec(%rbp), %esi
leaq -0x100(%rbp), %rdi
callq 0x136fc0
movq -0x208(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x136f50
movq -0x80(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20a8(%rax)
movl -0xec(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x1b8(%rax)
movq -0xc8(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x12a23a
movl -0xec(%rbp), %ecx
movq -0xc8(%rbp), %rax
movl %ecx, 0x1b8(%rax)
movl -0x8c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x12a25e
movl -0x1c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x12a25e
movq -0x80(%rbp), %rax
movb $0x1, 0x252(%rax)
movl -0xec(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x20e8(%rcx), %eax
jl 0x12a2a0
movq -0x38(%rbp), %rdi
addq $0x20e8, %rdi           # imm = 0x20E8
movl -0xec(%rbp), %esi
addl $0x1, %esi
movss 0x47cf4(%rip), %xmm0    # 0x171f80
movss %xmm0, -0x104(%rbp)
leaq -0x104(%rbp), %rdx
callq 0x128710
movq -0x38(%rbp), %rax
movsd 0x1a60(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x20c(%rbp)
movq -0x38(%rbp), %rdi
addq $0x20e8, %rdi           # imm = 0x20E8
movl -0xec(%rbp), %esi
callq 0xea950
movss -0x20c(%rbp), %xmm0
movss %xmm0, (%rax)
movq -0x80(%rbp), %rax
movb $0x0, 0x255(%rax)
movq -0x80(%rbp), %rdi
addq $0x10, %rdi
callq 0x136fe0
movl %eax, -0x108(%rbp)
cmpl $0x0, -0x108(%rbp)
je 0x12a325
movl -0x108(%rbp), %eax
cmpl -0x18(%rbp), %eax
je 0x12a325
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xc4920
movq -0x80(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x80(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x12a352
movq -0x80(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x12a6f0
movq -0x80(%rbp), %rax
movb $0x1, 0x24e(%rax)
movq -0x80(%rbp), %rax
movb $0x1, 0x24a(%rax)
movq -0x80(%rbp), %rax
testb $0x1, 0x251(%rax)
je 0x12a368
movq -0x80(%rbp), %rdi
callq 0x12a7e0
movq -0x80(%rbp), %rax
testb $0x1, 0x24a(%rax)
je 0x12a4cd
movq -0x80(%rbp), %rax
movl $0xffffffff, 0x64(%rax) # imm = 0xFFFFFFFF
movq -0x80(%rbp), %rax
movb $0x1, 0x24b(%rax)
movq -0x80(%rbp), %rax
movw $0xffff, 0x7a(%rax)     # imm = 0xFFFF
movq -0x80(%rbp), %rax
movb $-0x1, 0x23f(%rax)
movq -0x80(%rbp), %rax
movb $-0x1, 0x238(%rax)
movq -0x80(%rbp), %rax
movb $-0x1, 0x237(%rax)
movq -0x80(%rbp), %rax
movb $-0x1, 0x23a(%rax)
movq -0x80(%rbp), %rax
movb $-0x1, 0x236(%rax)
movq -0x80(%rbp), %rax
movb $-0x1, 0x235(%rax)
movq -0x80(%rbp), %rax
movb $-0x1, 0x234(%rax)
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x12a4cb
movq -0x80(%rbp), %rdi
addq $0x10, %rdi
movl -0x10c(%rbp), %esi
callq 0xeea20
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movss 0x14(%rax), %xmm0
movss %xmm0, -0x11c(%rbp)
leaq -0x184(%rbp), %rdi
callq 0x137010
movq -0x118(%rbp), %rdi
leaq -0x184(%rbp), %rsi
movl $0x66, %edx
callq 0xd0a0
movss -0x11c(%rbp), %xmm0
movq -0x118(%rbp), %rax
movss %xmm0, 0x14(%rax)
movq -0x118(%rbp), %rax
movb $0x1, 0x60(%rax)
movl -0x10c(%rbp), %eax
movb %al, -0x20d(%rbp)
movq -0x80(%rbp), %rdi
addq $0x20, %rdi
movl -0x10c(%rbp), %esi
callq 0x1370a0
movb -0x20d(%rbp), %cl
movb %cl, (%rax)
movq -0x118(%rbp), %rax
movb %cl, 0x52(%rax)
movq -0x118(%rbp), %rax
movb $0x1, 0x5b(%rax)
movq -0x118(%rbp), %rax
movb $0x1, 0x5a(%rax)
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x12a3f0
jmp 0x12a4cd
movq -0x80(%rbp), %rax
testb $0x1, 0x24e(%rax)
je 0x12a4e3
movq -0x80(%rbp), %rdi
callq 0x12a830
movq -0x38(%rbp), %rax
movss 0x1980(%rax), %xmm0
movss %xmm0, -0x188(%rbp)
movq -0x80(%rbp), %rax
movss 0xe8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x12a512
jp 0x12a512
jmp 0x12a5ba
movq -0x80(%rbp), %rax
movss 0xe8(%rax), %xmm0
ucomiss -0x188(%rbp), %xmm0
jne 0x12a52e
jp 0x12a52e
jmp 0x12a5ba
movss -0x188(%rbp), %xmm0
movq -0x80(%rbp), %rax
divss 0xe8(%rax), %xmm0
movss %xmm0, -0x18c(%rbp)
movl $0x0, -0x190(%rbp)
movl -0x190(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x12a5b8
movq -0x80(%rbp), %rdi
addq $0x10, %rdi
movl -0x190(%rbp), %esi
callq 0xeea20
movss 0x10(%rax), %xmm0
mulss -0x18c(%rbp), %xmm0
movss %xmm0, -0x214(%rbp)
movq -0x80(%rbp), %rdi
addq $0x10, %rdi
movl -0x190(%rbp), %esi
callq 0xeea20
movss -0x214(%rbp), %xmm0
movss %xmm0, 0x10(%rax)
movl -0x190(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x190(%rbp)
jmp 0x12a554
jmp 0x12a5ba
movss -0x188(%rbp), %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0xe8(%rax)
movq -0xc8(%rbp), %rax
movb $0x1, 0x93(%rax)
movq -0x80(%rbp), %rax
cmpl $0x0, 0x1d8(%rax)
jle 0x12a5fb
movq -0x80(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
xorl %esi, %esi
callq 0xe84f0
movq -0x80(%rbp), %rdi
callq 0x12ab40
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopw %cs:(%rax,%rax)