// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movq %rdi, %rbx
movq 0x1d0(%rdi), %r14
movl $0x258, %edi            # imm = 0x258
addq 0x1c8(%rbx), %rdi
leaq 0xec(%rbx), %r15
movq %r15, %rsi
callq 0x4a2f6
testb %al, %al
je 0x73e3d
movq 0x2b8(%r14), %r14
leaq 0x1e8(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x656c2
movsd 0x13c(%rbx), %xmm0
movsd 0x144(%rbx), %xmm1
movq %r14, -0x40(%rbp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x62204
movss 0x100(%rbx), %xmm0
movss 0x108(%rbx), %xmm1
movss %xmm1, -0x2c(%rbp)
cmpb $0x1, 0x24c(%rbx)
movss %xmm0, -0x30(%rbp)
movss %xmm0, -0x54(%rbp)
jne 0x73b0a
cmpb $0x0, 0x241(%rbx)
movss -0x30(%rbp), %xmm0
jg 0x73af4
movss 0x110(%rbx), %xmm0
addss 0xd0(%rbx), %xmm0
movss -0x2c(%rbp), %xmm1
minss %xmm0, %xmm1
movss %xmm1, -0x54(%rbp)
movl 0x4(%rbx), %eax
btl $0x9, %eax
jae 0x73cad
movq %r15, -0x60(%rbp)
leaq 0x20(%rbx), %rax
movq %rax, -0x70(%rbp)
leaq 0x10(%rbx), %rax
movq %rax, -0x68(%rbp)
xorl %r14d, %r14d
movslq 0x6c(%rbx), %rax
cmpq %rax, %r14
jge 0x73ca6
movq 0x40(%rbx), %rax
btq %r14, %rax
jae 0x73b7d
movq -0x70(%rbp), %rdi
movl %r14d, %esi
callq 0x787be
movb (%rax), %r13b
movsbl %r13b, %r12d
movq -0x68(%rbp), %rdi
movl %r12d, %esi
callq 0x4c4c6
movq %rax, %r15
cmpb %r12b, 0x237(%rbx)
jne 0x73b82
movzwl 0x7a(%rbx), %eax
cmpw 0x78(%rbx), %ax
sete %al
jmp 0x73b84
incq %r14
jmp 0x73b2e
xorl %eax, %eax
movb 0x243(%rbx), %dl
cmpb $-0x1, %dl
setne %cl
movsbq %dl, %rdx
incq %r14
movl %edx, %edx
cmpq %rdx, %r14
sete %sil
movss 0xc(%r15), %xmm0
ucomiss 0x124(%rbx), %xmm0
setbe %dl
orb %al, %dl
testb $0x1, %dl
je 0x73b2e
movb 0x235(%rbx), %dl
cmpb $-0x1, 0x55(%r15)
jne 0x73bee
movl (%r15), %edi
movl $0x40000010, %r8d       # imm = 0x40000010
andl %r8d, %edi
je 0x73bee
movl 0x4(%rbx), %edi
movl $0x1e000, %r8d          # imm = 0x1E000
andl %r8d, %edi
cmpl $0x4000, %edi           # imm = 0x4000
jne 0x73b2e
movss 0x20(%r15), %xmm1
ucomiss %xmm0, %xmm1
jae 0x73b2e
andb %sil, %cl
cmpb %r13b, %dl
sete %sil
orb %al, %sil
orb %cl, %sil
testb $0x1, %sil
je 0x73c1b
testb %al, %al
je 0x73c3b
pushq $0x1d
jmp 0x73c42
xorl %eax, %eax
testb $0x18, 0x5(%rbx)
sete %cl
movss -0x2c(%rbp), %xmm0
je 0x73c30
movss -0x54(%rbp), %xmm0
movb %cl, %al
movl 0xa0(%rbx,%rax,4), %ecx
jmp 0x73c5f
cmpb %r13b, %dl
jne 0x73c54
pushq $0x1c
popq %rdi
movss 0x283ad(%rip), %xmm0    # 0x9bff8
callq 0x35d33
movl %eax, %ecx
jmp 0x73c5a
movl 0xa0(%rbx), %ecx
movss -0x2c(%rbp), %xmm0
ucomiss -0x30(%rbp), %xmm0
jbe 0x73b2e
movss 0xc(%r15), %xmm1
movss %xmm1, -0x50(%rbp)
movss -0x30(%rbp), %xmm2
movss %xmm2, -0x4c(%rbp)
movss %xmm1, -0x38(%rbp)
movss %xmm0, -0x34(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movss 0x2835c(%rip), %xmm0    # 0x9bff8
callq 0x63ec2
jmp 0x73b2e
movl 0x4(%rbx), %eax
movq -0x60(%rbp), %r15
movl %eax, %ecx
andl $0x500, %ecx            # imm = 0x500
je 0x73dc4
movups (%r15), %xmm0
movaps %xmm0, -0x50(%rbp)
movl 0xa0(%rbx), %r14d
cmpl $0x500, %ecx            # imm = 0x500
jne 0x73cfa
leaq -0x48(%rbp), %rdx
leaq -0x50(%rbp), %rsi
pushq $-0x1
popq %r8
movss 0x28312(%rip), %xmm1    # 0x9bff8
xorps %xmm0, %xmm0
movq -0x40(%rbp), %rdi
movl %r14d, %ecx
callq 0x63f6c
jmp 0x73dc1
btl $0xa, %eax
jb 0x73d5a
btl $0x8, %eax
jae 0x73dc1
leaq -0x48(%rbp), %rax
movq -0x4(%rax), %rax
rolq $0x20, %rax
leaq -0x38(%rbp), %r12
movq %rax, (%r12)
leaq -0x50(%rbp), %r13
movss 0x282ce(%rip), %xmm0    # 0x9bff8
movq -0x40(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x63ec2
movss (%r13), %xmm0
movss 0xc(%r13), %xmm1
movss %xmm0, (%r12)
movss %xmm1, 0x4(%r12)
jmp 0x73da6
leaq -0x48(%rbp), %rax
movss -0x8(%rax), %xmm0
movss 0x4(%rax), %xmm1
leaq -0x38(%rbp), %r12
movss %xmm0, (%r12)
movss %xmm1, 0x4(%r12)
leaq -0x50(%rbp), %r13
movss 0x28273(%rip), %xmm0    # 0x9bff8
movq -0x40(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x63ec2
movq 0x4(%r13), %rax
rolq $0x20, %rax
movq %rax, (%r12)
leaq -0x38(%rbp), %rsi
movq %r15, %rdi
leaq -0x48(%rbp), %rdx
movl %r14d, %ecx
movss 0x2823c(%rip), %xmm0    # 0x9bff8
callq 0x63ec2
movl 0x4(%rbx), %eax
testb %al, %al
jns 0x73e34
movss 0x80(%rbx), %xmm0
movss 0xf8(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x73e34
ucomiss 0x130(%rbx), %xmm0
jb 0x73e34
movss 0x138(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x73e34
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 0x281cd(%rip), %xmm0    # 0x9bff8
movq -0x40(%rbp), %rdi
callq 0x63ec2
movq -0x40(%rbp), %rdi
callq 0x622f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq