// File: /workspace/github_cpp_makefile_star2_O3/jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive*)
static void mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive *pZip)
{
    mz_zip_internal_state *pState = pZip->m_pState;
    const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets;
    const mz_zip_array *pCentral_dir = &pState->m_central_dir;
    mz_uint32 *pIndices;
    mz_uint32 start, end;
    const mz_uint32 size = pZip->m_total_files;

    if (size <= 1U)
        return;

    pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0);

    start = (size - 2U) >> 1U;
    for (;;)
    {
        mz_uint64 child, root = start;
        for (;;)
        {
            if ((child = (root << 1U) + 1U) >= size)
                break;
            child += (((child + 1U) < size) && (mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1U])));
            if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child]))
                break;
            MZ_SWAP_UINT32(pIndices[root], pIndices[child]);
            root = child;
        }
        if (!start)
            break;
        start--;
    }

    end = size - 1;
    while (end > 0)
    {
        mz_uint64 child, root = 0;
        MZ_SWAP_UINT32(pIndices[end], pIndices[0]);
        for (;;)
        {
            if ((child = (root << 1U) + 1U) >= end)
                break;
            child += (((child + 1U) < end) && mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1U]));
            if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child]))
                break;
            MZ_SWAP_UINT32(pIndices[root], pIndices[child]);
            root = child;
        }
        end--;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, -0x40(%rbp)
cmpl $0x2, %edi
jb 0xfd58
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
leal -0x2(%rdi), %eax
movq %rdi, -0x48(%rbp)
movl %edi, %esi
shrl %eax
movq %rsi, -0x58(%rbp)
movq %rax, -0x50(%rbp)
leaq 0x1(,%rax,2), %r11
cmpq %rsi, %r11
jae 0xfb66
movq -0x50(%rbp), %r10
leaq (%r10,%r10), %rcx
movq -0x40(%rbp), %rax
movq (%rax), %r8
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
leaq 0x2(%rcx), %rdx
cmpq %rsi, %rdx
jae 0xfa67
movq -0x30(%rbp), %rax
movl (%rax,%r11,4), %edx
movl 0x8(%rax,%rcx,4), %ecx
movq -0x38(%rbp), %rax
movl (%rax,%rdx,4), %edx
movl (%rax,%rcx,4), %ecx
leaq (%r8,%rdx), %rbx
addq $0x2e, %rbx
movzwl -0x12(%rbx), %r14d
movzwl 0x1c(%r8,%rcx), %r15d
cmpw %r15w, %r14w
movl %r15d, %esi
cmovbl %r14d, %esi
addq %r8, %rdx
movzwl %si, %esi
leaq (%rsi,%rdx), %r12
addq $0x2e, %r12
testw %si, %si
je 0xfa6b
addq %r8, %rcx
addq $0x2e, %rcx
movzbl (%rbx), %edx
leal -0x41(%rdx), %esi
leal 0x20(%rdx), %edi
cmpb $0x1a, %sil
movzbl %dil, %esi
cmovael %edx, %esi
movzbl (%rcx), %edi
leal -0x41(%rdi), %edx
leal 0x20(%rdi), %r13d
cmpb $0x1a, %dl
movzbl %r13b, %edx
cmovael %edi, %edx
cmpb %dl, %sil
jne 0xfa6f
incq %rbx
incq %rcx
movl %esi, %edx
cmpq %r12, %rbx
jb 0xfa2b
jmp 0xfa6f
xorl %ebx, %ebx
jmp 0xfa8b
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
cmpw %r15w, %r14w
setb %cl
xorl %edi, %edi
cmpb %dl, %sil
setb %dil
cmpq %r12, %rbx
cmovel %ecx, %edi
movzbl %dil, %ebx
addq %r11, %rbx
movq -0x30(%rbp), %rax
movl (%rax,%r10,4), %r11d
movl (%rax,%rbx,4), %r14d
movq -0x38(%rbp), %rax
movl (%rax,%r11,4), %ecx
movl (%rax,%r14,4), %esi
leaq (%r8,%rcx), %r15
addq $0x2e, %r15
movzwl -0x12(%r15), %r12d
movzwl 0x1c(%r8,%rsi), %r13d
cmpw %r13w, %r12w
movl %r13d, %edx
cmovbl %r12d, %edx
addq %r8, %rcx
movzwl %dx, %edx
addq %rdx, %rcx
addq $0x2e, %rcx
testw %dx, %dx
je 0xfb1d
addq %r8, %rsi
addq $0x2e, %rsi
movzbl (%r15), %edx
leal -0x41(%rdx), %edi
leal 0x20(%rdx), %r9d
cmpb $0x1a, %dil
movzbl %r9b, %edi
cmovael %edx, %edi
movzbl (%rsi), %r9d
leal -0x41(%r9), %edx
leal 0x20(%r9), %eax
cmpb $0x1a, %dl
movzbl %al, %edx
cmovael %r9d, %edx
cmpb %dl, %dil
jne 0xfb21
incq %r15
incq %rsi
movl %edi, %edx
cmpq %rcx, %r15
jb 0xfadd
jmp 0xfb21
xorl %edi, %edi
xorl %edx, %edx
xorl %eax, %eax
cmpw %r13w, %r12w
setae %al
xorl %esi, %esi
cmpb %dl, %dil
setae %sil
cmpq %rcx, %r15
cmovel %eax, %esi
testb %sil, %sil
movq -0x58(%rbp), %rsi
jne 0xfb66
movq -0x30(%rbp), %rax
movl %r14d, (%rax,%r10,4)
movl %r11d, (%rax,%rbx,4)
leaq (%rbx,%rbx), %rcx
leaq 0x1(,%rbx,2), %r11
movq %rbx, %r10
cmpq %rsi, %r11
jb 0xf9d0
movq -0x50(%rbp), %rax
subq $0x1, %rax
jae 0xf9a4
movq -0x48(%rbp), %rcx
decl %ecx
movq -0x30(%rbp), %rdx
movl (%rdx,%rcx,4), %esi
movl (%rdx), %eax
movl %eax, (%rdx,%rcx,4)
movq %rsi, -0x38(%rbp)
movl %esi, (%rdx)
cmpq $0x2, %rcx
jb 0xfd4d
movq -0x40(%rbp), %rax
movq (%rax), %rdx
movq 0x20(%rax), %r8
movl $0x1, %r10d
xorl %esi, %esi
xorl %r9d, %r9d
movq %rcx, -0x48(%rbp)
leaq 0x2(%rsi), %rax
cmpq %rcx, %rax
jae 0xfc4b
movq -0x30(%rbp), %rcx
movl (%rcx,%r10,4), %eax
movl 0x8(%rcx,%rsi,4), %esi
movl (%r8,%rax,4), %eax
movl (%r8,%rsi,4), %r15d
leaq (%rdx,%rax), %r11
addq $0x2e, %r11
movzwl -0x12(%r11), %ebx
movzwl 0x1c(%rdx,%r15), %r14d
cmpw %r14w, %bx
movl %r14d, %esi
cmovbl %ebx, %esi
addq %rdx, %rax
movzwl %si, %edi
leaq (%rdi,%rax), %rsi
addq $0x2e, %rsi
testw %di, %di
je 0xfc50
addq %rdx, %r15
addq $0x2e, %r15
movzbl (%r11), %eax
leal -0x41(%rax), %edi
leal 0x20(%rax), %r12d
cmpb $0x1a, %dil
movzbl %r12b, %edi
cmovael %eax, %edi
movzbl (%r15), %eax
leal -0x41(%rax), %r12d
leal 0x20(%rax), %r13d
cmpb $0x1a, %r12b
movzbl %r13b, %r12d
cmovael %eax, %r12d
cmpb %r12b, %dil
jne 0xfc55
incq %r11
incq %r15
movl %edi, %r12d
cmpq %rsi, %r11
jb 0xfc08
jmp 0xfc55
xorl %r11d, %r11d
jmp 0xfc70
xorl %edi, %edi
xorl %r12d, %r12d
xorl %eax, %eax
cmpw %r14w, %bx
setb %al
xorl %ebx, %ebx
cmpb %r12b, %dil
setb %bl
cmpq %rsi, %r11
cmovel %eax, %ebx
movzbl %bl, %r11d
addq %r10, %r11
movq -0x30(%rbp), %rax
movl (%rax,%r11,4), %r10d
movq -0x38(%rbp), %rax
movl (%r8,%rax,4), %eax
movl (%r8,%r10,4), %r12d
leaq (%rdx,%rax), %rbx
addq $0x2e, %rbx
movzwl -0x12(%rbx), %r14d
movzwl 0x1c(%rdx,%r12), %r15d
cmpw %r15w, %r14w
movl %r15d, %esi
cmovbl %r14d, %esi
addq %rdx, %rax
movzwl %si, %edi
leaq (%rdi,%rax), %rsi
addq $0x2e, %rsi
testw %di, %di
je 0xfd01
addq %rdx, %r12
addq $0x2e, %r12
movzbl (%rbx), %eax
leal -0x41(%rax), %edi
leal 0x20(%rax), %r13d
cmpb $0x1a, %dil
movzbl %r13b, %edi
cmovael %eax, %edi
movzbl (%r12), %eax
leal -0x41(%rax), %r13d
leal 0x20(%rax), %ecx
cmpb $0x1a, %r13b
movzbl %cl, %r13d
cmovael %eax, %r13d
cmpb %r13b, %dil
jne 0xfd06
incq %rbx
incq %r12
movl %edi, %r13d
cmpq %rsi, %rbx
jb 0xfcbf
jmp 0xfd06
xorl %edi, %edi
xorl %r13d, %r13d
xorl %eax, %eax
cmpw %r15w, %r14w
setae %al
xorl %ecx, %ecx
cmpb %r13b, %dil
setae %cl
cmpq %rsi, %rbx
cmovel %eax, %ecx
testb %cl, %cl
movq -0x48(%rbp), %rcx
jne 0xfd4d
movq -0x30(%rbp), %rax
movl %r10d, (%rax,%r9,4)
movq -0x38(%rbp), %rsi
movl %esi, (%rax,%r11,4)
leaq (%r11,%r11), %rsi
leaq 0x1(,%r11,2), %r10
movq %r11, %r9
cmpq %rcx, %r10
jb 0xfbb0
decq %rcx
testl %ecx, %ecx
jne 0xfb7a
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq