// File: /workspace/github_cpp_makefile_star2_O1/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 %r9, %r10
movq %rdi, %r15
movq 0x50(%rbp), %rax
movq 0x68(%rdi), %r14
movq 0x8(%r14), %r9
movl %r9d, -0x68(%rbp)
shrq $0x20, %rax
je 0xc3a7
cmpl $0x0, 0x64(%r14)
jne 0xc3a7
xorl %eax, %eax
testq %r15, %r15
je 0xc725
movl $0x3, 0x1c(%r15)
jmp 0xc725
movl 0x68(%rbp), %eax
movzwl 0x10(%rbp), %edi
movzwl %dx, %r13d
movzwl %r8w, %ebx
movl %eax, %r11d
movl %edx, -0x64(%rbp)
movzwl %di, %edx
leaq (%rbx,%r13), %rdi
addq %rdx, %rdi
addq %r11, %rdi
addq %r9, %rdi
addq $0x2e, %rdi
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpq %r12, %rdi
jb 0xc3f3
xorl %eax, %eax
testq %r15, %r15
je 0xc725
movl $0xf, 0x1c(%r15)
jmp 0xc725
movq %r13, -0x88(%rbp)
movq %rsi, -0xa0(%rbp)
movq %rbx, -0x80(%rbp)
movq %rcx, -0x98(%rbp)
movq %r11, -0x78(%rbp)
movq %rdx, -0x70(%rbp)
movq %r10, -0x90(%rbp)
addl %r8d, %eax
xorl %edi, %edi
movzwl 0x30(%rbp), %ebx
testw %bx, %bx
movl $0x14, %r8d
cmovel %edi, %r8d
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x50(%rbp)
movups %xmm0, -0x42(%rbp)
movl $0x2014b50, -0x60(%rbp) # imm = 0x2014B50
movb %r8b, -0x5a(%rbp)
movb $0x0, -0x59(%rbp)
movzwl 0x38(%rbp), %edx
movb %dl, -0x58(%rbp)
movb %dh, -0x57(%rbp)
movb %bl, -0x56(%rbp)
movb %bh, -0x55(%rbp)
movzwl 0x40(%rbp), %edx
movb %dl, -0x54(%rbp)
movb %dh, -0x53(%rbp)
movzwl 0x48(%rbp), %edx
movb %dl, -0x52(%rbp)
movb %dh, -0x51(%rbp)
movl 0x28(%rbp), %ebx
movb %bl, -0x50(%rbp)
movb %bh, -0x4f(%rbp)
movl %ebx, %edx
shrl $0x10, %edx
movb %dl, -0x4e(%rbp)
shrl $0x18, %ebx
movb %bl, -0x4d(%rbp)
movq 0x20(%rbp), %rbx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rbx
cmovaeq %rcx, %rbx
movb %bl, -0x4c(%rbp)
movb %bh, -0x4b(%rbp)
movl %ebx, %edx
shrl $0x10, %edx
movb %dl, -0x4a(%rbp)
shrl $0x18, %ebx
movb %bl, -0x49(%rbp)
movq 0x18(%rbp), %rbx
cmpq %rcx, %rbx
cmovaeq %rcx, %rbx
movb %bl, -0x48(%rbp)
movb %bh, -0x47(%rbp)
movl %ebx, %edx
shrl $0x10, %edx
movb %dl, -0x46(%rbp)
shrl $0x18, %ebx
movb %bl, -0x45(%rbp)
movq %r9, %rbx
movl -0x64(%rbp), %edx
movb %dl, -0x44(%rbp)
movb %dh, -0x43(%rbp)
movb %al, -0x42(%rbp)
movb %ah, -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 %rcx, %rax
cmovbq %rax, %rcx
movb %cl, -0x36(%rbp)
movb %ch, -0x35(%rbp)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, -0x34(%rbp)
shrl $0x18, %ecx
movb %cl, -0x33(%rbp)
leaq 0x2e(%r9), %r13
cmpq %r13, 0x10(%r14)
jae 0xc544
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc6f8
movq %r13, 0x8(%r14)
movl 0x18(%r14), %eax
movq %rbx, %rdi
imulq %rax, %rdi
addq (%r14), %rdi
imulq $0x2e, %rax, %rdx
leaq -0x60(%rbp), %rsi
callq 0x31e0
movq 0x8(%r14), %r13
movq -0x88(%rbp), %rax
leaq (%rax,%r13), %r12
cmpq %r12, 0x10(%r14)
jae 0xc593
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc6f8
movq %r12, 0x8(%r14)
movl 0x18(%r14), %eax
imulq %rax, %r13
addq (%r14), %r13
movq -0x88(%rbp), %rdx
imulq %rax, %rdx
movq %r13, %rdi
movq -0xa0(%rbp), %rsi
callq 0x31e0
movq 0x8(%r14), %r12
movq -0x80(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r14)
jae 0xc5e9
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc6f8
movq %r13, 0x8(%r14)
movl 0x18(%r14), %eax
imulq %rax, %r12
addq (%r14), %r12
movq -0x80(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq -0x98(%rbp), %rsi
callq 0x31e0
movq 0x8(%r14), %r12
movq -0x78(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r14)
jae 0xc63c
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc6f8
movq 0x60(%rbp), %rsi
movq %r13, 0x8(%r14)
movl 0x18(%r14), %eax
imulq %rax, %r12
addq (%r14), %r12
movq -0x78(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
callq 0x31e0
movq 0x8(%r14), %r12
movq -0x70(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r14)
jae 0xc688
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc6f8
movq %r13, 0x8(%r14)
movl 0x18(%r14), %eax
imulq %rax, %r12
addq (%r14), %r12
movq -0x70(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq -0x90(%rbp), %rsi
callq 0x31e0
movq 0x28(%r14), %r12
leaq 0x1(%r12), %r13
cmpq %r13, 0x30(%r14)
jae 0xc6d5
leaq 0x20(%r14), %rsi
movq %r15, %rdi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc6f8
movq %r13, 0x28(%r14)
movl 0x38(%r14), %edx
imulq %rdx, %r12
addq 0x20(%r14), %r12
leaq -0x68(%rbp), %rsi
movq %r12, %rdi
callq 0x31e0
movl $0x1, %eax
jmp 0xc725
cmpq %rbx, 0x10(%r14)
jae 0xc712
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xffe4
testl %eax, %eax
je 0xc716
movq %rbx, 0x8(%r14)
xorl %eax, %eax
testq %r15, %r15
je 0xc725
movl $0x10, 0x1c(%r15)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq