// File: jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_writer_update_zip64_extension_block(mz_zip_array*, mz_zip_archive*, unsigned char const*, unsigned int, unsigned long*, unsigned long*, unsigned long*, unsigned int*)
static mz_bool mz_zip_writer_update_zip64_extension_block(mz_zip_array *pNew_ext, mz_zip_archive *pZip, const mz_uint8 *pExt, uint32_t ext_len, mz_uint64 *pComp_size, mz_uint64 *pUncomp_size, mz_uint64 *pLocal_header_ofs, mz_uint32 *pDisk_start)
{
    /* + 64 should be enough for any new zip64 data */
    if (!mz_zip_array_reserve(pZip, pNew_ext, ext_len + 64, MZ_FALSE))
        return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);

    mz_zip_array_resize(pZip, pNew_ext, 0, MZ_FALSE);

    if ((pUncomp_size) || (pComp_size) || (pLocal_header_ofs) || (pDisk_start))
    {
        mz_uint8 new_ext_block[64];
        mz_uint8 *pDst = new_ext_block;
        mz_write_le16(pDst, MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID);
        mz_write_le16(pDst + sizeof(mz_uint16), 0);
        pDst += sizeof(mz_uint16) * 2;

        if (pUncomp_size)
        {
            mz_write_le64(pDst, *pUncomp_size);
            pDst += sizeof(mz_uint64);
        }

        if (pComp_size)
        {
            mz_write_le64(pDst, *pComp_size);
            pDst += sizeof(mz_uint64);
        }

        if (pLocal_header_ofs)
        {
            mz_write_le64(pDst, *pLocal_header_ofs);
            pDst += sizeof(mz_uint64);
        }

        if (pDisk_start)
        {
            mz_write_le32(pDst, *pDisk_start);
            pDst += sizeof(mz_uint32);
        }

        mz_write_le16(new_ext_block + sizeof(mz_uint16), (mz_uint16)((pDst - new_ext_block) - sizeof(mz_uint16) * 2));

        if (!mz_zip_array_push_back(pZip, pNew_ext, new_ext_block, pDst - new_ext_block))
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
    }

    if ((pExt) && (ext_len))
    {
        mz_uint32 extra_size_remaining = ext_len;
        const mz_uint8 *pExtra_data = pExt;

        do
        {
            mz_uint32 field_id, field_data_size, field_total_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));
            field_total_size = field_data_size + sizeof(mz_uint16) * 2;

            if (field_total_size > 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)
            {
                if (!mz_zip_array_push_back(pZip, pNew_ext, pExtra_data, field_total_size))
                    return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
            }

            pExtra_data += field_total_size;
            extra_size_remaining -= field_total_size;
        } while (extra_size_remaining);
    }

    return MZ_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x208(%rbp)
movq %rsi, -0x210(%rbp)
movq %rdx, -0x218(%rbp)
movl %ecx, -0x21c(%rbp)
movq %r8, -0x228(%rbp)
movq %r9, -0x230(%rbp)
movq -0x210(%rbp), %rdx
movq -0x208(%rbp), %rcx
movl -0x21c(%rbp), %eax
addl $0x40, %eax
movl %eax, %eax
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x1abda
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x1abd8
movl $0x0, -0x4(%rbp)
jmp 0x1abe1
jmp 0x1abda
movl $0x1, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x1ac28
movq -0x210(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movl $0x10, -0x1bc(%rbp)
cmpq $0x0, -0x1b8(%rbp)
je 0x1ac19
movl -0x1bc(%rbp), %ecx
movq -0x1b8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x200(%rbp)
jmp 0x1b5c0
movq -0x210(%rbp), %rcx
movq -0x208(%rbp), %rax
movq %rcx, -0x198(%rbp)
movq %rax, -0x1a0(%rbp)
movq $0x0, -0x1a8(%rbp)
movl $0x0, -0x1ac(%rbp)
movq -0x1a8(%rbp), %rax
movq -0x1a0(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x1aca0
movq -0x198(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x1a8(%rbp), %rdx
movl -0x1ac(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x1ac9e
movl $0x0, -0x190(%rbp)
jmp 0x1acbc
jmp 0x1aca0
movq -0x1a8(%rbp), %rcx
movq -0x1a0(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x190(%rbp)
cmpq $0x0, -0x230(%rbp)
jne 0x1ace2
cmpq $0x0, -0x228(%rbp)
jne 0x1ace2
cmpq $0x0, 0x10(%rbp)
jne 0x1ace2
cmpq $0x0, 0x18(%rbp)
je 0x1b2e8
leaq -0x270(%rbp), %rax
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq %rax, -0xc8(%rbp)
movw $0x1, -0xca(%rbp)
movw -0xca(%rbp), %ax
movb %al, %cl
movq -0xc8(%rbp), %rax
movb %cl, (%rax)
movzwl -0xca(%rbp), %eax
sarl $0x8, %eax
movb %al, %cl
movq -0xc8(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x278(%rbp), %rax
addq $0x2, %rax
movq %rax, -0xd8(%rbp)
movw $0x0, -0xda(%rbp)
movw -0xda(%rbp), %ax
movb %al, %cl
movq -0xd8(%rbp), %rax
movb %cl, (%rax)
movzwl -0xda(%rbp), %eax
sarl $0x8, %eax
movb %al, %cl
movq -0xd8(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x278(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x278(%rbp)
cmpq $0x0, -0x230(%rbp)
je 0x1aea1
movq -0x278(%rbp), %rcx
movq -0x230(%rbp), %rax
movq (%rax), %rax
movq %rcx, -0x118(%rbp)
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rcx
movq -0x120(%rbp), %rax
movq %rcx, -0xf8(%rbp)
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movb %al, %cl
movq -0xf8(%rbp), %rax
movb %cl, (%rax)
movl -0xfc(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0xf8(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0xfc(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0xf8(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0xfc(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0xf8(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x118(%rbp), %rcx
addq $0x4, %rcx
movq -0x120(%rbp), %rax
shrq $0x20, %rax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movb %al, %cl
movq -0x108(%rbp), %rax
movb %cl, (%rax)
movl -0x10c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x108(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x10c(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x108(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x10c(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x108(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x278(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x278(%rbp)
cmpq $0x0, -0x228(%rbp)
je 0x1afbe
movq -0x278(%rbp), %rcx
movq -0x228(%rbp), %rax
movq (%rax), %rax
movq %rcx, -0x148(%rbp)
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rcx
movq -0x150(%rbp), %rax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
movb %al, %cl
movq -0x128(%rbp), %rax
movb %cl, (%rax)
movl -0x12c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x128(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x12c(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x128(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x12c(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x128(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x148(%rbp), %rcx
addq $0x4, %rcx
movq -0x150(%rbp), %rax
shrq $0x20, %rax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
movb %al, %cl
movq -0x138(%rbp), %rax
movb %cl, (%rax)
movl -0x13c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x138(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x13c(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x138(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x13c(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x138(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x278(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x278(%rbp)
cmpq $0x0, 0x10(%rbp)
je 0x1b0d5
movq -0x278(%rbp), %rcx
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, -0x178(%rbp)
movq %rax, -0x180(%rbp)
movq -0x178(%rbp), %rcx
movq -0x180(%rbp), %rax
movq %rcx, -0x158(%rbp)
movl %eax, -0x15c(%rbp)
movl -0x15c(%rbp), %eax
movb %al, %cl
movq -0x158(%rbp), %rax
movb %cl, (%rax)
movl -0x15c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x158(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x15c(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x158(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x15c(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x158(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x178(%rbp), %rcx
addq $0x4, %rcx
movq -0x180(%rbp), %rax
shrq $0x20, %rax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
movl -0x16c(%rbp), %eax
movb %al, %cl
movq -0x168(%rbp), %rax
movb %cl, (%rax)
movl -0x16c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x168(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x16c(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x168(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x16c(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x168(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x278(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x278(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x1b158
movq -0x278(%rbp), %rcx
movq 0x18(%rbp), %rax
movl (%rax), %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
movl -0x18c(%rbp), %eax
movb %al, %cl
movq -0x188(%rbp), %rax
movb %cl, (%rax)
movl -0x18c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x188(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x18c(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x188(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x18c(%rbp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x188(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x278(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rcx
addq $0x2, %rcx
movq -0x278(%rbp), %rax
leaq -0x270(%rbp), %rdx
subq %rdx, %rax
subq $0x4, %rax
movq %rcx, -0xe8(%rbp)
movw %ax, -0xea(%rbp)
movw -0xea(%rbp), %ax
movb %al, %cl
movq -0xe8(%rbp), %rax
movb %cl, (%rax)
movzwl -0xea(%rbp), %eax
sarl $0x8, %eax
movb %al, %cl
movq -0xe8(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rdx
leaq -0x270(%rbp), %rcx
movq -0x278(%rbp), %rax
leaq -0x270(%rbp), %rdi
subq %rdi, %rax
movq %rsi, -0x50(%rbp)
movq %rdx, -0x58(%rbp)
movq %rcx, -0x60(%rbp)
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x70(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movl $0x1, -0x44(%rbp)
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x1b245
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x1b243
movl $0x0, -0x28(%rbp)
jmp 0x1b258
jmp 0x1b245
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x1b267
movl $0x0, -0x48(%rbp)
jmp 0x1b29f
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x70(%rbp), %rax
movq -0x58(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x58(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jne 0x1b2e6
movq -0x210(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movl $0x10, -0x1cc(%rbp)
cmpq $0x0, -0x1c8(%rbp)
je 0x1b2d7
movl -0x1cc(%rbp), %ecx
movq -0x1c8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x200(%rbp)
jmp 0x1b5c0
jmp 0x1b2e8
cmpq $0x0, -0x218(%rbp)
je 0x1b5b6
cmpl $0x0, -0x21c(%rbp)
je 0x1b5b6
movl -0x21c(%rbp), %eax
movl %eax, -0x27c(%rbp)
movq -0x218(%rbp), %rax
movq %rax, -0x288(%rbp)
movl -0x27c(%rbp), %eax
cmpq $0x4, %rax
jae 0x1b36a
movq -0x210(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movl $0x9, -0x1dc(%rbp)
cmpq $0x0, -0x1d8(%rbp)
je 0x1b35b
movl -0x1dc(%rbp), %ecx
movq -0x1d8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x200(%rbp)
jmp 0x1b5c0
movq -0x288(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x28c(%rbp)
movq -0x288(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x290(%rbp)
movl -0x290(%rbp), %eax
addq $0x4, %rax
movl %eax, -0x294(%rbp)
movl -0x294(%rbp), %eax
cmpl -0x27c(%rbp), %eax
jbe 0x1b3ea
movq -0x210(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movl $0x9, -0x1ec(%rbp)
cmpq $0x0, -0x1e8(%rbp)
je 0x1b3db
movl -0x1ec(%rbp), %ecx
movq -0x1e8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x200(%rbp)
jmp 0x1b5c0
cmpl $0x1, -0x28c(%rbp)
je 0x1b57a
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rdx
movq -0x288(%rbp), %rcx
movl -0x294(%rbp), %eax
movq %rsi, -0xa0(%rbp)
movq %rdx, -0xa8(%rbp)
movq %rcx, -0xb0(%rbp)
movq %rax, -0xb8(%rbp)
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
movq -0xc0(%rbp), %rax
addq -0xb8(%rbp), %rax
movq %rdx, -0x80(%rbp)
movq %rcx, -0x88(%rbp)
movq %rax, -0x90(%rbp)
movl $0x1, -0x94(%rbp)
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x1b4b9
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
movl -0x94(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x1b4b7
movl $0x0, -0x74(%rbp)
jmp 0x1b4d2
jmp 0x1b4b9
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jne 0x1b4e4
movl $0x0, -0x98(%rbp)
jmp 0x1b531
movq -0xa8(%rbp), %rax
movq (%rax), %rdi
movq -0xc0(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0xb0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq -0xa8(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0x98(%rbp)
cmpl $0x0, -0x98(%rbp)
jne 0x1b578
movq -0x210(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movl $0x10, -0x1fc(%rbp)
cmpq $0x0, -0x1f8(%rbp)
je 0x1b56c
movl -0x1fc(%rbp), %ecx
movq -0x1f8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x200(%rbp)
jmp 0x1b5c0
jmp 0x1b57a
movl -0x294(%rbp), %ecx
movq -0x288(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x288(%rbp)
movl -0x294(%rbp), %ecx
movl -0x27c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x27c(%rbp)
cmpl $0x0, -0x27c(%rbp)
jne 0x1b31d
jmp 0x1b5b6
movl $0x1, -0x200(%rbp)
movl -0x200(%rbp), %eax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
nop