// File: /workspace/github_cpp_makefile_star2_O3/jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_file_stat_internal(mz_zip_archive*, unsigned int, unsigned char const*, mz_zip_archive_file_stat*, int*)
static mz_bool mz_zip_file_stat_internal(mz_zip_archive *pZip, mz_uint file_index, const mz_uint8 *pCentral_dir_header, mz_zip_archive_file_stat *pStat, mz_bool *pFound_zip64_extra_data)
{
    mz_uint n;
    const mz_uint8 *p = pCentral_dir_header;

    if (pFound_zip64_extra_data)
        *pFound_zip64_extra_data = MZ_FALSE;

    if ((!p) || (!pStat))
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);

    /* Extract fields from the central directory record. */
    pStat->m_file_index = file_index;
    pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index);
    pStat->m_version_made_by = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_MADE_BY_OFS);
    pStat->m_version_needed = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_NEEDED_OFS);
    pStat->m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS);
    pStat->m_method = MZ_READ_LE16(p + MZ_ZIP_CDH_METHOD_OFS);
#ifndef MINIZ_NO_TIME
    pStat->m_time = mz_zip_dos_to_time_t(MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_TIME_OFS), MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_DATE_OFS));
#endif
    pStat->m_crc32 = MZ_READ_LE32(p + MZ_ZIP_CDH_CRC32_OFS);
    pStat->m_comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
    pStat->m_uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
    pStat->m_internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS);
    pStat->m_external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS);
    pStat->m_local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS);

    /* Copy as much of the filename and comment as possible. */
    n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
    n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE - 1);
    memcpy(pStat->m_filename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n);
    pStat->m_filename[n] = '\0';

    n = MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS);
    n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE - 1);
    pStat->m_comment_size = n;
    memcpy(pStat->m_comment, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS), n);
    pStat->m_comment[n] = '\0';

    /* Set some flags for convienance */
    pStat->m_is_directory = mz_zip_reader_is_file_a_directory(pZip, file_index);
    pStat->m_is_encrypted = mz_zip_reader_is_file_encrypted(pZip, file_index);
    pStat->m_is_supported = mz_zip_reader_is_file_supported(pZip, file_index);

    /* See if we need to read any zip64 extended information fields. */
    /* Confusingly, these zip64 fields can be present even on non-zip64 archives (Debian zip on a huge files from stdin piped to stdout creates them). */
    if (MZ_MAX(MZ_MAX(pStat->m_comp_size, pStat->m_uncomp_size), pStat->m_local_header_ofs) == MZ_UINT32_MAX)
    {
        /* Attempt to find zip64 extended information field in the entry's extra data */
        mz_uint32 extra_size_remaining = MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS);

        if (extra_size_remaining)
        {
            const mz_uint8 *pExtra_data = p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);

            do
            {
                mz_uint32 field_id;
                mz_uint32 field_data_size;

                if (extra_size_remaining < (sizeof(mz_uint16) * 2))
                    return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                field_id = MZ_READ_LE16(pExtra_data);
                field_data_size = MZ_READ_LE16(pExtra_data + sizeof(mz_uint16));

                if ((field_data_size + sizeof(mz_uint16) * 2) > extra_size_remaining)
                    return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                if (field_id == MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID)
                {
                    const mz_uint8 *pField_data = pExtra_data + sizeof(mz_uint16) * 2;
                    mz_uint32 field_data_remaining = field_data_size;

                    if (pFound_zip64_extra_data)
                        *pFound_zip64_extra_data = MZ_TRUE;

                    if (pStat->m_uncomp_size == MZ_UINT32_MAX)
                    {
                        if (field_data_remaining < sizeof(mz_uint64))
                            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                        pStat->m_uncomp_size = MZ_READ_LE64(pField_data);
                        pField_data += sizeof(mz_uint64);
                        field_data_remaining -= sizeof(mz_uint64);
                    }

                    if (pStat->m_comp_size == MZ_UINT32_MAX)
                    {
                        if (field_data_remaining < sizeof(mz_uint64))
                            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                        pStat->m_comp_size = MZ_READ_LE64(pField_data);
                        pField_data += sizeof(mz_uint64);
                        field_data_remaining -= sizeof(mz_uint64);
                    }

                    if (pStat->m_local_header_ofs == MZ_UINT32_MAX)
                    {
                        if (field_data_remaining < sizeof(mz_uint64))
                            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                        pStat->m_local_header_ofs = MZ_READ_LE64(pField_data);
                        pField_data += sizeof(mz_uint64);
                        field_data_remaining -= sizeof(mz_uint64);
                    }

                    break;
                }

                pExtra_data += sizeof(mz_uint16) * 2 + field_data_size;
                extra_size_remaining = extra_size_remaining - sizeof(mz_uint16) * 2 - field_data_size;
            } while (extra_size_remaining);
        }
    }

    return MZ_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
movq %rdx, %r13
movq %rdi, %rbx
testq %r8, %r8
je 0xa7cf
movl $0x0, (%r8)
testq %r13, %r13
setne %al
testq %r14, %r14
setne %cl
testb %cl, %al
je 0xa9ce
movq %r8, -0x38(%rbp)
movl %esi, (%r14)
movq 0x68(%rbx), %rax
movq 0x20(%rax), %rax
movl %esi, %ecx
movl (%rax,%rcx,4), %eax
movq %rax, 0x8(%r14)
movzwl 0x4(%r13), %eax
movw %ax, 0x10(%r14)
movzwl 0x6(%r13), %eax
movw %ax, 0x12(%r14)
movzwl 0x8(%r13), %eax
movw %ax, 0x14(%r14)
movzwl 0xa(%r13), %eax
movw %ax, 0x16(%r14)
movzwl 0xc(%r13), %eax
movzwl 0xe(%r13), %ecx
xorps %xmm0, %xmm0
leaq -0x78(%rbp), %rdi
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
movl $0xffffffff, 0x20(%rdi) # imm = 0xFFFFFFFF
movl %ecx, %edx
shrl $0x9, %edx
addl $0x50, %edx
movl %edx, 0x14(%rdi)
movl %ecx, %edx
shrl $0x5, %edx
andl $0xf, %edx
decl %edx
movl %edx, 0x10(%rdi)
andl $0x1f, %ecx
movl %ecx, 0xc(%rdi)
movl %eax, %ecx
shrl $0xb, %ecx
movl %ecx, 0x8(%rdi)
movl %eax, %ecx
shrl $0x5, %ecx
andl $0x3f, %ecx
movl %ecx, 0x4(%rdi)
addl %eax, %eax
andl $0x3e, %eax
movl %eax, (%rdi)
movl %esi, -0x2c(%rbp)
callq 0x3180
movq %rax, 0x18(%r14)
movl 0x10(%r13), %eax
movl %eax, 0x20(%r14)
movl 0x14(%r13), %eax
movq %rax, 0x28(%r14)
movl 0x18(%r13), %eax
movq %rax, 0x30(%r14)
movzwl 0x24(%r13), %eax
movw %ax, 0x38(%r14)
movl 0x26(%r13), %eax
movl %eax, 0x3c(%r14)
movl 0x2a(%r13), %eax
movq %rax, 0x40(%r14)
movzwl 0x1c(%r13), %r15d
movq %rbx, -0x40(%rbp)
movl $0x1ff, %ebx            # imm = 0x1FF
cmpl %ebx, %r15d
cmovael %ebx, %r15d
leaq 0x58(%r14), %rdi
leaq 0x2e(%r13), %r12
movq %r12, %rsi
movq %r15, %rdx
callq 0x31e0
xorl %eax, %eax
movb %al, 0x58(%r14,%r15)
xorl %r15d, %r15d
movzwl 0x20(%r13), %eax
cmpl %ebx, %eax
cmovbl %eax, %ebx
movl %ebx, 0x48(%r14)
leaq 0x258(%r14), %rdi
movzwl 0x1c(%r13), %eax
addq %r13, %rax
addq $0x2e, %rax
movzwl 0x1e(%r13), %esi
addq %rax, %rsi
movq %rbx, %rdx
callq 0x31e0
movb %r15b, 0x258(%r14,%rbx)
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
movl -0x2c(%rbp), %r15d
movl %r15d, %esi
callq 0x8aa0
movl %eax, 0x4c(%r14)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x89fb
movl %eax, 0x50(%r14)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x8a3a
movl %eax, 0x54(%r14)
movq 0x28(%r14), %rdx
movq 0x30(%r14), %rdi
cmpq %rdi, %rdx
movq %rdi, %rsi
cmovaq %rdx, %rsi
movq 0x40(%r14), %rcx
cmpq %rcx, %rsi
cmovbeq %rcx, %rsi
movl $0x1, %eax
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
cmpq %r8, %rsi
jne 0xa9dc
movzwl 0x1e(%r13), %r8d
testl %r8d, %r8d
je 0xa9dc
movzwl 0x1c(%r13), %esi
addq %rsi, %r12
cmpl $0x3, %r8d
jbe 0xaa4a
movl %r8d, %r8d
movzwl 0x2(%r12), %esi
leaq 0x4(%rsi), %r9
cmpq %r8, %r9
ja 0xaa4a
cmpw $0x1, (%r12)
je 0xa9eb
addq %r9, %r12
subl %esi, %r8d
addl $-0x4, %r8d
jne 0xa998
jmp 0xa9dc
xorl %eax, %eax
testq %rbx, %rbx
je 0xa9dc
movl $0x18, 0x1c(%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x38(%rbp), %r8
testq %r8, %r8
je 0xa9fb
movl $0x1, (%r8)
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
cmpq %r8, %rdi
jne 0xaa1e
cmpw $0x7, %si
jbe 0xaa4a
movq 0x4(%r12), %rdi
movq %rdi, 0x30(%r14)
addq $0xc, %r12
addl $-0x8, %esi
jmp 0xaa22
addq $0x4, %r12
cmpq %r8, %rdx
jne 0xaa3b
cmpl $0x7, %esi
jbe 0xaa4a
movq (%r12), %rdx
movq %rdx, 0x28(%r14)
addq $0x8, %r12
addl $-0x8, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rdx, %rcx
jne 0xa9dc
cmpl $0x7, %esi
ja 0xaa5a
xorl %eax, %eax
testq %rbx, %rbx
je 0xa9dc
movl $0x9, 0x1c(%rbx)
jmp 0xa9dc
movq (%r12), %rcx
movq %rcx, 0x40(%r14)
jmp 0xa9dc