// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movq %rdi, %r14
movq 0x50(%rbp), %rax
movq 0x68(%rdi), %r15
movq 0x8(%r15), %r11
movl %r11d, -0x64(%rbp)
shrq $0x20, %rax
je 0xc0ce
cmpl $0x0, 0x64(%r15)
jne 0xc0ce
movl $0x3, 0x1c(%r14)
jmp 0xc425
movl 0x68(%rbp), %r10d
movzwl 0x10(%rbp), %edi
movzwl %dx, %eax
movzwl %r8w, %r12d
movl %r10d, %r13d
movl %r10d, %r10d
movzwl %di, %edi
movq %rax, -0x88(%rbp)
addq %r12, %rax
addq %rdi, %rax
addq %r10, %rax
addq %r11, %rax
addq $0x2e, %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq %rbx, %rax
jb 0xc114
movl $0xf, 0x1c(%r14)
jmp 0xc425
movq %rsi, -0xa0(%rbp)
movq %r12, -0x80(%rbp)
movq %rcx, -0x98(%rbp)
movq %r10, -0x78(%rbp)
movq %rdi, -0x70(%rbp)
movq %r9, -0x90(%rbp)
andw $0x0, -0x3c(%rbp)
movl %r13d, %ecx
addl %r8d, %ecx
xorl %eax, %eax
movl %edx, %esi
movzwl 0x30(%rbp), %edx
testw %dx, %dx
pushq $0x14
popq %rdi
cmovel %eax, %edi
xorps %xmm0, %xmm0
movups %xmm0, -0x5c(%rbp)
movups %xmm0, -0x4c(%rbp)
movl $0x2014b50, -0x60(%rbp) # imm = 0x2014B50
movb %dil, -0x5a(%rbp)
movzwl 0x38(%rbp), %eax
movb %al, -0x58(%rbp)
movb %ah, -0x57(%rbp)
movb %dl, -0x56(%rbp)
movb %dh, -0x55(%rbp)
movzwl 0x40(%rbp), %eax
movb %al, -0x54(%rbp)
movb %ah, -0x53(%rbp)
movzwl 0x48(%rbp), %eax
movb %al, -0x52(%rbp)
movb %ah, -0x51(%rbp)
movl 0x28(%rbp), %eax
movb %al, -0x50(%rbp)
movb %ah, -0x4f(%rbp)
movl %eax, %edi
shrl $0x10, %edi
movb %dil, -0x4e(%rbp)
shrl $0x18, %eax
movb %al, -0x4d(%rbp)
movq 0x20(%rbp), %rax
cmpq %rbx, %rax
cmovaeq %rbx, %rax
movb %al, -0x4c(%rbp)
movb %ah, -0x4b(%rbp)
movl %eax, %edi
shrl $0x10, %edi
movb %dil, -0x4a(%rbp)
shrl $0x18, %eax
movb %al, -0x49(%rbp)
movq 0x18(%rbp), %rax
cmpq %rbx, %rax
cmovaeq %rbx, %rax
movb %al, -0x48(%rbp)
movb %ah, -0x47(%rbp)
movl %eax, %edi
shrl $0x10, %edi
movb %dil, -0x46(%rbp)
shrl $0x18, %eax
movb %al, -0x45(%rbp)
movl %esi, %eax
movb %al, -0x44(%rbp)
movb %ah, -0x43(%rbp)
movb %cl, -0x42(%rbp)
movb %ch, -0x41(%rbp)
movzwl 0x10(%rbp), %eax
movb %al, -0x40(%rbp)
movb %ah, -0x3f(%rbp)
movl 0x58(%rbp), %eax
movb %al, -0x3a(%rbp)
movb %ah, -0x39(%rbp)
movl %eax, %edx
shrl $0x10, %edx
movb %dl, -0x38(%rbp)
shrl $0x18, %eax
movb %al, -0x37(%rbp)
movq 0x50(%rbp), %rax
cmpq %rbx, %rax
cmovbq %rax, %rbx
movb %bl, -0x36(%rbp)
movb %bh, -0x35(%rbp)
movl %ebx, %eax
shrl $0x10, %eax
movb %al, -0x34(%rbp)
shrl $0x18, %ebx
movb %bl, -0x33(%rbp)
leaq 0x2e(%r11), %r13
cmpq %r13, 0x10(%r15)
movq %r11, %rbx
jae 0xc257
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xc3ff
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
movq %rbx, %rdi
imulq %rax, %rdi
addq (%r15), %rdi
imulq $0x2e, %rax, %rdx
leaq -0x60(%rbp), %rsi
callq 0x31f0
movq 0x8(%r15), %r13
movq -0x88(%rbp), %rax
leaq (%rax,%r13), %r12
cmpq %r12, 0x10(%r15)
jae 0xc2a4
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xf595
testl %eax, %eax
je 0xc3ff
movq %r12, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r13
addq (%r15), %r13
movq -0x88(%rbp), %rdx
imulq %rax, %rdx
movq %r13, %rdi
movq -0xa0(%rbp), %rsi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0x80(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xc2f8
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xc3ff
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x80(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq -0x98(%rbp), %rsi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0x78(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xc349
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xc3ff
movq 0x60(%rbp), %rsi
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x78(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0x70(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xc393
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xc3ff
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x70(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq -0x90(%rbp), %rsi
callq 0x31f0
movq 0x28(%r15), %r12
leaq 0x1(%r12), %r13
cmpq %r13, 0x30(%r15)
jae 0xc3de
leaq 0x20(%r15), %rsi
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xc3ff
movq %r13, 0x28(%r15)
movl 0x38(%r15), %edx
imulq %rdx, %r12
addq 0x20(%r15), %r12
leaq -0x64(%rbp), %rsi
movq %r12, %rdi
callq 0x31f0
pushq $0x1
popq %rax
jmp 0xc427
cmpq %rbx, 0x10(%r15)
jae 0xc419
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xf595
testl %eax, %eax
je 0xc41d
movq %rbx, 0x8(%r15)
movl $0x10, 0x1c(%r14)
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq