// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableSetColumnWidth(int, float)
void ImGui::TableSetColumnWidth(int column_n, float width)
{
    ImGuiContext& g = *GImGui;
    ImGuiTable* table = g.CurrentTable;
    IM_ASSERT(table != NULL && table->IsLayoutLocked == false);
    IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
    ImGuiTableColumn* column_0 = &table->Columns[column_n];
    float column_0_width = width;

    // Apply constraints early
    // Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded)
    IM_ASSERT(table->MinColumnWidth > 0.0f);
    const float min_width = table->MinColumnWidth;
    const float max_width = ImMax(min_width, TableGetMaxColumnWidth(table, column_n));
    column_0_width = ImClamp(column_0_width, min_width, max_width);
    if (column_0->WidthGiven == column_0_width || column_0->WidthRequest == column_0_width)
        return;

    //IMGUI_DEBUG_LOG("TableSetColumnWidth(%d, %.1f->%.1f)\n", column_0_idx, column_0->WidthGiven, column_0_width);
    ImGuiTableColumn* column_1 = (column_0->NextEnabledColumn != -1) ? &table->Columns[column_0->NextEnabledColumn] : NULL;

    // In this surprisingly not simple because of how we support mixing Fixed and multiple Stretch columns.
    // - All fixed: easy.
    // - All stretch: easy.
    // - One or more fixed + one stretch: easy.
    // - One or more fixed + more than one stretch: tricky.
    // Qt when manual resize is enabled only support a single _trailing_ stretch column.

    // When forwarding resize from Wn| to Fn+1| we need to be considerate of the _NoResize flag on Fn+1.
    // FIXME-TABLE: Find a way to rewrite all of this so interactions feel more consistent for the user.
    // Scenarios:
    // - F1 F2 F3  resize from F1| or F2|   --> ok: alter ->WidthRequested of Fixed column. Subsequent columns will be offset.
    // - F1 F2 F3  resize from F3|          --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered.
    // - F1 F2 W3  resize from F1| or F2|   --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered, but it doesn't make much sense as the Stretch column will always be minimal size.
    // - F1 F2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1)
    // - W1 W2 W3  resize from W1| or W2|   --> ok
    // - W1 W2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1)
    // - W1 F2 F3  resize from F3|          --> ok: no-op (disabled by Resize Rule 1)
    // - W1 F2     resize from F2|          --> ok: no-op (disabled by Resize Rule 1)
    // - W1 W2 F3  resize from W1| or W2|   --> ok
    // - W1 F2 W3  resize from W1| or F2|   --> ok
    // - F1 W2 F3  resize from W2|          --> ok
    // - F1 W3 F2  resize from W3|          --> ok
    // - W1 F2 F3  resize from W1|          --> ok: equivalent to resizing |F2. F3 will not move.
    // - W1 F2 F3  resize from F2|          --> ok
    // All resizes from a Wx columns are locking other columns.

    // Possible improvements:
    // - W1 W2 W3  resize W1|               --> to not be stuck, both W2 and W3 would stretch down. Seems possible to fix. Would be most beneficial to simplify resize of all-weighted columns.
    // - W3 F1 F2  resize W3|               --> to not be stuck past F1|, both F1 and F2 would need to stretch down, which would be lossy or ambiguous. Seems hard to fix.

    // [Resize Rule 1] Can't resize from right of right-most visible column if there is any Stretch column. Implemented in TableUpdateLayout().

    // If we have all Fixed columns OR resizing a Fixed column that doesn't come after a Stretch one, we can do an offsetting resize.
    // This is the preferred resize path
    if (column_0->Flags & ImGuiTableColumnFlags_WidthFixed)
        if (!column_1 || table->LeftMostStretchedColumn == -1 || table->Columns[table->LeftMostStretchedColumn].DisplayOrder >= column_0->DisplayOrder)
        {
            column_0->WidthRequest = column_0_width;
            table->IsSettingsDirty = true;
            return;
        }

    // We can also use previous column if there's no next one (this is used when doing an auto-fit on the right-most stretch column)
    if (column_1 == NULL)
        column_1 = (column_0->PrevEnabledColumn != -1) ? &table->Columns[column_0->PrevEnabledColumn] : NULL;
    if (column_1 == NULL)
        return;

    // Resizing from right-side of a Stretch column before a Fixed column forward sizing to left-side of fixed column.
    // (old_a + old_b == new_a + new_b) --> (new_a == old_a + old_b - new_b)
    float column_1_width = ImMax(column_1->WidthRequest - (column_0_width - column_0->WidthRequest), min_width);
    column_0_width = column_0->WidthRequest + column_1->WidthRequest - column_1_width;
    IM_ASSERT(column_0_width > 0.0f && column_1_width > 0.0f);
    column_0->WidthRequest = column_0_width;
    column_1->WidthRequest = column_1_width;
    if ((column_0->Flags | column_1->Flags) & ImGuiTableColumnFlags_WidthStretch)
        TableUpdateColumnsWeightFromWidth(table);
    table->IsSettingsDirty = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0x74bf9(%rip), %rax     # 0xfdcd0
movq (%rax), %rax
movq 0x20a8(%rax), %rbx
testq %rbx, %rbx
je 0x8929e
cmpb $0x0, 0x248(%rbx)
jne 0x8929e
movl %edi, %esi
testl %edi, %edi
js 0x892bd
cmpl %esi, 0x6c(%rbx)
jle 0x892bd
movl %esi, %eax
imulq $0x68, %rax, %r14
addq 0x10(%rbx), %r14
cmpq 0x18(%rbx), %r14
jae 0x892dc
movaps %xmm0, -0x20(%rbp)
movss 0xb4(%rbx), %xmm1
xorps %xmm0, %xmm0
movaps %xmm1, -0x30(%rbp)
ucomiss %xmm0, %xmm1
jbe 0x892fb
movq %rbx, %rdi
callq 0x8a415
movaps %xmm0, %xmm1
movaps -0x30(%rbp), %xmm5
cmpless %xmm5, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm5, %xmm1
orps %xmm2, %xmm1
movaps -0x20(%rbp), %xmm4
minss %xmm4, %xmm1
cmpltss %xmm5, %xmm4
movaps %xmm4, %xmm0
andnps %xmm1, %xmm0
andps %xmm5, %xmm4
orps %xmm0, %xmm4
movss 0x4(%r14), %xmm0
ucomiss %xmm4, %xmm0
jne 0x89184
jnp 0x89295
movss 0x10(%r14), %xmm0
ucomiss %xmm4, %xmm0
jne 0x89195
jnp 0x89295
movsbq 0x55(%r14), %rax
cmpq $-0x1, %rax
je 0x891bb
testb %al, %al
js 0x892dc
imulq $0x68, %rax, %rax
addq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jb 0x891bd
jmp 0x892dc
xorl %eax, %eax
testb $0x8, (%r14)
jne 0x891e9
testq %rax, %rax
jne 0x89229
movsbl 0x54(%r14), %esi
cmpl $-0x1, %esi
je 0x89227
leaq 0x10(%rbx), %rdi
movaps %xmm4, -0x20(%rbp)
callq 0x91766
movaps -0x30(%rbp), %xmm5
movaps -0x20(%rbp), %xmm4
jmp 0x89229
testq %rax, %rax
je 0x8921f
movsbq 0x23c(%rbx), %rcx
cmpq $-0x1, %rcx
je 0x8921f
testb %cl, %cl
js 0x892dc
imulq $0x68, %rcx, %rcx
addq 0x10(%rbx), %rcx
cmpq 0x18(%rbx), %rcx
jae 0x892dc
movb 0x52(%rcx), %cl
cmpb 0x52(%r14), %cl
jl 0x891c3
movss %xmm4, 0x10(%r14)
jmp 0x8928e
xorl %eax, %eax
testq %rax, %rax
je 0x89295
movss 0x10(%rax), %xmm0
movss 0x10(%r14), %xmm2
subss %xmm2, %xmm4
movaps %xmm0, %xmm3
subss %xmm4, %xmm3
movaps %xmm5, %xmm1
cmpless %xmm3, %xmm1
andps %xmm1, %xmm3
andnps %xmm5, %xmm1
orps %xmm3, %xmm1
xorps %xmm3, %xmm3
ucomiss %xmm3, %xmm1
jbe 0x8931a
addss %xmm2, %xmm0
subss %xmm1, %xmm0
ucomiss %xmm3, %xmm0
jbe 0x8931a
movss %xmm0, 0x10(%r14)
movss %xmm1, 0x10(%rax)
movl (%rax), %eax
orl (%r14), %eax
testb $0x4, %al
je 0x8928e
movq %rbx, %rdi
callq 0x8dae4
movb $0x1, 0x24f(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x48691(%rip), %rdi     # 0xd1936
leaq 0x47c0e(%rip), %rsi     # 0xd0eba
leaq 0x486b5(%rip), %rcx     # 0xd1968
movl $0x7ad, %edx            # imm = 0x7AD
callq 0xc140
leaq 0x48460(%rip), %rdi     # 0xd1724
leaq 0x47bef(%rip), %rsi     # 0xd0eba
leaq 0x48696(%rip), %rcx     # 0xd1968
movl $0x7ae, %edx            # imm = 0x7AE
callq 0xc140
leaq 0x333d5(%rip), %rdi     # 0xbc6b8
leaq 0x32355(%rip), %rsi     # 0xbb63f
leaq 0x333e0(%rip), %rcx     # 0xbc6d1
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x48692(%rip), %rdi     # 0xd1994
leaq 0x47bb1(%rip), %rsi     # 0xd0eba
leaq 0x48658(%rip), %rcx     # 0xd1968
movl $0x7b4, %edx            # imm = 0x7B4
callq 0xc140
leaq 0x48690(%rip), %rdi     # 0xd19b1
leaq 0x47b92(%rip), %rsi     # 0xd0eba
leaq 0x48639(%rip), %rcx     # 0xd1968
movl $0x7f2, %edx            # imm = 0x7F2
callq 0xc140