// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableEndRow(ImGuiTable*)
void ImGui::TableEndRow(ImGuiTable* table)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    IM_ASSERT(window == table->InnerWindow);
    IM_ASSERT(table->IsInsideRow);

    if (table->CurrentColumn != -1)
        TableEndCell(table);

    // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is
    // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding.
    window->DC.CursorPos.y = table->RowPosY2;

    // Row background fill
    const float bg_y1 = table->RowPosY1;
    const float bg_y2 = table->RowPosY2;
    const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount);
    const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest);
    if (table->CurrentRow == 0)
        table->LastFirstRowHeight = bg_y2 - bg_y1;

    const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y);
    if (is_visible)
    {
        // Decide of background color for the row
        ImU32 bg_col0 = 0;
        ImU32 bg_col1 = 0;
        if (table->RowBgColor[0] != IM_COL32_DISABLE)
            bg_col0 = table->RowBgColor[0];
        else if (table->Flags & ImGuiTableFlags_RowBg)
            bg_col0 = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg);
        if (table->RowBgColor[1] != IM_COL32_DISABLE)
            bg_col1 = table->RowBgColor[1];

        // Decide of top border color
        ImU32 border_col = 0;
        const float border_size = TABLE_BORDER_SIZE;
        if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow)
            if (table->Flags & ImGuiTableFlags_BordersInnerH)
                border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;

        const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0;
        const bool draw_strong_bottom_border = unfreeze_rows_actual;
        if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color)
        {
            // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is
            // always followed by a change of clipping rectangle we perform the smallest overwrite possible here.
            if ((table->Flags & ImGuiTableFlags_NoClip) == 0)
                window->DrawList->_CmdHeader.ClipRect = table->Bg0ClipRectForDrawCmd.ToVec4();
            table->DrawSplitter.SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_BG0);
        }

        // Draw row background
        // We soft/cpu clip this so all backgrounds and borders can share the same clipping rectangle
        if (bg_col0 || bg_col1)
        {
            ImRect row_rect(table->WorkRect.Min.x, bg_y1, table->WorkRect.Max.x, bg_y2);
            row_rect.ClipWith(table->BgClipRect);
            if (bg_col0 != 0 && row_rect.Min.y < row_rect.Max.y)
                window->DrawList->AddRectFilled(row_rect.Min, row_rect.Max, bg_col0);
            if (bg_col1 != 0 && row_rect.Min.y < row_rect.Max.y)
                window->DrawList->AddRectFilled(row_rect.Min, row_rect.Max, bg_col1);
        }

        // Draw cell background color
        if (draw_cell_bg_color)
        {
            ImGuiTableCellData* cell_data_end = &table->RowCellData[table->RowCellDataCurrent];
            for (ImGuiTableCellData* cell_data = &table->RowCellData[0]; cell_data <= cell_data_end; cell_data++)
            {
                const ImGuiTableColumn* column = &table->Columns[cell_data->Column];
                ImRect cell_bg_rect = TableGetCellBgRect(table, cell_data->Column);
                cell_bg_rect.ClipWith(table->BgClipRect);
                cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x);     // So that first column after frozen one gets clipped
                cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);
                window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
            }
        }

        // Draw top border
        if (border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y)
            window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y1), ImVec2(table->BorderX2, bg_y1), border_col, border_size);

        // Draw bottom border at the row unfreezing mark (always strong)
        if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y)
            window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y2), ImVec2(table->BorderX2, bg_y2), table->BorderColorStrong, border_size);
    }

    // End frozen rows (when we are past the last frozen row line, teleport cursor and alter clipping rectangle)
    // We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark end of row and
    // get the new cursor position.
    if (unfreeze_rows_request)
        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
        {
            ImGuiTableColumn* column = &table->Columns[column_n];
            column->NavLayerCurrent = (ImS8)((column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);
        }
    if (unfreeze_rows_actual)
    {
        IM_ASSERT(table->IsUnfrozenRows == false);
        table->IsUnfrozenRows = true;

        // BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
        float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
        table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
        table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
        table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
        IM_ASSERT(table->Bg2ClipRectForDrawCmd.Min.y <= table->Bg2ClipRectForDrawCmd.Max.y);

        float row_height = table->RowPosY2 - table->RowPosY1;
        table->RowPosY2 = window->DC.CursorPos.y = table->WorkRect.Min.y + table->RowPosY2 - table->OuterRect.Min.y;
        table->RowPosY1 = table->RowPosY2 - row_height;
        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
        {
            ImGuiTableColumn* column = &table->Columns[column_n];
            column->DrawChannelCurrent = column->DrawChannelUnfrozen;
            column->ClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y;
        }

        // Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y
        SetWindowClipRectBeforeSetChannel(window, table->Columns[0].ClipRect);
        table->DrawSplitter.SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);
    }

    if (!(table->RowFlags & ImGuiTableRowFlags_Headers))
        table->RowBgColorCounter++;
    table->IsInsideRow = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x724ce(%rip), %rax     # 0xfdcd0
movq (%rax), %rax
movq 0x1ae0(%rax), %r13
cmpq 0x1d0(%rdi), %r13
jne 0x8be68
movq %rdi, %rbx
cmpb $0x0, 0x249(%rdi)
je 0x8be87
cmpl $-0x1, 0x74(%rbx)
je 0x8b837
movq %rbx, %rdi
callq 0x8d6fa
movss 0x80(%rbx), %xmm1
movss %xmm1, 0xdc(%r13)
movss 0x7c(%rbx), %xmm6
movl 0x70(%rbx), %r14d
testl %r14d, %r14d
jne 0x8b865
movaps %xmm1, %xmm0
subss %xmm6, %xmm0
movss %xmm0, 0xd0(%rbx)
incl %r14d
movsbl 0x241(%rbx), %r15d
movsbl 0x240(%rbx), %r12d
ucomiss 0x120(%rbx), %xmm1
jb 0x8bc97
movss 0x128(%rbx), %xmm0
ucomiss %xmm6, %xmm0
jb 0x8bc97
movl %r12d, -0x50(%rbp)
movl %r15d, -0x48(%rbp)
movl 0x98(%rbx), %r12d
cmpl $0x1000000, %r12d       # imm = 0x1000000
movss %xmm1, -0x44(%rbp)
movaps %xmm6, -0x70(%rbp)
jne 0x8b8e0
xorl %r12d, %r12d
testb $0x40, 0x4(%rbx)
je 0x8b8e0
movl 0x94(%rbx), %edi
andl $0x1, %edi
addl $0x2d, %edi
movss 0x2b710(%rip), %xmm0    # 0xb6fe4
callq 0x445bd
movaps -0x70(%rbp), %xmm6
movl %eax, %r12d
movl 0x9c(%rbx), %r15d
xorl %edx, %edx
cmpl $0x1000000, %r15d       # imm = 0x1000000
cmovel %edx, %r15d
cmpl $0x0, 0x70(%rbx)
jle 0x8b915
testb $-0x80, 0x4(%rbx)
je 0x8b925
xorl %eax, %eax
testb $0x1, 0x92(%rbx)
sete %al
movl 0xa0(%rbx,%rax,4), %edx
jmp 0x8b925
movq 0x1d0(%rbx), %rax
cmpq 0x1c8(%rbx), %rax
je 0x8b8fa
movl %r14d, -0x54(%rbp)
cmpl -0x48(%rbp), %r14d
sete %al
movb 0x244(%rbx), %sil
testb %sil, %sil
setns %cl
movl %r15d, %r14d
orl %r12d, %r14d
movl %edx, -0x4c(%rbp)
orl %r14d, %edx
setne %dl
orb %al, %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x8b999
movb %sil, -0x29(%rbp)
testb $0x10, 0x6(%rbx)
jne 0x8b97c
movsd 0x13c(%rbx), %xmm0
movq 0x2b8(%r13), %rax
movhps 0x144(%rbx), %xmm0      # xmm0 = xmm0[0,1],mem[0,1]
movups %xmm0, 0x88(%rax)
leaq 0x1e8(%rbx), %rdi
movq 0x2b8(%r13), %rsi
xorl %edx, %edx
callq 0x7c2ae
movaps -0x70(%rbp), %xmm6
movb -0x29(%rbp), %sil
testl %r14d, %r14d
je 0x8ba8b
movss 0x10c(%rbx), %xmm1
movss 0x114(%rbx), %xmm0
leaq -0x38(%rbp), %rdx
movss %xmm1, -0x8(%rdx)
movss %xmm6, -0x4(%rdx)
movss %xmm0, (%rdx)
movss -0x44(%rbp), %xmm5
movss %xmm5, 0x4(%rdx)
movss 0x12c(%rbx), %xmm2
movss 0x130(%rbx), %xmm3
movaps %xmm2, %xmm4
cmpless %xmm1, %xmm4
andps %xmm4, %xmm1
andnps %xmm2, %xmm4
orps %xmm1, %xmm4
movaps %xmm3, %xmm1
cmpless %xmm6, %xmm1
movaps %xmm1, %xmm2
andps %xmm6, %xmm2
andnps %xmm3, %xmm1
orps %xmm2, %xmm1
unpcklps %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
movlps %xmm4, -0x8(%rdx)
minss 0x134(%rbx), %xmm0
movaps %xmm5, %xmm1
minss 0x138(%rbx), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movlps %xmm0, (%rdx)
testl %r12d, %r12d
je 0x8ba59
movss -0x34(%rbp), %xmm0
ucomiss -0x3c(%rbp), %xmm0
jbe 0x8ba59
movq 0x2b8(%r13), %rdi
movl %esi, %r14d
leaq -0x40(%rbp), %rsi
xorps %xmm0, %xmm0
movl %r12d, %ecx
movl $0xf, %r8d
callq 0x79d4a
leaq -0x38(%rbp), %rdx
movl %r14d, %esi
testl %r15d, %r15d
je 0x8ba8b
movss -0x34(%rbp), %xmm0
ucomiss -0x3c(%rbp), %xmm0
jbe 0x8ba8b
movq 0x2b8(%r13), %rdi
movl %esi, %r14d
leaq -0x40(%rbp), %rsi
xorps %xmm0, %xmm0
movl %r15d, %ecx
movl $0xf, %r8d
callq 0x79d4a
movl %r14d, %esi
movq %r13, %r12
testb %sil, %sil
js 0x8bbc5
movsbq 0x244(%rbx), %rax
testq %rax, %rax
js 0x8bee4
movq 0x30(%rbx), %r13
movq 0x38(%rbx), %rcx
leaq (,%rax,8), %r14
addq %r13, %r14
cmpq %rcx, %r14
jae 0x8bee4
cmpq %rcx, %r13
jae 0x8bee4
movsbq 0x4(%r13), %rax
testq %rax, %rax
js 0x8be49
imulq $0x68, %rax, %r15
addq 0x10(%rbx), %r15
cmpq 0x18(%rbx), %r15
jae 0x8be49
movsbl 0x4(%r13), %esi
movq %rbx, %rdi
callq 0x8d307
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movups %xmm0, -0x40(%rbp)
movss -0x40(%rbp), %xmm0
movss -0x3c(%rbp), %xmm1
movss 0x12c(%rbx), %xmm2
movss 0x130(%rbx), %xmm3
movaps %xmm2, %xmm4
cmpless %xmm0, %xmm4
andps %xmm4, %xmm0
andnps %xmm2, %xmm4
orps %xmm0, %xmm4
movaps %xmm3, %xmm0
cmpless %xmm1, %xmm0
andps %xmm0, %xmm1
andnps %xmm3, %xmm0
orps %xmm1, %xmm0
unpcklps %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1]
movlps %xmm4, -0x40(%rbp)
movss -0x38(%rbp), %xmm0
minss 0x134(%rbx), %xmm0
movss -0x34(%rbp), %xmm1
minss 0x138(%rbx), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movlps %xmm0, -0x38(%rbp)
movss -0x40(%rbp), %xmm0
movss 0x20(%r15), %xmm1
movaps %xmm1, %xmm2
cmpless %xmm0, %xmm2
andps %xmm2, %xmm0
andnps %xmm1, %xmm2
orps %xmm0, %xmm2
movss %xmm2, -0x40(%rbp)
movss -0x38(%rbp), %xmm0
minss 0xc(%r15), %xmm0
movss %xmm0, -0x38(%rbp)
movq 0x2b8(%r12), %rdi
movl (%r13), %ecx
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movl $0xf, %r8d
callq 0x79d4a
addq $0x8, %r13
cmpq %r14, %r13
jbe 0x8bacd
movl -0x4c(%rbp), %ecx
testl %ecx, %ecx
movq %r12, %r13
movaps -0x70(%rbp), %xmm1
je 0x8bc27
ucomiss 0x130(%rbx), %xmm1
jb 0x8bc27
movss 0x138(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x8bc27
movq 0x2b8(%r13), %rdi
movss 0xa8(%rbx), %xmm0
leaq -0x40(%rbp), %rsi
movss %xmm0, (%rsi)
movss %xmm1, 0x4(%rsi)
movss 0xac(%rbx), %xmm0
leaq -0x78(%rbp), %rdx
movss %xmm0, (%rdx)
movss %xmm1, 0x4(%rdx)
movss 0x2b3c2(%rip), %xmm0    # 0xb6fe4
callq 0x79abc
movl -0x54(%rbp), %r14d
movl -0x48(%rbp), %r15d
cmpl %r15d, %r14d
movss -0x44(%rbp), %xmm1
movl -0x50(%rbp), %r12d
jne 0x8bc97
ucomiss 0x130(%rbx), %xmm1
jb 0x8bc97
movss 0x138(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x8bc97
movq 0x2b8(%r13), %rdi
movss 0xa8(%rbx), %xmm0
leaq -0x40(%rbp), %rsi
movss %xmm0, (%rsi)
movss %xmm1, 0x4(%rsi)
movss 0xac(%rbx), %xmm0
leaq -0x78(%rbp), %rdx
movss %xmm0, (%rdx)
movss %xmm1, 0x4(%rdx)
movl 0xa0(%rbx), %ecx
movss 0x2b352(%rip), %xmm0    # 0xb6fe4
callq 0x79abc
cmpl %r12d, %r14d
jne 0x8bcd0
movslq 0x6c(%rbx), %rax
testq %rax, %rax
jle 0x8bcd0
movq 0x10(%rbx), %rcx
xorl %edx, %edx
cmpq 0x18(%rbx), %rcx
jae 0x8be49
movsbq 0x243(%rbx), %rsi
cmpq %rsi, %rdx
setl 0x61(%rcx)
incq %rdx
addq $0x68, %rcx
cmpq %rdx, %rax
jne 0x8bcab
cmpl %r15d, %r14d
jne 0x8be24
cmpb $0x0, 0x253(%rbx)
jne 0x8bea6
movb $0x1, 0x253(%rbx)
movss 0x80(%rbx), %xmm1
movss 0x2b2e7(%rip), %xmm2    # 0xb6fe4
addss %xmm1, %xmm2
movss 0x22c(%r13), %xmm3
movss 0x234(%r13), %xmm4
movaps %xmm3, %xmm0
cmpless %xmm2, %xmm0
andps %xmm0, %xmm2
andnps %xmm3, %xmm0
orps %xmm2, %xmm0
minss %xmm4, %xmm0
movss %xmm0, 0x150(%rbx)
movss %xmm0, 0x130(%rbx)
movss %xmm4, 0x158(%rbx)
movss %xmm4, 0x138(%rbx)
movb 0x247(%rbx), %al
movb %al, 0x246(%rbx)
ucomiss %xmm0, %xmm4
jb 0x8bec5
movaps %xmm1, %xmm2
subss 0x7c(%rbx), %xmm2
addss 0x110(%rbx), %xmm1
subss 0xf0(%rbx), %xmm1
movss %xmm1, 0xdc(%r13)
movss %xmm1, 0x80(%rbx)
subss %xmm2, %xmm1
movss %xmm1, 0x7c(%rbx)
movslq 0x6c(%rbx), %rax
testq %rax, %rax
jle 0x8bdba
movq 0x10(%rbx), %rcx
cmpq 0x18(%rbx), %rcx
jae 0x8be49
movb 0x59(%rcx), %dl
movb %dl, 0x57(%rcx)
movss %xmm0, 0x24(%rcx)
addq $0x68, %rcx
decq %rax
jne 0x8bd9c
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jae 0x8be49
movsd 0x20(%rax), %xmm0
movhps 0x28(%rax), %xmm0       # xmm0 = xmm0[0,1],mem[0,1]
movups 0x20(%rax), %xmm1
movups %xmm1, 0x258(%r13)
movq 0x2b8(%r13), %rax
movups %xmm0, 0x88(%rax)
movq 0x2b8(%r13), %rax
movq 0x60(%rax), %rcx
movslq 0x58(%rax), %rax
shlq $0x4, %rax
movups %xmm0, -0x10(%rcx,%rax)
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jae 0x8be49
movq 0x2b8(%r13), %rsi
leaq 0x1e8(%rbx), %rdi
movzbl 0x57(%rax), %edx
callq 0x7c2ae
testb $0x1, 0x90(%rbx)
jne 0x8be33
incl 0x94(%rbx)
movb $0x0, 0x249(%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30868(%rip), %rdi     # 0xbc6b8
leaq 0x2f7e8(%rip), %rsi     # 0xbb63f
leaq 0x30873(%rip), %rcx     # 0xbc6d1
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x459d2(%rip), %rdi     # 0xd1841
leaq 0x45044(%rip), %rsi     # 0xd0eba
leaq 0x459e1(%rip), %rcx     # 0xd185e
movl $0x664, %edx            # imm = 0x664
callq 0xc140
leaq 0x45978(%rip), %rdi     # 0xd1806
leaq 0x45025(%rip), %rsi     # 0xd0eba
leaq 0x459c2(%rip), %rcx     # 0xd185e
movl $0x665, %edx            # imm = 0x665
callq 0xc140
leaq 0x459d7(%rip), %rdi     # 0xd1884
leaq 0x45006(%rip), %rsi     # 0xd0eba
leaq 0x459a3(%rip), %rcx     # 0xd185e
movl $0x6c4, %edx            # imm = 0x6C4
callq 0xc140
leaq 0x459d7(%rip), %rdi     # 0xd18a3
leaq 0x44fe7(%rip), %rsi     # 0xd0eba
leaq 0x45984(%rip), %rcx     # 0xd185e
movl $0x6cc, %edx            # imm = 0x6CC
callq 0xc140
leaq 0x307cd(%rip), %rdi     # 0xbc6b8
leaq 0x2f74d(%rip), %rsi     # 0xbb63f
leaq 0x46d73(%rip), %rcx     # 0xd2c6c
jmp 0x8be5e