// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableUpdateBorders(ImGuiTable*)
void ImGui::TableUpdateBorders(ImGuiTable* table)
{
    ImGuiContext& g = *GImGui;
    IM_ASSERT(table->Flags & ImGuiTableFlags_Resizable);

    // At this point OuterRect height may be zero or under actual final height, so we rely on temporal coherency and
    // use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not
    // really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height).
    // Actual columns highlight/render will be performed in EndTable() and not be affected.
    const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS;
    const float hit_y1 = table->OuterRect.Min.y;
    const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table->LastOuterHeight);
    const float hit_y2_head = hit_y1 + table->LastFirstRowHeight;

    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];
        if (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_))
            continue;

        // ImGuiTableFlags_NoBordersInBodyUntilResize will be honored in TableDrawBorders()
        const float border_y2_hit = (table->Flags & ImGuiTableFlags_NoBordersInBody) ? hit_y2_head : hit_y2_body;
        if ((table->Flags & ImGuiTableFlags_NoBordersInBody) && table->IsUsingHeaders == false)
            continue;

        if (table->FreezeColumnsCount > 0)
            if (column->MaxX < table->Columns[table->DisplayOrderToIndex[table->FreezeColumnsCount - 1]].MaxX)
                continue;

        ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent);
        ImRect hit_rect(column->MaxX - hit_half_width, hit_y1, column->MaxX + hit_half_width, border_y2_hit);
        //GetForegroundDrawList()->AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100));
        KeepAliveID(column_id);

        bool hovered = false, held = false;
        bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
        if (pressed && IsMouseDoubleClicked(0))
        {
            TableSetColumnWidthAutoSingle(table, column_n);
            ClearActiveID();
            held = hovered = false;
        }
        if (held)
        {
            if (table->LastResizedColumn == -1)
                table->ResizeLockMinContentsX2 = table->RightMostEnabledColumn != -1 ? table->Columns[table->RightMostEnabledColumn].MaxX : -FLT_MAX;
            table->ResizedColumn = (ImGuiTableColumnIdx)column_n;
            table->InstanceInteracted = table->InstanceCurrent;
        }
        if ((hovered && g.HoveredIdTimer > TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER) || held)
        {
            table->HoveredColumnBorder = (ImGuiTableColumnIdx)column_n;
            SetMouseCursor(ImGuiMouseCursor_ResizeEW);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testb $0x1, 0x4(%rdi)
je 0x8a982
movq %rdi, %rbx
cmpl $0x0, 0x6c(%rdi)
jle 0x8a93d
leaq 0x735dd(%rip), %rax     # 0xfdcd0
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movss 0xf0(%rbx), %xmm3
movss 0xf8(%rbx), %xmm0
movss 0xcc(%rbx), %xmm1
addss %xmm3, %xmm1
movaps %xmm1, %xmm4
cmpless %xmm0, %xmm4
movaps %xmm4, %xmm2
andnps %xmm1, %xmm2
andps %xmm0, %xmm4
orps %xmm2, %xmm4
movaps %xmm4, -0x60(%rbp)
movss 0xd0(%rbx), %xmm0
movss %xmm3, -0x34(%rbp)
addss %xmm3, %xmm0
movss %xmm0, -0x30(%rbp)
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
btq %r15, %rax
jae 0x8a795
movq 0x20(%rbx), %rcx
movq 0x28(%rbx), %rdx
leaq (%rcx,%r15), %rax
cmpq %rdx, %rax
jae 0x8a963
movsbq (%rax), %r13
testq %r13, %r13
js 0x8a94c
imulq $0x68, %r13, %r12
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rsi
addq %rax, %r12
cmpq %rsi, %r12
jae 0x8a94c
testl $0x40000010, (%r12)     # imm = 0x40000010
je 0x8a7a6
incq %r15
movslq 0x6c(%rbx), %rax
cmpq %rax, %r15
jl 0x8a747
jmp 0x8a93d
testb $0x8, 0x5(%rbx)
movaps -0x60(%rbp), %xmm1
je 0x8a7b5
movss -0x30(%rbp), %xmm1
je 0x8a7c0
cmpb $0x0, 0x24c(%rbx)
je 0x8a795
movsbq 0x243(%rbx), %rdi
testq %rdi, %rdi
jle 0x8a806
addq %rdi, %rcx
decq %rcx
cmpq %rdx, %rcx
jae 0x8a963
movsbq (%rcx), %rcx
testq %rcx, %rcx
js 0x8a94c
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
cmpq %rsi, %rax
jae 0x8a94c
movss 0xc(%rax), %xmm0
ucomiss 0xc(%r12), %xmm0
ja 0x8a795
movswl 0x78(%rbx), %edx
movq %rbx, %rdi
movl %r13d, %esi
movss %xmm1, -0x38(%rbp)
callq 0x8ada4
movl %eax, %r14d
movss 0xc(%r12), %xmm0
movaps %xmm0, %xmm1
addss 0x2d031(%rip), %xmm1    # 0xb7860
addss 0x2d02d(%rip), %xmm0    # 0xb7864
movss %xmm1, -0x48(%rbp)
movss -0x34(%rbp), %xmm1
movss %xmm1, -0x44(%rbp)
movss %xmm0, -0x40(%rbp)
movss -0x38(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
movl %eax, %edi
callq 0x46530
xorl %eax, %eax
movb %al, -0x2a(%rbp)
movb %al, -0x29(%rbp)
leaq -0x48(%rbp), %rdi
movl %r14d, %esi
leaq -0x2a(%rbp), %rdx
leaq -0x29(%rbp), %rcx
movl $0x1910, %r8d           # imm = 0x1910
callq 0x92870
testb %al, %al
je 0x8a8a5
xorl %edi, %edi
callq 0x52700
testb %al, %al
je 0x8a8a5
movq %rbx, %rdi
movl %r13d, %esi
callq 0x8addf
callq 0x46c46
xorl %eax, %eax
movb %al, -0x2a(%rbp)
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
cmpb $0x1, %al
jne 0x8a8f9
cmpb $-0x1, 0x238(%rbx)
jne 0x8a8ea
movsbq 0x23e(%rbx), %rcx
movss 0x2cfe3(%rip), %xmm0    # 0xb78a8
cmpq $-0x1, %rcx
je 0x8a8e2
testb %cl, %cl
js 0x8a94c
imulq $0x68, %rcx, %rcx
addq 0x10(%rbx), %rcx
cmpq 0x18(%rbx), %rcx
jae 0x8a94c
movss 0xc(%rcx), %xmm0
movss %xmm0, 0xe4(%rbx)
movb %r13b, 0x237(%rbx)
movzwl 0x78(%rbx), %ecx
movw %cx, 0x7a(%rbx)
cmpb $0x1, -0x2a(%rbp)
jne 0x8a91f
movq -0x50(%rbp), %rcx
movss 0x1b28(%rcx), %xmm0
ucomiss 0x4654a(%rip), %xmm0    # 0xd0e5c
seta %cl
orb %al, %cl
je 0x8a795
jmp 0x8a927
testb %al, %al
je 0x8a795
movb %r13b, 0x235(%rbx)
movl $0x4, %edi
callq 0x52999
jmp 0x8a795
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31d65(%rip), %rdi     # 0xbc6b8
leaq 0x30ce5(%rip), %rsi     # 0xbb63f
leaq 0x31d70(%rip), %rcx     # 0xbc6d1
jmp 0x8a978
leaq 0x31d4e(%rip), %rdi     # 0xbc6b8
leaq 0x30cce(%rip), %rsi     # 0xbb63f
leaq 0x480f1(%rip), %rcx     # 0xd2a69
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x4681a(%rip), %rdi     # 0xd11a3
leaq 0x4652a(%rip), %rsi     # 0xd0eba
leaq 0x46835(%rip), %rcx     # 0xd11cc
movl $0x44b, %edx            # imm = 0x44B
callq 0xc140