// File: jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_writer_add_to_central_dir(mz_zip_archive*, char const*, unsigned short, void const*, unsigned short, void const*, unsigned short, unsigned long, unsigned long, unsigned int, unsigned short, unsigned short, unsigned short, unsigned short, unsigned long, unsigned int, char const*, unsigned int)
static mz_bool mz_zip_writer_add_to_central_dir(mz_zip_archive *pZip, const char *pFilename, mz_uint16 filename_size,
                                                const void *pExtra, mz_uint16 extra_size, const void *pComment, mz_uint16 comment_size,
                                                mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32,
                                                mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date,
                                                mz_uint64 local_header_ofs, mz_uint32 ext_attributes,
                                                const char *user_extra_data, mz_uint user_extra_data_len)
{
    mz_zip_internal_state *pState = pZip->m_pState;
    mz_uint32 central_dir_ofs = (mz_uint32)pState->m_central_dir.m_size;
    size_t orig_central_dir_size = pState->m_central_dir.m_size;
    mz_uint8 central_dir_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE];

    if (!pZip->m_pState->m_zip64)
    {
        if (local_header_ofs > 0xFFFFFFFF)
            return mz_zip_set_error(pZip, MZ_ZIP_FILE_TOO_LARGE);
    }

    /* miniz doesn't support central dirs >= MZ_UINT32_MAX bytes yet */
    if (((mz_uint64)pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + extra_size + user_extra_data_len + comment_size) >= MZ_UINT32_MAX)
        return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_CDIR_SIZE);

    if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, extra_size + user_extra_data_len, comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_header_ofs, ext_attributes))
        return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR);

    if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) ||
        (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pFilename, filename_size)) ||
        (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pExtra, extra_size)) ||
        (!mz_zip_array_push_back(pZip, &pState->m_central_dir, user_extra_data, user_extra_data_len)) ||
        (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pComment, comment_size)) ||
        (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &central_dir_ofs, 1)))
    {
        /* Try to resize the central directory array back into its original state. */
        mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
        return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
    }

    return MZ_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movw %r8w, %ax
movl 0x68(%rbp), %r8d
movq 0x60(%rbp), %r8
movl 0x58(%rbp), %r8d
movq 0x50(%rbp), %r8
movw 0x48(%rbp), %r8w
movw 0x40(%rbp), %r8w
movw 0x38(%rbp), %r8w
movw 0x30(%rbp), %r8w
movl 0x28(%rbp), %r8d
movq 0x20(%rbp), %r8
movq 0x18(%rbp), %r8
movw 0x10(%rbp), %r8w
movq %rdi, -0x278(%rbp)
movq %rsi, -0x280(%rbp)
movw %dx, -0x282(%rbp)
movq %rcx, -0x290(%rbp)
movw %ax, -0x292(%rbp)
movq %r9, -0x2a0(%rbp)
movq -0x278(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x2a8(%rbp)
movq -0x2a8(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x2ac(%rbp)
movq -0x2a8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2b8(%rbp)
movq -0x278(%rbp), %rax
movq 0x68(%rax), %rax
cmpl $0x0, 0x64(%rax)
jne 0x15e3b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, 0x50(%rbp)
jbe 0x15e39
movq -0x278(%rbp), %rax
movq %rax, -0x238(%rbp)
movl $0x3, -0x23c(%rbp)
cmpq $0x0, -0x238(%rbp)
je 0x15e2a
movl -0x23c(%rbp), %ecx
movq -0x238(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x270(%rbp)
jmp 0x167fa
jmp 0x15e3b
movq -0x2a8(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x2e, %rax
movzwl -0x282(%rbp), %ecx
addq %rcx, %rax
movzwl -0x292(%rbp), %ecx
addq %rcx, %rax
movl 0x68(%rbp), %ecx
addq %rcx, %rax
movzwl 0x10(%rbp), %ecx
addq %rcx, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jb 0x15eb6
movq -0x278(%rbp), %rax
movq %rax, -0x248(%rbp)
movl $0xf, -0x24c(%rbp)
cmpq $0x0, -0x248(%rbp)
je 0x15ea7
movl -0x24c(%rbp), %ecx
movq -0x248(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x270(%rbp)
jmp 0x167fa
movq -0x278(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
movw -0x282(%rbp), %dx
movzwl -0x292(%rbp), %eax
addl 0x68(%rbp), %eax
movw %ax, %cx
movw 0x10(%rbp), %r8w
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r13
movl 0x28(%rbp), %r12d
movw 0x30(%rbp), %r15w
movw 0x38(%rbp), %r14w
movw 0x40(%rbp), %bx
movw 0x48(%rbp), %r11w
movq 0x50(%rbp), %r10
movl 0x58(%rbp), %eax
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %r8w, %r8d
movq %r13, (%rsp)
movl %r12d, 0x8(%rsp)
movzwl %r15w, %r15d
movl %r15d, 0x10(%rsp)
movzwl %r14w, %r14d
movl %r14d, 0x18(%rsp)
movzwl %bx, %ebx
movl %ebx, 0x20(%rsp)
movzwl %r11w, %r11d
movl %r11d, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movl %eax, 0x38(%rsp)
callq 0x20340
cmpl $0x0, %eax
jne 0x15f8c
movq -0x278(%rbp), %rax
movq %rax, -0x258(%rbp)
movl $0x1b, -0x25c(%rbp)
cmpq $0x0, -0x258(%rbp)
je 0x15f7d
movl -0x25c(%rbp), %ecx
movq -0x258(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x270(%rbp)
jmp 0x167fa
movq -0x278(%rbp), %rdx
movq -0x2a8(%rbp), %rcx
leaq -0x2f0(%rbp), %rax
movq %rdx, -0x58(%rbp)
movq %rcx, -0x60(%rbp)
movq %rax, -0x68(%rbp)
movq $0x2e, -0x70(%rbp)
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x78(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rdx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq %rax, -0x48(%rbp)
movl $0x1, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x16016
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl -0x4c(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x16014
movl $0x0, -0x2c(%rbp)
jmp 0x16029
jmp 0x16016
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x16038
movl $0x0, -0x50(%rbp)
jmp 0x16070
movq -0x60(%rbp), %rax
movq (%rax), %rdi
movq -0x78(%rbp), %rax
movq -0x60(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x60(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
je 0x1671b
movq -0x278(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
movq -0x280(%rbp), %rcx
movzwl -0x282(%rbp), %eax
movq %rsi, -0xa8(%rbp)
movq %rdx, -0xb0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %rax, -0xc0(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0xa8(%rbp), %rdx
movq -0xb0(%rbp), %rcx
movq -0xc8(%rbp), %rax
addq -0xc0(%rbp), %rax
movq %rdx, -0x88(%rbp)
movq %rcx, -0x90(%rbp)
movq %rax, -0x98(%rbp)
movl $0x1, -0x9c(%rbp)
movq -0x98(%rbp), %rax
movq -0x90(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x16143
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdx
movl -0x9c(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x16141
movl $0x0, -0x7c(%rbp)
jmp 0x1615c
jmp 0x16143
movq -0x98(%rbp), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jne 0x1616e
movl $0x0, -0xa0(%rbp)
jmp 0x161bb
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
movq -0xc8(%rbp), %rax
movq -0xb0(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0xb8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
movq -0xb0(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0xa0(%rbp)
cmpl $0x0, -0xa0(%rbp)
je 0x1671b
movq -0x278(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
movq -0x290(%rbp), %rcx
movzwl -0x292(%rbp), %eax
movq %rsi, -0xf8(%rbp)
movq %rdx, -0x100(%rbp)
movq %rcx, -0x108(%rbp)
movq %rax, -0x110(%rbp)
movq -0x100(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x118(%rbp)
movq -0xf8(%rbp), %rdx
movq -0x100(%rbp), %rcx
movq -0x118(%rbp), %rax
addq -0x110(%rbp), %rax
movq %rdx, -0xd8(%rbp)
movq %rcx, -0xe0(%rbp)
movq %rax, -0xe8(%rbp)
movl $0x1, -0xec(%rbp)
movq -0xe8(%rbp), %rax
movq -0xe0(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x16294
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movl -0xec(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x16292
movl $0x0, -0xcc(%rbp)
jmp 0x162b0
jmp 0x16294
movq -0xe8(%rbp), %rcx
movq -0xe0(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0xcc(%rbp)
cmpl $0x0, -0xcc(%rbp)
jne 0x162c5
movl $0x0, -0xf0(%rbp)
jmp 0x16312
movq -0x100(%rbp), %rax
movq (%rax), %rdi
movq -0x118(%rbp), %rax
movq -0x100(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0x108(%rbp), %rsi
movq -0x110(%rbp), %rdx
movq -0x100(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0xf0(%rbp)
cmpl $0x0, -0xf0(%rbp)
je 0x1671b
movq -0x278(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
movq 0x60(%rbp), %rcx
movl 0x68(%rbp), %eax
movq %rsi, -0x148(%rbp)
movq %rdx, -0x150(%rbp)
movq %rcx, -0x158(%rbp)
movq %rax, -0x160(%rbp)
movq -0x150(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x168(%rbp)
movq -0x148(%rbp), %rdx
movq -0x150(%rbp), %rcx
movq -0x168(%rbp), %rax
addq -0x160(%rbp), %rax
movq %rdx, -0x128(%rbp)
movq %rcx, -0x130(%rbp)
movq %rax, -0x138(%rbp)
movl $0x1, -0x13c(%rbp)
movq -0x138(%rbp), %rax
movq -0x130(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x163e4
movq -0x128(%rbp), %rdi
movq -0x130(%rbp), %rsi
movq -0x138(%rbp), %rdx
movl -0x13c(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x163e2
movl $0x0, -0x11c(%rbp)
jmp 0x16400
jmp 0x163e4
movq -0x138(%rbp), %rcx
movq -0x130(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x11c(%rbp)
cmpl $0x0, -0x11c(%rbp)
jne 0x16415
movl $0x0, -0x140(%rbp)
jmp 0x16462
movq -0x150(%rbp), %rax
movq (%rax), %rdi
movq -0x168(%rbp), %rax
movq -0x150(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0x158(%rbp), %rsi
movq -0x160(%rbp), %rdx
movq -0x150(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0x140(%rbp)
cmpl $0x0, -0x140(%rbp)
je 0x1671b
movq -0x278(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
movq -0x2a0(%rbp), %rcx
movzwl 0x10(%rbp), %eax
movq %rsi, -0x198(%rbp)
movq %rdx, -0x1a0(%rbp)
movq %rcx, -0x1a8(%rbp)
movq %rax, -0x1b0(%rbp)
movq -0x1a0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1b8(%rbp)
movq -0x198(%rbp), %rdx
movq -0x1a0(%rbp), %rcx
movq -0x1b8(%rbp), %rax
addq -0x1b0(%rbp), %rax
movq %rdx, -0x178(%rbp)
movq %rcx, -0x180(%rbp)
movq %rax, -0x188(%rbp)
movl $0x1, -0x18c(%rbp)
movq -0x188(%rbp), %rax
movq -0x180(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x16538
movq -0x178(%rbp), %rdi
movq -0x180(%rbp), %rsi
movq -0x188(%rbp), %rdx
movl -0x18c(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x16536
movl $0x0, -0x16c(%rbp)
jmp 0x16554
jmp 0x16538
movq -0x188(%rbp), %rcx
movq -0x180(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x16c(%rbp)
cmpl $0x0, -0x16c(%rbp)
jne 0x16569
movl $0x0, -0x190(%rbp)
jmp 0x165b6
movq -0x1a0(%rbp), %rax
movq (%rax), %rdi
movq -0x1b8(%rbp), %rax
movq -0x1a0(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0x1a8(%rbp), %rsi
movq -0x1b0(%rbp), %rdx
movq -0x1a0(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0x190(%rbp)
cmpl $0x0, -0x190(%rbp)
je 0x1671b
movq -0x278(%rbp), %rcx
movq -0x2a8(%rbp), %rax
addq $0x20, %rax
movq %rcx, -0x1e8(%rbp)
movq %rax, -0x1f0(%rbp)
leaq -0x2ac(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq $0x1, -0x200(%rbp)
movq -0x1f0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x208(%rbp)
movq -0x1e8(%rbp), %rdx
movq -0x1f0(%rbp), %rcx
movq -0x208(%rbp), %rax
addq -0x200(%rbp), %rax
movq %rdx, -0x1c8(%rbp)
movq %rcx, -0x1d0(%rbp)
movq %rax, -0x1d8(%rbp)
movl $0x1, -0x1dc(%rbp)
movq -0x1d8(%rbp), %rax
movq -0x1d0(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x16690
movq -0x1c8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
movq -0x1d8(%rbp), %rdx
movl -0x1dc(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x1668e
movl $0x0, -0x1bc(%rbp)
jmp 0x166ac
jmp 0x16690
movq -0x1d8(%rbp), %rcx
movq -0x1d0(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x1bc(%rbp)
cmpl $0x0, -0x1bc(%rbp)
jne 0x166c1
movl $0x0, -0x1e0(%rbp)
jmp 0x1670e
movq -0x1f0(%rbp), %rax
movq (%rax), %rdi
movq -0x208(%rbp), %rax
movq -0x1f0(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq %rcx, %rax
addq %rax, %rdi
movq -0x1f8(%rbp), %rsi
movq -0x200(%rbp), %rdx
movq -0x1f0(%rbp), %rax
movl 0x18(%rax), %eax
imulq %rax, %rdx
callq 0x3280
movl $0x1, -0x1e0(%rbp)
cmpl $0x0, -0x1e0(%rbp)
jne 0x167f0
movq -0x278(%rbp), %rdx
movq -0x2a8(%rbp), %rcx
movq -0x2b8(%rbp), %rax
movq %rdx, -0x218(%rbp)
movq %rcx, -0x220(%rbp)
movq %rax, -0x228(%rbp)
movl $0x0, -0x22c(%rbp)
movq -0x228(%rbp), %rax
movq -0x220(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x16796
movq -0x218(%rbp), %rdi
movq -0x220(%rbp), %rsi
movq -0x228(%rbp), %rdx
movl -0x22c(%rbp), %ecx
callq 0x20220
cmpl $0x0, %eax
jne 0x16794
movl $0x0, -0x20c(%rbp)
jmp 0x167b2
jmp 0x16796
movq -0x228(%rbp), %rcx
movq -0x220(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x20c(%rbp)
movq -0x278(%rbp), %rax
movq %rax, -0x268(%rbp)
movl $0x10, -0x26c(%rbp)
cmpq $0x0, -0x268(%rbp)
je 0x167e4
movl -0x26c(%rbp), %ecx
movq -0x268(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x0, -0x270(%rbp)
jmp 0x167fa
movl $0x1, -0x270(%rbp)
movl -0x270(%rbp), %eax
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)