// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableDrawBorders(ImGuiTable*)
void ImGui::TableDrawBorders(ImGuiTable* table)
{
    ImGuiWindow* inner_window = table->InnerWindow;
    if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect))
        return;

    ImDrawList* inner_drawlist = inner_window->DrawList;
    table->DrawSplitter.SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0);
    inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false);

    // Draw inner border and resizing feedback
    const float border_size = TABLE_BORDER_SIZE;
    const float draw_y1 = table->InnerRect.Min.y;
    const float draw_y2_body = table->InnerRect.Max.y;
    const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->LastFirstRowHeight) : draw_y1;
    if (table->Flags & ImGuiTableFlags_BordersInnerV)
    {
        for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
        {
            if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))
                continue;

            const int column_n = table->DisplayOrderToIndex[order_n];
            ImGuiTableColumn* column = &table->Columns[column_n];
            const bool is_hovered = (table->HoveredColumnBorder == column_n);
            const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent);
            const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;
            const bool is_frozen_separator = (table->FreezeColumnsCount != -1 && table->FreezeColumnsCount == order_n + 1);
            if (column->MaxX > table->InnerClipRect.Max.x && !is_resized)
                continue;

            // Decide whether right-most column is visible
            if (column->NextEnabledColumn == -1 && !is_resizable)
                if ((table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame || (table->Flags & ImGuiTableFlags_NoHostExtendX))
                    continue;
            if (column->MaxX <= column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size..
                continue;

            // Draw in outer window so right-most column won't be clipped
            // Always draw full height border when being resized/hovered, or on the delimitation of frozen column scrolling.
            ImU32 col;
            float draw_y2;
            if (is_hovered || is_resized || is_frozen_separator)
            {
                draw_y2 = draw_y2_body;
                col = is_resized ? GetColorU32(ImGuiCol_SeparatorActive) : is_hovered ? GetColorU32(ImGuiCol_SeparatorHovered) : table->BorderColorStrong;
            }
            else
            {
                draw_y2 = (table->Flags & (ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_NoBordersInBodyUntilResize)) ? draw_y2_head : draw_y2_body;
                col = (table->Flags & (ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_NoBordersInBodyUntilResize)) ? table->BorderColorStrong : table->BorderColorLight;
            }

            if (draw_y2 > draw_y1)
                inner_drawlist->AddLine(ImVec2(column->MaxX, draw_y1), ImVec2(column->MaxX, draw_y2), col, border_size);
        }
    }

    // Draw outer border
    // FIXME: could use AddRect or explicit VLine/HLine helper?
    if (table->Flags & ImGuiTableFlags_BordersOuter)
    {
        // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call
        // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their
        // parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part
        // of it in inner window, and the part that's over scrollbars in the outer window..)
        // Either solution currently won't allow us to use a larger border size: the border would clipped.
        const ImRect outer_border = table->OuterRect;
        const ImU32 outer_col = table->BorderColorStrong;
        if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter)
        {
            inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, ~0, border_size);
        }
        else if (table->Flags & ImGuiTableFlags_BordersOuterV)
        {
            inner_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Min.x, outer_border.Max.y), outer_col, border_size);
            inner_drawlist->AddLine(ImVec2(outer_border.Max.x, outer_border.Min.y), outer_border.Max, outer_col, border_size);
        }
        else if (table->Flags & ImGuiTableFlags_BordersOuterH)
        {
            inner_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Max.x, outer_border.Min.y), outer_col, border_size);
            inner_drawlist->AddLine(ImVec2(outer_border.Min.x, outer_border.Max.y), outer_border.Max, outer_col, border_size);
        }
    }
    if ((table->Flags & ImGuiTableFlags_BordersInnerH) && table->RowPosY2 < table->OuterRect.Max.y)
    {
        // Draw bottom-most row border
        const float border_y = table->RowPosY2;
        if (border_y >= table->BgClipRect.Min.y && border_y < table->BgClipRect.Max.y)
            inner_drawlist->AddLine(ImVec2(table->BorderX1, border_y), ImVec2(table->BorderX2, border_y), table->BorderColorLight, border_size);
    }

    inner_drawlist->PopClipRect();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x1c8(%rdi), %rax
movss 0x264(%rax), %xmm0
ucomiss 0xf0(%rdi), %xmm0
jbe 0x8a70e
movq %rdi, %rbx
movss 0xf8(%rdi), %xmm0
ucomiss 0x25c(%rax), %xmm0
jbe 0x8a70e
leaq 0xec(%rbx), %r13
movss 0x260(%rax), %xmm0
ucomiss (%r13), %xmm0
jbe 0x8a70e
movss 0xf4(%rbx), %xmm0
ucomiss 0x258(%rax), %xmm0
jbe 0x8a70e
movq 0x1d0(%rbx), %rax
movq 0x2b8(%rax), %r14
leaq 0x1e8(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x7a998
movsd 0x13c(%rbx), %xmm0
movsd 0x144(%rbx), %xmm1
movq %r14, %rdi
xorl %esi, %esi
callq 0x75b8a
movss 0x100(%rbx), %xmm2
movss 0x108(%rbx), %xmm3
cmpb $0x1, 0x24c(%rbx)
movss %xmm2, -0x54(%rbp)
jne 0x8a3bb
cmpb $0x0, 0x241(%rbx)
movaps %xmm2, %xmm0
jg 0x8a3a7
movss 0x110(%rbx), %xmm0
addss 0xd0(%rbx), %xmm0
movaps %xmm3, %xmm1
minss %xmm0, %xmm1
movss %xmm1, -0x54(%rbp)
movl 0x4(%rbx), %eax
btl $0x9, %eax
jae 0x8a586
cmpl $0x0, 0x6c(%rbx)
jle 0x8a586
xorl %r15d, %r15d
movl $0x40000010, %r9d       # imm = 0x40000010
movss %xmm2, -0x30(%rbp)
movss %xmm3, -0x2c(%rbp)
movq 0x40(%rbx), %rax
btq %r15, %rax
jae 0x8a434
movq 0x20(%rbx), %rax
addq %r15, %rax
cmpq 0x28(%rbx), %rax
jae 0x8a734
movsbq (%rax), %rax
testq %rax, %rax
js 0x8a71d
imulq $0x68, %rax, %r12
addq 0x10(%rbx), %r12
cmpq 0x18(%rbx), %r12
jae 0x8a71d
cmpb %al, 0x237(%rbx)
jne 0x8a43c
movzwl 0x7a(%rbx), %ecx
cmpw 0x78(%rbx), %cx
sete %cl
jmp 0x8a43e
incq %r15
jmp 0x8a576
xorl %ecx, %ecx
movb 0x243(%rbx), %sil
cmpb $-0x1, %sil
setne %dl
movsbq %sil, %rsi
incq %r15
movl %esi, %esi
cmpq %rsi, %r15
sete %dil
movss 0xc(%r12), %xmm0
ucomiss 0x124(%rbx), %xmm0
setbe %sil
orb %cl, %sil
testb $0x1, %sil
je 0x8a576
movb 0x235(%rbx), %sil
cmpb $-0x1, 0x55(%r12)
jne 0x8a4ad
movl (%r12), %r8d
andl %r9d, %r8d
je 0x8a4ad
movl 0x4(%rbx), %r8d
movl $0x1e000, %r10d         # imm = 0x1E000
andl %r10d, %r8d
cmpl $0x4000, %r8d           # imm = 0x4000
jne 0x8a576
movss 0x20(%r12), %xmm1
ucomiss %xmm0, %xmm1
jae 0x8a576
andb %dil, %dl
cmpb %al, %sil
sete %dil
orb %cl, %dl
orb %dil, %dl
testb $0x1, %dl
je 0x8a4dc
testb %cl, %cl
je 0x8a4fa
movl $0x1d, %edi
jmp 0x8a504
xorl %eax, %eax
testb $0x18, 0x5(%rbx)
sete %cl
movaps %xmm3, %xmm0
je 0x8a4ef
movss -0x54(%rbp), %xmm0
movb %cl, %al
movl 0xa0(%rbx,%rax,4), %ecx
jmp 0x8a52e
cmpb %al, %sil
jne 0x8a525
movl $0x1c, %edi
movss 0x2aad8(%rip), %xmm0    # 0xb4fe4
callq 0x43bca
movl $0x40000010, %r9d       # imm = 0x40000010
movss -0x2c(%rbp), %xmm3
movss -0x30(%rbp), %xmm2
movl %eax, %ecx
jmp 0x8a52b
movl 0xa0(%rbx), %ecx
movaps %xmm3, %xmm0
ucomiss %xmm2, %xmm0
jbe 0x8a576
movss 0xc(%r12), %xmm1
movss %xmm1, -0x50(%rbp)
movss %xmm2, -0x4c(%rbp)
movss %xmm1, -0x38(%rbp)
movss %xmm0, -0x34(%rbp)
movq %r14, %rdi
leaq -0x50(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movss 0x2aa83(%rip), %xmm0    # 0xb4fe4
callq 0x78368
movl $0x40000010, %r9d       # imm = 0x40000010
movss -0x2c(%rbp), %xmm3
movss -0x30(%rbp), %xmm2
movslq 0x6c(%rbx), %rax
cmpq %rax, %r15
jl 0x8a3e5
movl 0x4(%rbx), %eax
movl %eax, %ecx
andl $0x500, %ecx            # imm = 0x500
je 0x8a697
movups (%r13), %xmm0
movaps %xmm0, -0x50(%rbp)
movl 0xa0(%rbx), %r15d
cmpl $0x500, %ecx            # imm = 0x500
jne 0x8a5d5
leaq -0x48(%rbp), %rdx
leaq -0x50(%rbp), %rsi
movss 0x2aa28(%rip), %xmm1    # 0xb4fe4
xorps %xmm0, %xmm0
movq %r14, %rdi
movl %r15d, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x7851c
jmp 0x8a694
btl $0xa, %eax
jb 0x8a631
btl $0x8, %eax
jae 0x8a694
leaq -0x48(%rbp), %rax
movq -0x4(%rax), %rax
rolq $0x20, %rax
leaq -0x38(%rbp), %r13
movq %rax, (%r13)
leaq -0x50(%rbp), %r12
movss 0x2a9df(%rip), %xmm0    # 0xb4fe4
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl %r15d, %ecx
callq 0x78368
movss (%r12), %xmm0
movss 0xc(%r12), %xmm1
movss %xmm0, (%r13)
movss %xmm1, 0x4(%r13)
jmp 0x8a679
leaq -0x48(%rbp), %rax
movss -0x8(%rax), %xmm0
movss 0x4(%rax), %xmm1
leaq -0x38(%rbp), %r13
movss %xmm0, (%r13)
movss %xmm1, 0x4(%r13)
leaq -0x50(%rbp), %r12
movss 0x2a989(%rip), %xmm0    # 0xb4fe4
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl %r15d, %ecx
callq 0x78368
movq 0x4(%r12), %rax
rolq $0x20, %rax
movq %rax, (%r13)
leaq -0x38(%rbp), %rsi
movq %r14, %rdi
leaq -0x48(%rbp), %rdx
movl %r15d, %ecx
movss 0x2a955(%rip), %xmm0    # 0xb4fe4
callq 0x78368
movl 0x4(%rbx), %eax
testb %al, %al
jns 0x8a706
movss 0x80(%rbx), %xmm0
movss 0xf8(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x8a706
ucomiss 0x130(%rbx), %xmm0
jb 0x8a706
movss 0x138(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x8a706
movss 0xa8(%rbx), %xmm1
leaq -0x50(%rbp), %rsi
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
movss 0xac(%rbx), %xmm1
leaq -0x38(%rbp), %rdx
movss %xmm1, (%rdx)
movss %xmm0, 0x4(%rdx)
movl 0xa4(%rbx), %ecx
movss 0x2a8e6(%rip), %xmm0    # 0xb4fe4
movq %r14, %rdi
callq 0x78368
movq %r14, %rdi
callq 0x75d0e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ff94(%rip), %rdi     # 0xba6b8
leaq 0x2ef14(%rip), %rsi     # 0xb963f
leaq 0x2ff9f(%rip), %rcx     # 0xba6d1
jmp 0x8a749
leaq 0x2ff7d(%rip), %rdi     # 0xba6b8
leaq 0x2eefd(%rip), %rsi     # 0xb963f
leaq 0x462f0(%rip), %rcx     # 0xd0a39
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140