// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableSetColumnSortDirection(int, int, bool)
void ImGui::TableSetColumnSortDirection(int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs)
{
    ImGuiContext& g = *GImGui;
    ImGuiTable* table = g.CurrentTable;

    if (!(table->Flags & ImGuiTableFlags_SortMulti))
        append_to_sort_specs = false;
    if (!(table->Flags & ImGuiTableFlags_SortTristate))
        IM_ASSERT(sort_direction != ImGuiSortDirection_None);

    ImGuiTableColumnIdx sort_order_max = 0;
    if (append_to_sort_specs)
        for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
            sort_order_max = ImMax(sort_order_max, table->Columns[other_column_n].SortOrder);

    ImGuiTableColumn* column = &table->Columns[column_n];
    column->SortDirection = (ImU8)sort_direction;
    if (column->SortDirection == ImGuiSortDirection_None)
        column->SortOrder = -1;
    else if (column->SortOrder == -1 || !append_to_sort_specs)
        column->SortOrder = append_to_sort_specs ? sort_order_max + 1 : 0;

    for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
    {
        ImGuiTableColumn* other_column = &table->Columns[other_column_n];
        if (other_column != column && !append_to_sort_specs)
            other_column->SortOrder = -1;
        TableFixColumnSortDirection(table, other_column);
    }
    table->IsSettingsDirty = true;
    table->IsSortSpecsDirty = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x6fa57(%rip), %rax     # 0xfbcd0
movq (%rax), %rax
movq 0x20a8(%rax), %rbx
movl 0x4(%rbx), %r14d
movl %r14d, %eax
andl $0x8000000, %eax        # imm = 0x8000000
orl %esi, %eax
je 0x8c3ad
shrl $0x1a, %r14d
andl %edx, %r14d
testb %r14b, %r14b
je 0x8c2de
movslq 0x6c(%rbx), %rcx
testq %rcx, %rcx
jle 0x8c2e2
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %r8
xorl %eax, %eax
cmpq %r8, %rdx
jae 0x8c38e
movzbl %al, %eax
movzbl 0x56(%rdx), %r9d
cmpb %r9b, %al
cmovgl %eax, %r9d
movl %r9d, %eax
addq $0x68, %rdx
decq %rcx
jne 0x8c2b6
incb %al
jmp 0x8c2e4
xorl %eax, %eax
jmp 0x8c2e4
movb $0x1, %al
testl %edi, %edi
js 0x8c38e
movslq %edi, %rcx
imulq $0x68, %rcx, %r15
addq 0x10(%rbx), %r15
cmpq 0x18(%rbx), %r15
jae 0x8c38e
movb 0x64(%r15), %cl
movl %esi, %edx
andb $0x3, %dl
andb $-0x4, %cl
orb %dl, %cl
movb %cl, 0x64(%r15)
testb $0x3, %sil
je 0x8c328
cmpb $-0x1, 0x56(%r15)
setne %cl
testb %cl, %r14b
je 0x8c32a
jmp 0x8c32e
movb $-0x1, %al
movb %al, 0x56(%r15)
cmpl $0x0, 0x6c(%rbx)
jle 0x8c371
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%rbx), %rax
leaq (%rax,%r12), %rsi
cmpq 0x18(%rbx), %rsi
jae 0x8c38e
cmpq %r15, %rsi
sete %cl
orb %r14b, %cl
jne 0x8c359
movb $-0x1, 0x56(%rax,%r12)
movq %rbx, %rdi
callq 0x8c147
incq %r13
movslq 0x6c(%rbx), %rax
addq $0x68, %r12
cmpq %rax, %r13
jl 0x8c33a
movb $0x1, %al
movb %al, 0x24f(%rbx)
movb %al, 0x24b(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e323(%rip), %rdi     # 0xba6b8
leaq 0x2d2a3(%rip), %rsi     # 0xb963f
leaq 0x2e32e(%rip), %rcx     # 0xba6d1
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x43959(%rip), %rdi     # 0xcfd0d
leaq 0x42acf(%rip), %rsi     # 0xcee8a
leaq 0x43975(%rip), %rcx     # 0xcfd37
movl $0x9f8, %edx            # imm = 0x9F8
callq 0xc140