// File: /workspace/github_cpp_makefile_star2_O1/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:
movl 0x10(%rdi), %esi
cmpq $0x2, %rsi
jb 0xffe3
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x68(%rdi), %rax
movq %rax, -0x30(%rbp)
movq 0x40(%rax), %rcx
leal -0x2(%rsi), %eax
shrl %eax
movq %rsi, -0x38(%rbp)
movl %eax, %eax
movq %rax, -0x50(%rbp)
leaq 0x1(,%rax,2), %r11
cmpq %rsi, %r11
jae 0xfdda
movq -0x50(%rbp), %r10
leaq (%r10,%r10), %rax
movq -0x30(%rbp), %rdx
movq (%rdx), %r8
movq 0x20(%rdx), %rdx
movq %rdx, -0x40(%rbp)
movq %r8, -0x48(%rbp)
leaq 0x2(%rax), %rdx
cmpq %rsi, %rdx
jae 0xfce0
movl (%rcx,%r11,4), %edx
movl 0x8(%rcx,%rax,4), %eax
movq -0x30(%rbp), %rdi
movq (%rdi), %rsi
movq 0x20(%rdi), %rdi
movl (%rdi,%rdx,4), %edx
movl (%rdi,%rax,4), %eax
leaq (%rsi,%rdx), %rbx
addq $0x2e, %rbx
movzwl -0x12(%rbx), %r14d
movzwl 0x1c(%rsi,%rax), %r15d
cmpw %r15w, %r14w
movl %r15d, %edi
cmovbl %r14d, %edi
addq %rsi, %rdx
movzwl %di, %edi
leaq (%rdi,%rdx), %r12
addq $0x2e, %r12
testw %di, %di
je 0xfce4
addq %rax, %rsi
addq $0x2e, %rsi
movzbl (%rbx), %eax
leal -0x41(%rax), %edx
leal 0x20(%rax), %edi
cmpb $0x1a, %dl
movzbl %dil, %edi
cmovael %eax, %edi
movzbl (%rsi), %edx
leal -0x41(%rdx), %eax
leal 0x20(%rdx), %r13d
cmpb $0x1a, %al
movzbl %r13b, %eax
cmovael %edx, %eax
cmpb %al, %dil
jne 0xfce8
incq %rbx
incq %rsi
cmpq %r12, %rbx
jb 0xfca8
jmp 0xfce8
xorl %ebx, %ebx
jmp 0xfd04
xorl %edi, %edi
xorl %eax, %eax
xorl %edx, %edx
cmpw %r15w, %r14w
setb %dl
xorl %esi, %esi
cmpb %al, %dil
setb %sil
cmpq %r12, %rbx
cmovel %edx, %esi
movzbl %sil, %ebx
addq %r11, %rbx
movl (%rcx,%r10,4), %r11d
movl (%rcx,%rbx,4), %r14d
movq -0x40(%rbp), %rdx
movl (%rdx,%r11,4), %eax
movl (%rdx,%r14,4), %edi
leaq (%r8,%rax), %r15
addq $0x2e, %r15
movzwl -0x12(%r15), %r12d
movzwl 0x1c(%r8,%rdi), %r13d
cmpw %r13w, %r12w
movl %r13d, %edx
cmovbl %r12d, %edx
addq %r8, %rax
movzwl %dx, %edx
leaq (%rdx,%rax), %rsi
addq $0x2e, %rsi
testw %dx, %dx
je 0xfd8f
addq %r8, %rdi
addq $0x2e, %rdi
movzbl (%r15), %edx
leal -0x41(%rdx), %eax
leal 0x20(%rdx), %r9d
cmpb $0x1a, %al
movzbl %r9b, %eax
cmovael %edx, %eax
movzbl (%rdi), %r9d
leal -0x41(%r9), %edx
leal 0x20(%r9), %r8d
cmpb $0x1a, %dl
movzbl %r8b, %edx
cmovael %r9d, %edx
cmpb %dl, %al
jne 0xfd93
incq %r15
incq %rdi
cmpq %rsi, %r15
jb 0xfd53
jmp 0xfd93
xorl %eax, %eax
xorl %edx, %edx
xorl %edi, %edi
cmpw %r13w, %r12w
setae %dil
xorl %r8d, %r8d
cmpb %dl, %al
setae %r8b
cmpq %rsi, %r15
cmovel %edi, %r8d
testb %r8b, %r8b
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %r8
jne 0xfdda
movl %r14d, (%rcx,%r10,4)
movl %r11d, (%rcx,%rbx,4)
leaq (%rbx,%rbx), %rax
leaq 0x1(,%rbx,2), %r11
movq %rbx, %r10
cmpq %rsi, %r11
jb 0xfc4a
movq -0x50(%rbp), %rdi
movl %edi, %eax
subl $0x1, %eax
movl $0x0, %edx
cmovbl %edx, %eax
testq %rdi, %rdi
jne 0xfc18
decl %esi
je 0xffd9
movl %esi, %edx
movl (%rcx,%rdx,4), %eax
movl (%rcx), %esi
movl %esi, (%rcx,%rdx,4)
movl %eax, (%rcx)
cmpq $0x2, %rdx
jb 0xffce
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x1, %r9d
xorl %eax, %eax
xorl %r8d, %r8d
movq %rsi, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
leaq 0x2(%rax), %rdi
cmpq %rdx, %rdi
jae 0xfed4
movl (%rcx,%r9,4), %edi
movl 0x8(%rcx,%rax,4), %eax
movq -0x30(%rbp), %rdx
movq (%rdx), %r15
movq 0x20(%rdx), %r10
movl (%r10,%rdi,4), %edi
movl (%r10,%rax,4), %eax
leaq (%r15,%rdi), %r10
addq $0x2e, %r10
movzwl -0x12(%r10), %r11d
movzwl 0x1c(%r15,%rax), %ebx
cmpw %bx, %r11w
movl %ebx, %r14d
cmovbl %r11d, %r14d
addq %r15, %rdi
movzwl %r14w, %r12d
leaq (%r12,%rdi), %r14
addq $0x2e, %r14
testw %r12w, %r12w
je 0xfed9
addq %rax, %r15
addq $0x2e, %r15
movzbl (%r10), %edi
leal -0x41(%rdi), %eax
leal 0x20(%rdi), %r12d
cmpb $0x1a, %al
movzbl %r12b, %eax
cmovael %edi, %eax
movzbl (%r15), %edi
leal -0x41(%rdi), %r12d
leal 0x20(%rdi), %r13d
cmpb $0x1a, %r12b
movzbl %r13b, %r12d
cmovael %edi, %r12d
cmpb %r12b, %al
jne 0xfede
incq %r10
incq %r15
cmpq %r14, %r10
jb 0xfe96
jmp 0xfede
xorl %r10d, %r10d
jmp 0xfefd
xorl %eax, %eax
xorl %r12d, %r12d
xorl %edi, %edi
cmpw %bx, %r11w
setb %dil
xorl %r11d, %r11d
cmpb %r12b, %al
setb %r11b
cmpq %r14, %r10
cmovel %edi, %r11d
movzbl %r11b, %r10d
addq %r9, %r10
movl (%rcx,%r8,4), %r9d
movl (%rcx,%r10,4), %r11d
movq -0x38(%rbp), %rdx
movl (%rdx,%r9,4), %eax
movl (%rdx,%r11,4), %r13d
leaq (%rsi,%rax), %rbx
addq $0x2e, %rbx
movzwl -0x12(%rbx), %r14d
movzwl 0x1c(%rsi,%r13), %r15d
cmpw %r15w, %r14w
movl %r15d, %edi
cmovbl %r14d, %edi
addq %rsi, %rax
movzwl %di, %edi
leaq (%rdi,%rax), %r12
addq $0x2e, %r12
testw %di, %di
je 0xff85
addq %rsi, %r13
addq $0x2e, %r13
movzbl (%rbx), %edi
leal -0x41(%rdi), %eax
leal 0x20(%rdi), %edx
cmpb $0x1a, %al
movzbl %dl, %eax
cmovael %edi, %eax
movzbl (%r13), %edx
leal -0x41(%rdx), %edi
leal 0x20(%rdx), %esi
cmpb $0x1a, %dil
movzbl %sil, %edi
cmovael %edx, %edi
cmpb %dil, %al
jne 0xff89
incq %rbx
incq %r13
cmpq %r12, %rbx
jb 0xff4c
jmp 0xff89
xorl %eax, %eax
xorl %edi, %edi
xorl %edx, %edx
cmpw %r15w, %r14w
setae %dl
xorl %esi, %esi
cmpb %dil, %al
setae %sil
cmpq %r12, %rbx
cmovel %edx, %esi
testb %sil, %sil
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rsi
jne 0xffce
movl %r11d, (%rcx,%r8,4)
movl %r9d, (%rcx,%r10,4)
leaq (%r10,%r10), %rax
leaq 0x1(,%r10,2), %r9
movq %r10, %r8
cmpq %rdx, %r9
jb 0xfe34
decq %rdx
testl %edx, %edx
jne 0xfdfe
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq