// File: /workspace/github_c_makefile_star2_O2/Paxa[P]fast_excel/libxlsxwriter/third_party/minizip/zip.c
// Function: zipOpen3
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
    zip64_internal ziinit;
    zip64_internal* zi;
    int err=ZIP_OK;

    ziinit.z_filefunc.zseek32_file = NULL;
    ziinit.z_filefunc.ztell32_file = NULL;
    if (pzlib_filefunc64_32_def==NULL)
        fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
    else
        ziinit.z_filefunc = *pzlib_filefunc64_32_def;

    ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
                  pathname,
                  (append == APPEND_STATUS_CREATE) ?
                  (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
                    (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));

    if (ziinit.filestream == NULL)
        return NULL;

    if (append == APPEND_STATUS_CREATEAFTER)
        ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END);

    ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream);
    ziinit.in_opened_file_inzip = 0;
    ziinit.ci.stream_initialised = 0;
    ziinit.number_entry = 0;
    ziinit.add_position_when_writing_offset = 0;
    init_linkedlist(&(ziinit.central_dir));



    zi = (zip64_internal*)ALLOC(sizeof(zip64_internal));
    if (zi==NULL)
    {
        ZCLOSE64(ziinit.z_filefunc,ziinit.filestream);
        return NULL;
    }

    /* now we add file in a zipfile */
#    ifndef NO_ADDFILEINEXISTINGZIP
    ziinit.globalcomment = NULL;
    if (append == APPEND_STATUS_ADDINZIP)
    {
      // Read and Cache Central Directory Records
      err = LoadCentralDirectoryRecord(&ziinit);
    }

    if (globalcomment)
    {
      *globalcomment = ziinit.globalcomment;
    }
#    endif /* !NO_ADDFILEINEXISTINGZIP*/

    if (err != ZIP_OK)
    {
#    ifndef NO_ADDFILEINEXISTINGZIP
        free(ziinit.globalcomment);
#    endif /* !NO_ADDFILEINEXISTINGZIP*/
        free(zi);
        return NULL;
    }
    else
    {
        *zi = ziinit;
        return (zipFile)zi;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10208, %rsp          # imm = 0x10208
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0xd8(%rsp)
testq %rcx, %rcx
je 0xd50b
movq %rcx, %rax
pushq $0xb
popq %rcx
leaq 0x90(%rsp), %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
jmp 0xd518
leaq 0x90(%rsp), %rdi
callq 0xc070
xorl %eax, %eax
testl %ebp, %ebp
sete %al
leal 0x7(,%rax,4), %edx
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd130
movq %rax, 0x58(%r14)
testq %rax, %rax
je 0xddd5
cmpl $0x1, %ebp
jne 0xd567
leaq 0x90(%rsp), %rbx
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xc520
movq 0x58(%rbx), %rax
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcf30
movq %rax, 0x10158(%rbx)
andl $0x0, 0xe8(%rbx)
movl $0x10178, %edi          # imm = 0x10178
callq 0xcab0
andl $0x0, 0x70(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x10160(%rbx)
testq %rax, %rax
je 0xd708
movq %rax, %r14
andq $0x0, 0x10200(%rsp)
movb $0x1, %al
cmpl $0x2, %ebp
jne 0xdd94
movq %r14, 0x60(%rsp)
movq %r12, 0x28(%rsp)
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %r12
pushq $0x2
popq %rcx
movq %r12, %rsi
xorl %edx, %edx
callq 0xc520
testq %rax, %rax
je 0xd724
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %r12
xorl %r14d, %r14d
pushq $0x2
popq %rcx
movq %r12, %rsi
xorl %edx, %edx
callq 0xc520
testq %rax, %rax
jne 0xda9d
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
callq 0xcf30
movl $0xffff, %r14d          # imm = 0xFFFF
cmpq %r14, %rax
movq %rax, 0x8(%rsp)
cmovbq %rax, %r14
movl $0x404, %edi            # imm = 0x404
callq 0xcab0
testq %rax, %rax
je 0xda9a
movq %rax, %r13
pushq $0x4
popq %rbx
cmpq %r14, %rbx
jae 0xda8a
addq $0x400, %rbx            # imm = 0x400
cmpq %r14, %rbx
cmovaeq %r14, %rbx
movq 0x8(%rsp), %rbp
subq %rbx, %rbp
movl $0x404, %eax            # imm = 0x404
cmpq %rax, %rbx
movl $0x404, %r15d           # imm = 0x404
cmovbq %rbx, %r15
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xc520
testq %rax, %rax
jne 0xda8a
movq 0xc8(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq *0x98(%rsp)
cmpq %r15, %rax
jne 0xda8a
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
addl %eax, %r15d
decq %r15
leal 0x1(%r15), %eax
testl %eax, %eax
jle 0xd650
cmpb $0x50, (%r13,%r15)
jne 0xd6c8
cmpb $0x4b, 0x1(%r13,%r15)
jne 0xd6c8
cmpb $0x5, 0x2(%r13,%r15)
jne 0xd6c8
cmpb $0x6, 0x3(%r13,%r15)
jne 0xd6c8
movl %r15d, %r15d
addq %rbp, %r15
je 0xd650
jmp 0xda8d
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq *0xb8(%rsp)
jmp 0xddd5
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
callq 0xcf30
movl $0xffff, %r14d          # imm = 0xFFFF
cmpq %r14, %rax
movq %rax, 0x8(%rsp)
cmovbq %rax, %r14
movl $0x404, %edi            # imm = 0x404
callq 0xcab0
testq %rax, %rax
je 0xd5f0
movq %rax, %r15
pushq $0x4
popq %r13
cmpq %r14, %r13
jae 0xd804
addq $0x400, %r13            # imm = 0x400
cmpq %r14, %r13
cmovaeq %r14, %r13
movq 0x8(%rsp), %rbx
subq %r13, %rbx
movl $0x404, %eax            # imm = 0x404
cmpq %rax, %r13
movl $0x404, %ebp            # imm = 0x404
cmovbq %r13, %rbp
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc520
testq %rax, %rax
jne 0xd804
movq 0xc8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq *0x98(%rsp)
cmpq %rbp, %rax
jne 0xd804
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
addl %eax, %ebp
decq %rbp
leal 0x1(%rbp), %eax
testl %eax, %eax
jle 0xd760
cmpb $0x50, (%r15,%rbp)
jne 0xd7ce
cmpb $0x4b, 0x1(%r15,%rbp)
jne 0xd7ce
cmpb $0x6, 0x2(%r15,%rbp)
jne 0xd7ce
cmpb $0x7, 0x3(%r15,%rbp)
jne 0xd7ce
movl %ebp, %ebp
addq %rbx, %rbp
je 0xd760
jmp 0xd806
xorl %ebp, %ebp
movq %r15, %rdi
callq 0xc0d0
testq %rbp, %rbp
je 0xd5f0
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xc520
testq %rax, %rax
jne 0xd5f0
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
callq 0xf5c6
testl %eax, %eax
jne 0xd5f0
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
callq 0xf5c6
testl %eax, %eax
jne 0xd5f0
cmpq $0x0, 0x18(%rsp)
jne 0xd5f0
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %r12, %rsi
callq 0xf69a
testl %eax, %eax
jne 0xd5f0
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
callq 0xf5c6
testl %eax, %eax
jne 0xd5f0
cmpq $0x1, 0x18(%rsp)
jne 0xd5f0
movq 0x50(%rsp), %rbx
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc520
testq %rax, %rax
jne 0xd5f0
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
callq 0xf5c6
testl %eax, %eax
jne 0xd5f0
cmpq $0x6064b50, 0x18(%rsp)  # imm = 0x6064B50
jne 0xd5f0
testq %rbx, %rbx
je 0xd5f0
movq %rbx, %r14
leaq 0x90(%rsp), %r12
movq 0x58(%r12), %rsi
movq %r12, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc520
testq %rax, %rax
setne 0x8(%rsp)
movq 0x58(%r12), %rsi
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0xf5c6
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x78(%rsp), %rdx
movq %r12, %rdi
callq 0xf69a
movl %eax, %ebx
orl %ebp, %ebx
movq 0x58(%r12), %rsi
leaq 0x88(%rsp), %rdx
movq %r12, %rdi
callq 0xf7f3
movl %eax, 0x20(%rsp)
movq 0x58(%r12), %rsi
leaq 0x80(%rsp), %rdx
movq %r12, %rdi
callq 0xf7f3
movl %eax, %r13d
movq 0x58(%r12), %rsi
leaq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0xf5c6
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x38(%rsp), %rdx
movq %r12, %rdi
callq 0xf5c6
movl %eax, %r15d
orl %ebp, %r15d
movq 0x58(%r12), %rsi
leaq 0x70(%rsp), %rdx
movq %r12, %rdi
callq 0xf69a
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x68(%rsp), %rdx
movq %r12, %rdi
callq 0xf69a
orl %ebp, %eax
orl %r15d, %eax
orl 0x20(%rsp), %r13d
orl %eax, %r13d
orl %ebx, %r13d
movq %r14, %r13
setne %al
orb 0x8(%rsp), %al
movzbl %al, %eax
negl %eax
leaq 0x68(%rsp), %rcx
movq (%rcx), %rdx
leaq 0x70(%rsp), %rcx
movq (%rcx), %rcx
movq %rdx, 0x30(%rsp)
xorq %rdx, %rcx
leaq 0x38(%rsp), %rdx
orq (%rdx), %rcx
leaq 0x40(%rsp), %rdx
orq (%rdx), %rcx
pushq $-0x67
popq %r14
cmovel %eax, %r14d
movq 0x58(%r12), %rsi
leaq 0x18(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rdx
callq 0xf69a
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x50(%rsp), %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0xf69a
orl %ebp, %eax
pushq $-0x1
popq %rax
cmovel %r14d, %eax
andq $0x0, 0x48(%rsp)
movq (%r15), %rcx
movq %rcx, 0x8(%rsp)
movq (%rbx), %r14
movq 0x28(%rsp), %r12
jmp 0xdc1f
xorl %r15d, %r15d
movq %r13, %rdi
callq 0xc0d0
movq %r15, %r14
jmp 0xda9d
xorl %r14d, %r14d
leaq 0x90(%rsp), %rbx
movq 0x58(%rbx), %rsi
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r14, 0x20(%rsp)
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xc520
movq %rax, 0x8(%rsp)
movq 0x58(%rbx), %rsi
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0xf5c6
movl %eax, %r12d
movq 0x58(%rbx), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0xf7f3
movl %eax, %r15d
movq 0x58(%rbx), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0xf7f3
movl %eax, %r13d
movq 0x58(%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xf7f3
testl %eax, %eax
je 0xdb1d
pushq $-0x1
popq %rax
movl %eax, 0x8(%rsp)
jmp 0xdb3f
cmpq $0x0, 0x8(%rsp)
setne %al
orl %r12d, %r15d
orl %r15d, %r13d
setne %cl
orb %al, %cl
movzbl %cl, %eax
negl %eax
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rbp
leaq 0x90(%rsp), %r15
movq 0x58(%r15), %rsi
leaq 0x10(%rsp), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0xf7f3
movl %eax, %ebx
xorl %r14d, %r14d
movl $0x0, %eax
testl %ebx, %ebx
jne 0xdb6e
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %r13
movq 0x40(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xe8(%rsp), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0xf5c6
testl %eax, %eax
je 0xdb9f
pushq $-0x1
popq %r15
jmp 0xdbc3
xorl %eax, %eax
negl %ebx
sbbl %eax, %eax
orl 0x8(%rsp), %eax
xorq 0x30(%rsp), %rbp
orq %r13, %rbp
orq 0x58(%rsp), %rbp
pushq $-0x67
popq %r15
cmovel %eax, %r15d
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %r12
movq 0x20(%rsp), %r13
leaq 0x90(%rsp), %rbx
movq 0x58(%rbx), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0xf5c6
movl %eax, %ebp
testl %eax, %eax
jne 0xdbf8
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0xdc01
movq $0x0, 0x8(%rsp)
movq 0xe8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0xf7f3
orl %ebp, %eax
pushq $-0x1
popq %rax
cmovel %r15d, %eax
movq 0x8(%rsp), %rcx
addq %r14, %rcx
subq %rcx, %r13
jb 0xdd2a
testl %eax, %eax
jne 0xdd2a
movq 0x48(%rsp), %rbx
testq %rbx, %rbx
je 0xdc81
leaq 0x1(%rbx), %rdi
callq 0xcab0
movq %rax, 0x10200(%rsp)
testq %rax, %rax
je 0xdc81
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq *0x98(%rsp)
movq 0x10200(%rsp), %rcx
movb $0x0, (%rcx,%rax)
leaq 0xf0(%rsp), %r15
pushq $-0x1
popq %r12
movq %r13, 0x10100(%r15)
movl $0xff0, %ebx            # imm = 0xFF0
movl $0xff0, %edi            # imm = 0xFF0
callq 0xcab0
movq %r13, %rcx
movq %rax, %r13
movq -0x8(%r15), %rsi
movq %rcx, 0x20(%rsp)
movq 0x8(%rsp), %rdx
addq %rcx, %rdx
leaq 0x90(%rsp), %rdi
xorl %ebp, %ebp
movq %rdx, 0x8(%rsp)
xorl %ecx, %ecx
callq 0xc520
negq %rax
sbbl %ebp, %ebp
testq %r14, %r14
je 0xdd45
testl %ebp, %ebp
jne 0xdd45
cmpq %rbx, %r14
movl $0xff0, %r15d           # imm = 0xFF0
cmovbq %r14, %r15
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movq %r13, %rdx
movq %r15, %rcx
callq *0x98(%rsp)
movl %r12d, %ebp
cmpq %r15, %rax
jne 0xdd25
leaq 0xf0(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xeff5
movl %eax, %ebp
subq %r15, %r14
jmp 0xdcd5
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq *0xb8(%rsp)
xorl %eax, %eax
jmp 0xdd8f
testl %ebp, %ebp
sete %bl
movq %r13, %rdi
callq 0xc0d0
leaq 0x90(%rsp), %rdi
movq 0x20(%rsp), %rax
movq %rax, 0x10158(%rdi)
movq 0x30(%rsp), %rax
movq %rax, 0x10168(%rdi)
movq 0x58(%rdi), %rsi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0xc520
testq %rax, %rax
sete %al
andb %bl, %al
movq 0x28(%rsp), %r12
movq 0x60(%rsp), %r14
testq %r12, %r12
je 0xdda5
movq 0x10200(%rsp), %rcx
movq %rcx, (%r12)
testb %al, %al
je 0xddc0
leaq 0x90(%rsp), %rsi
movl $0x10178, %edx          # imm = 0x10178
movq %r14, %rdi
callq 0xc960
jmp 0xddd8
movq 0x10200(%rsp), %rdi
callq 0xc0d0
movq %r14, %rdi
callq 0xc0d0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10208, %rsp          # imm = 0x10208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq