// File: 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
subq $0xe0, %rsp
movq %rdi, -0x68(%rbp)
movl %esi, -0x6c(%rbp)
movq %rdx, -0x78(%rbp)
movq %rcx, -0x80(%rbp)
movq %r8, -0x88(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x11cc3
movq -0x88(%rbp), %rax
movl $0x0, (%rax)
cmpq $0x0, -0x98(%rbp)
je 0x11cd4
cmpq $0x0, -0x80(%rbp)
jne 0x11d00
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x18, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x11cf4
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x60(%rbp)
jmp 0x12318
movl -0x6c(%rbp), %ecx
movq -0x80(%rbp), %rax
movl %ecx, (%rax)
movq -0x68(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x20(%rax), %rax
movl -0x6c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %ecx
movq -0x80(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x98(%rbp), %rax
movw 0x4(%rax), %cx
movq -0x80(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x98(%rbp), %rax
movw 0x6(%rax), %cx
movq -0x80(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x98(%rbp), %rax
movw 0x8(%rax), %cx
movq -0x80(%rbp), %rax
movw %cx, 0x14(%rax)
movq -0x98(%rbp), %rax
movw 0xa(%rax), %cx
movq -0x80(%rbp), %rax
movw %cx, 0x16(%rax)
movq -0x98(%rbp), %rax
movzwl 0xc(%rax), %edi
movq -0x98(%rbp), %rax
movzwl 0xe(%rax), %esi
callq 0x20190
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x98(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x98(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, %ecx
movq -0x80(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x98(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %ecx
movq -0x80(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x98(%rbp), %rax
movw 0x24(%rax), %cx
movq -0x80(%rbp), %rax
movw %cx, 0x38(%rax)
movq -0x98(%rbp), %rax
movl 0x26(%rax), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x98(%rbp), %rax
movl 0x2a(%rax), %eax
movl %eax, %ecx
movq -0x80(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x98(%rbp), %rax
movzwl 0x1c(%rax), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x1ff, -0x8c(%rbp)     # imm = 0x1FF
jae 0x11e33
movl -0x8c(%rbp), %eax
movl %eax, -0xc0(%rbp)
jmp 0x11e40
movl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0xc0(%rbp)
jmp 0x11e40
movl -0xc0(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x80(%rbp), %rdi
addq $0x58, %rdi
movq -0x98(%rbp), %rsi
addq $0x2e, %rsi
movl -0x8c(%rbp), %eax
movl %eax, %edx
callq 0x3280
movq -0x80(%rbp), %rax
movl -0x8c(%rbp), %ecx
movb $0x0, 0x58(%rax,%rcx)
movq -0x98(%rbp), %rax
movzwl 0x20(%rax), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x1ff, -0x8c(%rbp)     # imm = 0x1FF
jae 0x11ea6
movl -0x8c(%rbp), %eax
movl %eax, -0xc4(%rbp)
jmp 0x11eb3
movl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0xc4(%rbp)
jmp 0x11eb3
movl -0xc4(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x80(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
movq -0x98(%rbp), %rsi
addq $0x2e, %rsi
movq -0x98(%rbp), %rax
movzwl 0x1c(%rax), %eax
cltq
addq %rax, %rsi
movq -0x98(%rbp), %rax
movzwl 0x1e(%rax), %eax
cltq
addq %rax, %rsi
movl -0x8c(%rbp), %eax
movl %eax, %edx
callq 0x3280
movq -0x80(%rbp), %rax
movl -0x8c(%rbp), %ecx
movb $0x0, 0x258(%rax,%rcx)
movq -0x68(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0xd960
movl %eax, %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x68(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0xd730
movl %eax, %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x50(%rax)
movq -0x68(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0xd800
movl %eax, %ecx
movq -0x80(%rbp), %rax
movl %ecx, 0x54(%rax)
movq -0x80(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x80(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jbe 0x11f83
movq -0x80(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xd0(%rbp)
jmp 0x11f92
movq -0x80(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq -0x80(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jbe 0x11fe5
movq -0x80(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x80(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jbe 0x11fc6
movq -0x80(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xd8(%rbp)
jmp 0x11fd5
movq -0x80(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x11ff4
movq -0x80(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jne 0x12311
movq -0x98(%rbp), %rax
movzwl 0x1e(%rax), %eax
movl %eax, -0x9c(%rbp)
cmpl $0x0, -0x9c(%rbp)
je 0x1230f
movq -0x98(%rbp), %rax
addq $0x2e, %rax
movq -0x98(%rbp), %rcx
movzwl 0x1c(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movl -0x9c(%rbp), %eax
cmpq $0x4, %rax
jae 0x12082
movq -0x68(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x9, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x12076
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x60(%rbp)
jmp 0x12318
movq -0xa8(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0xac(%rbp)
movq -0xa8(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
addq $0x4, %rax
movl -0x9c(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x120e4
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x9, -0x2c(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x120d8
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x60(%rbp)
jmp 0x12318
cmpl $0x1, -0xac(%rbp)
jne 0x122cf
movq -0xa8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb8(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0xbc(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x12126
movq -0x88(%rbp), %rax
movl $0x1, (%rax)
movq -0x80(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, 0x30(%rax)
jne 0x121b3
movl -0xbc(%rbp), %eax
cmpq $0x8, %rax
jae 0x1216d
movq -0x68(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x9, -0x3c(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x12161
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x60(%rbp)
jmp 0x12318
movq -0xb8(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
movq -0xb8(%rbp), %rax
movl 0x4(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0xb8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb8(%rbp)
movl -0xbc(%rbp), %eax
subq $0x8, %rax
movl %eax, -0xbc(%rbp)
movq -0x80(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, 0x28(%rax)
jne 0x12240
movl -0xbc(%rbp), %eax
cmpq $0x8, %rax
jae 0x121fa
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x9, -0x4c(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x121ee
movl -0x4c(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x60(%rbp)
jmp 0x12318
movq -0xb8(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
movq -0xb8(%rbp), %rax
movl 0x4(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0xb8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb8(%rbp)
movl -0xbc(%rbp), %eax
subq $0x8, %rax
movl %eax, -0xbc(%rbp)
movq -0x80(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, 0x40(%rax)
jne 0x122cd
movl -0xbc(%rbp), %eax
cmpq $0x8, %rax
jae 0x12287
movq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x9, -0x5c(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x1227b
movl -0x5c(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x60(%rbp)
jmp 0x12318
movq -0xb8(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
movq -0xb8(%rbp), %rax
movl 0x4(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0xb8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb8(%rbp)
movl -0xbc(%rbp), %eax
subq $0x8, %rax
movl %eax, -0xbc(%rbp)
jmp 0x1230d
movl -0xb0(%rbp), %eax
addq $0x4, %rax
addq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0x9c(%rbp), %eax
subq $0x4, %rax
movl -0xb0(%rbp), %ecx
subq %rcx, %rax
movl %eax, -0x9c(%rbp)
cmpl $0x0, -0x9c(%rbp)
jne 0x1204a
jmp 0x1230f
jmp 0x12311
movl $0x1, -0x60(%rbp)
movl -0x60(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)