// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
leaq 0x72c57(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movq 0x20a8(%rax), %rbx
testq %rbx, %rbx
je 0x7124a
cmpb $0x0, 0x248(%rbx)
jne 0x7124a
movl %edi, %r12d
movaps %xmm0, -0x30(%rbp)
testl %edi, %edi
js 0x71269
cmpl %r12d, 0x6c(%rbx)
jle 0x71269
leaq 0x10(%rbx), %r15
movq %r15, %rdi
movl %r12d, %esi
callq 0x4c4c6
movss 0xb4(%rbx), %xmm1
xorps %xmm0, %xmm0
movaps %xmm1, -0x40(%rbp)
ucomiss %xmm0, %xmm1
jbe 0x71288
movq %rax, %r14
movq %rbx, %rdi
movl %r12d, %esi
callq 0x7233c
movaps %xmm0, %xmm1
movaps -0x40(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movaps -0x30(%rbp), %xmm4
minss %xmm4, %xmm1
cmpltss %xmm3, %xmm4
movaps %xmm4, %xmm0
andnps %xmm1, %xmm0
andps %xmm3, %xmm4
orps %xmm0, %xmm4
movss 0x4(%r14), %xmm0
ucomiss %xmm4, %xmm0
jne 0x71139
jnp 0x7123d
movss 0x10(%r14), %xmm0
ucomiss %xmm4, %xmm0
jne 0x7114a
jnp 0x7123d
movsbl 0x55(%r14), %esi
cmpl $-0x1, %esi
movaps %xmm4, -0x30(%rbp)
je 0x71169
movq %r15, %rdi
callq 0x4c4c6
movaps -0x30(%rbp), %xmm4
movq %rax, %r12
jmp 0x7116c
xorl %r12d, %r12d
testb $0x8, (%r14)
jne 0x71196
testq %r12, %r12
jne 0x711c4
movsbl 0x54(%r14), %esi
cmpl $-0x1, %esi
je 0x7123d
movq %r15, %rdi
callq 0x4c4c6
movaps -0x30(%rbp), %xmm4
movq %rax, %r12
jmp 0x711c4
testq %r12, %r12
je 0x71230
movsbl 0x23c(%rbx), %esi
cmpl $-0x1, %esi
je 0x71230
movq %r15, %rdi
callq 0x4c4c6
movaps -0x30(%rbp), %xmm4
movb 0x52(%rax), %al
cmpb 0x52(%r14), %al
jge 0x71230
movss 0x10(%r12), %xmm0
movss 0x10(%r14), %xmm2
subss %xmm2, %xmm4
movaps %xmm0, %xmm3
subss %xmm4, %xmm3
movaps -0x40(%rbp), %xmm4
movaps %xmm4, %xmm1
cmpless %xmm3, %xmm1
andps %xmm1, %xmm3
andnps %xmm4, %xmm1
orps %xmm3, %xmm1
xorps %xmm3, %xmm3
ucomiss %xmm3, %xmm1
jbe 0x712a7
addss %xmm2, %xmm0
subss %xmm1, %xmm0
ucomiss %xmm3, %xmm0
jbe 0x712a7
movss %xmm0, 0x10(%r14)
movss %xmm1, 0x10(%r12)
movl (%r12), %eax
orl (%r14), %eax
testb $0x4, %al
je 0x71236
movq %rbx, %rdi
callq 0x75284
jmp 0x71236
movss %xmm4, 0x10(%r14)
movb $0x1, 0x24f(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x45931(%rip), %rdi     # 0xb6b82
leaq 0x44eae(%rip), %rsi     # 0xb6106
leaq 0x45955(%rip), %rcx     # 0xb6bb4
movl $0x7ad, %edx            # imm = 0x7AD
callq 0xc140
leaq 0x45700(%rip), %rdi     # 0xb6970
leaq 0x44e8f(%rip), %rsi     # 0xb6106
leaq 0x45936(%rip), %rcx     # 0xb6bb4
movl $0x7ae, %edx            # imm = 0x7AE
callq 0xc140
leaq 0x45951(%rip), %rdi     # 0xb6be0
leaq 0x44e70(%rip), %rsi     # 0xb6106
leaq 0x45917(%rip), %rcx     # 0xb6bb4
movl $0x7b4, %edx            # imm = 0x7B4
callq 0xc140
leaq 0x4594f(%rip), %rdi     # 0xb6bfd
leaq 0x44e51(%rip), %rsi     # 0xb6106
leaq 0x458f8(%rip), %rcx     # 0xb6bb4
movl $0x7f2, %edx            # imm = 0x7F2
callq 0xc140