// File: /workspace/github_cpp_makefile_star2_O2/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 0x6e620(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movq 0x20a8(%rax), %rbx
movl 0x4(%rbx), %r15d
movl %r15d, %eax
andl $0x8000000, %eax        # imm = 0x8000000
orl %esi, %eax
je 0x757bd
movl %edi, %r13d
movl %esi, -0x30(%rbp)
shrl $0x1a, %r15d
andl %edx, %r15d
xorl %r14d, %r14d
testb %r15b, %r15b
je 0x7572d
movl %r15d, -0x2c(%rbp)
leaq 0x10(%rbx), %r12
xorl %r15d, %r15d
cmpl 0x6c(%rbx), %r14d
jge 0x75723
movq %r12, %rdi
movl %r14d, %esi
callq 0x4c4c6
movzbl 0x56(%rax), %eax
cmpb %al, %r15b
movzbl %r15b, %r15d
cmovlel %eax, %r15d
incl %r14d
jmp 0x756fe
incb %r15b
movl %r15d, %r14d
movl -0x2c(%rbp), %r15d
leaq 0x10(%rbx), %r12
movq %r12, %rdi
movl %r13d, %esi
callq 0x4c4c6
movq %rax, %r13
movb 0x64(%rax), %al
movl -0x30(%rbp), %edx
movl %edx, %ecx
andb $0x3, %cl
andb $-0x4, %al
orb %cl, %al
movb %al, 0x64(%r13)
testb $0x3, %dl
je 0x75766
cmpb $-0x1, 0x56(%r13)
setne %al
testb %al, %r15b
je 0x75769
jmp 0x7576d
movb $-0x1, %r14b
movb %r14b, 0x56(%r13)
xorl %r14d, %r14d
cmpl 0x6c(%rbx), %r14d
jge 0x757a0
movq %r12, %rdi
movl %r14d, %esi
callq 0x4c4c6
cmpq %r13, %rax
sete %cl
orb %r15b, %cl
jne 0x75790
movb $-0x1, 0x56(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7557d
incl %r14d
jmp 0x75770
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 0x417c5(%rip), %rdi     # 0xb6f89
leaq 0x4093b(%rip), %rsi     # 0xb6106
leaq 0x417e1(%rip), %rcx     # 0xb6fb3
movl $0x9f8, %edx            # imm = 0x9F8
callq 0xc140