// File: /workspace/github_c_makefile_star2_O1/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, 0x70(%rsp)
movl %esi, %ebx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0xd8(%rsp)
testq %rcx, %rcx
je 0xfc8b
movq %rcx, %rax
leaq 0x90(%rsp), %rdi
movl $0xb, %ecx
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
jmp 0xfc98
leaq 0x90(%rsp), %rdi
callq 0xc070
xorl %eax, %eax
testl %ebx, %ebx
sete %al
leal 0x7(,%rax,4), %edx
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xd0b0
movq %rax, 0x58(%r15)
testq %rax, %rax
je 0x1052b
cmpl $0x1, %ebx
jne 0xfce2
leaq 0x90(%rsp), %rdi
movq %rax, %rsi
xorl %edx, %edx
movl $0x2, %ecx
callq 0xc4e0
leaq 0x90(%rsp), %r15
movq 0x58(%r15), %rsi
movq %r15, %rdi
callq 0xceb0
movq %rax, 0x10158(%r15)
xorl %ebp, %ebp
movl %ebp, 0xe8(%r15)
movl $0x10178, %edi          # imm = 0x10178
callq 0xca50
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r15)
movl %ebp, 0x70(%r15)
movups %xmm0, 0x10160(%r15)
testq %rax, %rax
je 0xfe90
movq %rax, %r14
movq $0x0, 0x10200(%rsp)
movb $0x1, %al
cmpl $0x2, %ebx
jne 0x104e6
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %rbx
xorl %r15d, %r15d
movq %rbx, %rsi
xorl %edx, %edx
movl $0x2, %ecx
callq 0xc4e0
testq %rax, %rax
movq %r14, 0x48(%rsp)
jne 0xfefd
leaq 0x90(%rsp), %rdi
movq %rbx, 0x8(%rsp)
movq %rbx, %rsi
callq 0xceb0
movl $0xffff, %ebx           # imm = 0xFFFF
cmpq %rbx, %rax
movq %rax, (%rsp)
cmovbq %rax, %rbx
movl $0x404, %edi            # imm = 0x404
callq 0xca50
testq %rax, %rax
je 0xfefa
movq %rax, %rbp
movl $0x4, %r15d
movq $0x0, 0x10(%rsp)
movq %rbx, 0x28(%rsp)
movq 0x8(%rsp), %r14
cmpq %rbx, %r15
jae 0xfeac
addq $0x400, %r15            # imm = 0x400
cmpq %rbx, %r15
cmovaeq %rbx, %r15
movq (%rsp), %r12
subq %r15, %r12
movl $0x404, %eax            # imm = 0x404
cmpq %rax, %r15
movl $0x404, %ebx            # imm = 0x404
cmovbq %r15, %rbx
xorl %r13d, %r13d
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0xfe79
movq 0xc8(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq *0x98(%rsp)
cmpq %rbx, %rax
jne 0xfe76
cmpq $0x4, (%rsp)
jb 0xfe63
addq $-0x4, %rbx
cmpb $0x50, (%rbp,%rbx)
jne 0xfe57
cmpb $0x4b, 0x1(%rbp,%rbx)
jne 0xfe57
cmpb $0x6, 0x2(%rbp,%rbx)
jne 0xfe57
cmpb $0x7, 0x3(%rbp,%rbx)
je 0xfe89
leaq -0x1(%rbx), %rax
testq %rbx, %rbx
movq %rax, %rbx
jg 0xfe3b
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
sete %r13b
jmp 0xfe79
xorl %r13d, %r13d
movq 0x28(%rsp), %rbx
testb %r13b, %r13b
jne 0xfdc7
jmp 0xfeac
movl %ebx, %eax
addq %r12, %rax
jmp 0xfe68
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq *0xb8(%rsp)
jmp 0x1052b
movq %rbp, %rdi
callq 0xc0c0
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0xfefa
leaq 0x90(%rsp), %rdi
xorl %r15d, %r15d
movq 0x8(%rsp), %r14
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0xfefd
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r14, %rsi
callq 0x125a0
testl %eax, %eax
je 0x10543
xorl %r15d, %r15d
movq %r15, %rbx
testq %r15, %r15
jne 0x1006f
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %r14
xorl %ebx, %ebx
movq %r14, %rsi
xorl %edx, %edx
movl $0x2, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x1006f
movq %r15, 0x68(%rsp)
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0xceb0
movl $0xffff, %ebx           # imm = 0xFFFF
cmpq %rbx, %rax
movq %rax, 0x8(%rsp)
cmovbq %rax, %rbx
movl $0x404, %edi            # imm = 0x404
callq 0xca50
testq %rax, %rax
je 0x10068
movq %rax, %rbp
movq %r14, 0x28(%rsp)
movl $0x4, %r14d
movq $0x0, (%rsp)
movq %rbx, 0x10(%rsp)
cmpq %rbx, %r14
jae 0x1005a
addq $0x400, %r14            # imm = 0x400
cmpq %rbx, %r14
cmovaeq %rbx, %r14
movq 0x8(%rsp), %r13
subq %r14, %r13
movl $0x404, %eax            # imm = 0x404
cmpq %rax, %r14
movl $0x404, %r15d           # imm = 0x404
cmovbq %r14, %r15
xorl %r12d, %r12d
leaq 0x90(%rsp), %rdi
movq 0x28(%rsp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x1003e
movq 0xc8(%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq *0x98(%rsp)
cmpq %r15, %rax
jne 0x1003b
cmpq $0x4, 0x8(%rsp)
movq 0x10(%rsp), %rbx
jb 0x10030
addq $-0x4, %r15
cmpb $0x50, (%rbp,%r15)
jne 0x10024
cmpb $0x4b, 0x1(%rbp,%r15)
jne 0x10024
cmpb $0x5, 0x2(%rbp,%r15)
jne 0x10024
cmpb $0x6, 0x3(%rbp,%r15)
je 0x1004e
leaq -0x1(%r15), %rax
testq %r15, %r15
movq %rax, %r15
jg 0x10004
cmpq $0x0, (%rsp)
sete %r12b
jmp 0x10043
xorl %r12d, %r12d
movq 0x10(%rsp), %rbx
testb %r12b, %r12b
jne 0xff83
jmp 0x1005a
movl %r15d, %eax
addq %r13, %rax
movq %rax, (%rsp)
jmp 0x10030
movq %rbp, %rdi
callq 0xc0c0
movq (%rsp), %rbx
jmp 0x1006a
xorl %ebx, %ebx
movq 0x68(%rsp), %r15
testq %r15, %r15
je 0x101da
leaq 0x90(%rsp), %r12
movq 0x58(%r12), %rsi
movq %r12, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
setne (%rsp)
movq 0x58(%r12), %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rdi
callq 0x125a0
movl %eax, 0x8(%rsp)
movq 0x58(%r12), %rsi
leaq 0x78(%rsp), %rdx
movq %r12, %rdi
callq 0x12647
movl %eax, 0x28(%rsp)
movq 0x58(%r12), %rsi
leaq 0x88(%rsp), %rdx
movq %r12, %rdi
callq 0x127c9
movl %eax, 0x10(%rsp)
movq 0x58(%r12), %rsi
leaq 0x80(%rsp), %rdx
movq %r12, %rdi
callq 0x127c9
movl %eax, %r13d
movq 0x58(%r12), %rsi
leaq 0x60(%rsp), %rdx
movq %r12, %rdi
callq 0x125a0
movq %rbx, %r14
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x58(%rsp), %rdx
movq %r12, %rdi
callq 0x125a0
movl %eax, %ebx
movq 0x58(%r12), %rsi
leaq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x12647
movl %eax, %r15d
movq 0x58(%r12), %rsi
leaq 0x30(%rsp), %rdx
movq %r12, %rdi
callq 0x12647
orl %r15d, %eax
movq %r14, %r15
orl %ebp, %ebx
orl %eax, %ebx
orl 0x10(%rsp), %r13d
orl 0x28(%rsp), %r13d
orl %ebx, %r13d
orl 0x8(%rsp), %r13d
setne %al
orb (%rsp), %al
movzbl %al, %eax
negl %eax
leaq 0x30(%rsp), %rcx
movq (%rcx), %rcx
leaq 0x40(%rsp), %rdx
xorq (%rdx), %rcx
leaq 0x58(%rsp), %rdx
orq (%rdx), %rcx
leaq 0x60(%rsp), %rdx
orq (%rdx), %rcx
movl $0xffffff99, %ebp       # imm = 0xFFFFFF99
cmovel %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x12647
movl %eax, %ebx
movq 0x58(%r12), %rsi
leaq 0x38(%rsp), %rdx
movq %r12, %rdi
callq 0x12647
orl %ebx, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovel %ebp, %ecx
movq $0x0, 0x50(%rsp)
movq 0x48(%rsp), %r14
jmp 0x1036d
leaq 0x90(%rsp), %r15
movq 0x58(%r15), %rsi
movq %r15, %rdi
movq %rbx, (%rsp)
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc4e0
movq %rax, %rbx
movq 0x58(%r15), %rsi
leaq 0x20(%rsp), %r14
movq %r15, %rdi
movq %r14, %rdx
callq 0x125a0
movl %eax, %ebp
movq 0x58(%r15), %rsi
leaq 0x60(%rsp), %rdx
movq %r15, %rdi
callq 0x127c9
movl %eax, %r12d
movq 0x58(%r15), %rsi
leaq 0x58(%rsp), %rdx
movq %r15, %rdi
callq 0x127c9
movl %eax, %r13d
movq $0x0, 0x40(%rsp)
movq 0x58(%r15), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x127c9
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x10282
orl %r12d, %r13d
testq %rbx, %rbx
setne %al
orl %ebp, %r13d
setne %cl
orb %al, %cl
movzbl %cl, %r15d
negl %r15d
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %rsi
leaq 0x20(%rsp), %rdx
callq 0x127c9
testl %eax, %eax
jne 0x102b2
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
movl %r15d, %r14d
movl %r14d, 0x8(%rsp)
movq 0x30(%rsp), %r15
movq 0x40(%rsp), %r14
movq 0x58(%rsp), %r13
movq 0x60(%rsp), %r12
movq $0x0, 0x18(%rsp)
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %rsi
leaq 0x20(%rsp), %rdx
callq 0x125a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x10317
xorq %r14, %r15
orq %r13, %r15
orq %r12, %r15
movl $0xffffff99, %eax       # imm = 0xFFFFFF99
movl 0x8(%rsp), %ebp
cmovnel %eax, %ebp
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %rsi
leaq 0x20(%rsp), %rdx
callq 0x125a0
testl %eax, %eax
jne 0x10346
movq 0x20(%rsp), %rax
movq %rax, 0x38(%rsp)
movl %ebp, %ebx
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %rsi
leaq 0x50(%rsp), %rdx
callq 0x127c9
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
orl %ebx, %ecx
movq 0x48(%rsp), %r14
movq (%rsp), %r15
movq 0x38(%rsp), %r13
movq 0x18(%rsp), %r12
leaq (%r12,%r13), %rax
subq %rax, %r15
jb 0x104cd
testl %ecx, %ecx
jne 0x104cd
movq 0x50(%rsp), %rbx
testq %rbx, %rbx
je 0x103da
leaq 0x1(%rbx), %rdi
callq 0xca50
movq %rax, 0x10200(%rsp)
testq %rax, %rax
je 0x103da
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq *0x98(%rsp)
movq %rax, 0x50(%rsp)
movq 0x10200(%rsp), %rcx
movb $0x0, (%rcx,%rax)
leaq 0x90(%rsp), %r14
movq %r15, 0x10160(%r14)
movl $0xff0, %edi            # imm = 0xFF0
callq 0xca50
movq %rax, %rbx
movq 0x58(%r14), %rsi
movq %r15, (%rsp)
addq %r15, %r13
xorl %ebp, %ebp
movq %r14, %rdi
movq %r13, 0x8(%rsp)
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xc4e0
movq %rax, %rcx
negq %rcx
sbbl %ebp, %ebp
testq %r12, %r12
je 0x10482
testq %rax, %rax
jne 0x10482
leaq 0xf0(%rsp), %r15
movl $0xff0, %r14d           # imm = 0xFF0
cmpq %r14, %r12
movl $0xff0, %r13d           # imm = 0xFF0
cmovbq %r12, %r13
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq *0x98(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %r13, %rax
jne 0x10479
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x11ccc
movl %eax, %ebp
subq %r13, %r12
je 0x10482
testl %ebp, %ebp
je 0x10435
movq %rbx, %rdi
callq 0xc0c0
leaq 0x90(%rsp), %rdi
movq (%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 0xc4e0
testq %rax, %rax
sete %cl
testl %ebp, %ebp
sete %al
andb %cl, %al
movq 0x48(%rsp), %r14
jmp 0x104e6
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq *0xb8(%rsp)
xorl %eax, %eax
movq 0x70(%rsp), %rdx
testq %rdx, %rdx
je 0x104fb
movq 0x10200(%rsp), %rcx
movq %rcx, (%rdx)
testb %al, %al
je 0x10516
leaq 0x90(%rsp), %rsi
movl $0x10178, %edx          # imm = 0x10178
movq %r14, %rdi
callq 0xc900
jmp 0x1052e
movq 0x10200(%rsp), %rdi
callq 0xc0c0
movq %r14, %rdi
callq 0xc0c0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10208, %rsp          # imm = 0x10208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r14, %rsi
callq 0x125a0
xorl %r15d, %r15d
testl %eax, %eax
jne 0xfefd
cmpq $0x0, 0x18(%rsp)
jne 0xfefd
leaq 0x90(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %r14, %rsi
callq 0x12647
testl %eax, %eax
jne 0xfefa
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r14, %rsi
callq 0x125a0
xorl %r15d, %r15d
testl %eax, %eax
jne 0xfefd
cmpq $0x1, 0x18(%rsp)
jne 0xfefd
movq 0x38(%rsp), %rbx
leaq 0x90(%rsp), %rdi
xorl %r15d, %r15d
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0xfefd
leaq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x125a0
xorl %ecx, %ecx
cmpq $0x6064b50, (%r12)      # imm = 0x6064B50
cmovneq %rcx, %rbx
testl %eax, %eax
cmovneq %rcx, %rbx
movq %rbx, %r15
jmp 0xfefd