// File: /workspace/github_cpp_makefile_star2_O1/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 0x6fd49(%rip), %rax     # 0xfdcd0
movq (%rax), %rax
movq 0x20a8(%rax), %rbx
movl 0x4(%rbx), %r14d
movl %r14d, %eax
andl $0x8000000, %eax        # imm = 0x8000000
orl %esi, %eax
je 0x8e0bb
shrl $0x1a, %r14d
andl %edx, %r14d
testb %r14b, %r14b
je 0x8dfec
movslq 0x6c(%rbx), %rcx
testq %rcx, %rcx
jle 0x8dff0
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %r8
xorl %eax, %eax
cmpq %r8, %rdx
jae 0x8e09c
movzbl %al, %eax
movzbl 0x56(%rdx), %r9d
cmpb %r9b, %al
cmovgl %eax, %r9d
movl %r9d, %eax
addq $0x68, %rdx
decq %rcx
jne 0x8dfc4
incb %al
jmp 0x8dff2
xorl %eax, %eax
jmp 0x8dff2
movb $0x1, %al
testl %edi, %edi
js 0x8e09c
movslq %edi, %rcx
imulq $0x68, %rcx, %r15
addq 0x10(%rbx), %r15
cmpq 0x18(%rbx), %r15
jae 0x8e09c
movb 0x64(%r15), %cl
movl %esi, %edx
andb $0x3, %dl
andb $-0x4, %cl
orb %dl, %cl
movb %cl, 0x64(%r15)
testb $0x3, %sil
je 0x8e036
cmpb $-0x1, 0x56(%r15)
setne %cl
testb %cl, %r14b
je 0x8e038
jmp 0x8e03c
movb $-0x1, %al
movb %al, 0x56(%r15)
cmpl $0x0, 0x6c(%rbx)
jle 0x8e07f
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%rbx), %rax
leaq (%rax,%r12), %rsi
cmpq 0x18(%rbx), %rsi
jae 0x8e09c
cmpq %r15, %rsi
sete %cl
orb %r14b, %cl
jne 0x8e067
movb $-0x1, 0x56(%rax,%r12)
movq %rbx, %rdi
callq 0x8de3b
incq %r13
movslq 0x6c(%rbx), %rax
addq $0x68, %r12
cmpq %rax, %r13
jl 0x8e048
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 0x2e615(%rip), %rdi     # 0xbc6b8
leaq 0x2d595(%rip), %rsi     # 0xbb63f
leaq 0x2e620(%rip), %rcx     # 0xbc6d1
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x43c7b(%rip), %rdi     # 0xd1d3d
leaq 0x42df1(%rip), %rsi     # 0xd0eba
leaq 0x43c97(%rip), %rcx     # 0xd1d67
movl $0x9f8, %edx            # imm = 0x9F8
callq 0xc140