// File: Ciaxur[P]yagb-emu/include/imgui/imgui_demo.cpp
// Function: (anonymous namespace)::MyItem::CompareWithSortSpecs(void const*, void const*)
CompareWithSortSpecs(const void* lhs, const void* rhs)
    {
        const MyItem* a = (const MyItem*)lhs;
        const MyItem* b = (const MyItem*)rhs;
        for (int n = 0; n < s_current_sort_specs->SpecsCount; n++)
        {
            // Here we identify columns using the ColumnUserID value that we ourselves passed to TableSetupColumn()
            // We could also choose to identify columns based on their index (sort_spec->ColumnIndex), which is simpler!
            const ImGuiTableColumnSortSpecs* sort_spec = &s_current_sort_specs->Specs[n];
            int delta = 0;
            switch (sort_spec->ColumnUserID)
            {
            case MyItemColumnID_ID:             delta = (a->ID - b->ID);                break;
            case MyItemColumnID_Name:           delta = (strcmp(a->Name, b->Name));     break;
            case MyItemColumnID_Quantity:       delta = (a->Quantity - b->Quantity);    break;
            case MyItemColumnID_Description:    delta = (strcmp(a->Name, b->Name));     break;
            default: IM_ASSERT(0); break;
            }
            if (delta > 0)
                return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? +1 : -1;
            if (delta < 0)
                return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? -1 : +1;
        }

        // qsort() is instable so always return a way to differenciate items.
        // Your own compare function may want to avoid fallback on implicit sort specs e.g. a Name compare if it wasn't already part of the sort specs.
        return (a->ID - b->ID);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq 0x10beff(%rip), %rcx    # 0x213ee0
cmpl 0x8(%rcx), %eax
jge 0x1080fc
movq 0x10beef(%rip), %rax    # 0x213ee0
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x48(%rbp)
subq $0x4, %rax
ja 0x108087
movq -0x48(%rbp), %rax
leaq 0x70662(%rip), %rcx     # 0x178688
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x3c(%rbp)
jmp 0x1080a6
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xd7e0
movl %eax, -0x3c(%rbp)
jmp 0x1080a6
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x3c(%rbp)
jmp 0x1080a6
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xd7e0
movl %eax, -0x3c(%rbp)
jmp 0x1080a6
leaq 0x6d07c(%rip), %rdi     # 0x17510a
leaq 0x70b67(%rip), %rsi     # 0x178bfc
movl $0xd00, %edx            # imm = 0xD00
leaq 0x799e0(%rip), %rcx     # 0x181a81
callq 0xd180
cmpl $0x0, -0x3c(%rbp)
jle 0x1080c9
movq -0x38(%rbp), %rax
movsbl 0x8(%rax), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x10810b
cmpl $0x0, -0x3c(%rbp)
jge 0x1080ec
movq -0x38(%rbp), %rax
movsbl 0x8(%rax), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x10810b
jmp 0x1080ee
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x107fd7
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)