// File: /workspace/github_c_makefile_star2_O3/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 0x10031
movq %rcx, %rax
leaq 0x90(%rsp), %rdi
movl $0xb, %ecx
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
jmp 0x1003e
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 0xd0b0
movq %rax, 0x58(%r14)
testq %rax, %rax
je 0x10993
cmpl $0x1, %ebp
jne 0x1008f
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl $0x2, %ecx
callq 0xc4e0
movq 0x58(%rbx), %rax
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xceb0
movq %rax, 0x10158(%rbx)
xorl %r14d, %r14d
movl %r14d, 0xe8(%rbx)
movl $0x10178, %edi          # imm = 0x10178
callq 0xca50
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
movl %r14d, 0x70(%rbx)
movups %xmm0, 0x10160(%rbx)
testq %rax, %rax
je 0x104d5
movq %rax, %r13
movq $0x0, 0x10200(%rsp)
movb $0x1, %al
cmpl $0x2, %ebp
jne 0x10952
movq %r13, 0x30(%rsp)
movq %r12, 0x38(%rsp)
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %r12
movq %r12, %rsi
xorl %edx, %edx
movl $0x2, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x104f9
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
callq 0xceb0
movq %rax, %rbx
movl $0xffff, %eax           # imm = 0xFFFF
cmpq %rax, %rbx
cmovbq %rbx, %rax
movq %rax, 0x10(%rsp)
movl $0x404, %edi            # imm = 0x404
callq 0xca50
testq %rax, %rax
je 0x104f9
movq %rax, %r13
movq %rbx, 0x8(%rsp)
cmpq $0x5, %rbx
jb 0x104f1
movl $0x4, %r14d
movq %r12, 0x18(%rsp)
movq %r14, %r15
addq $0x400, %r15            # imm = 0x400
movq 0x10(%rsp), %r14
cmpq %r14, %r15
cmovbq %r15, %r14
movq 0x8(%rsp), %rbx
subq %r14, %rbx
movl $0x404, %eax            # imm = 0x404
cmpq %rax, %r14
movl $0x404, %ebp            # imm = 0x404
cmovbq %r14, %rbp
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x104f1
movq 0xc8(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq *0x98(%rsp)
cmpq %rbp, %rax
jne 0x104f1
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
leal (%rax,%rbp), %r12d
addl $-0x3, %ebp
cmpb $0x50, (%r13,%r12)
jne 0x1020e
cmpb $0x4b, 0x1(%r13,%r12)
jne 0x1020e
cmpb $0x6, 0x2(%r13,%r12)
jne 0x1020e
cmpb $0x7, 0x3(%r13,%r12)
je 0x1022a
decq %r12
decl %ebp
jg 0x101ee
cmpq 0x10(%rsp), %r15
movq 0x18(%rsp), %r12
jb 0x10174
jmp 0x104f1
addq %r12, %rbx
je 0x10215
movq %r13, %rdi
callq 0xc0c0
movq 0x8(%rsp), %rdx
cmpq %r15, %rdx
cmovbq %rdx, %r15
movl $0xffff, %eax           # imm = 0xFFFF
cmpq %rax, %r15
cmovaeq %rax, %r15
subq %r15, %rdx
addq %r12, %rdx
leaq 0x90(%rsp), %rdi
movq 0x18(%rsp), %rbx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x104f9
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbx, %rsi
callq 0x1280c
testl %eax, %eax
jne 0x104f9
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbx, %rsi
callq 0x1280c
testl %eax, %eax
jne 0x104f9
cmpq $0x0, 0x28(%rsp)
jne 0x104f9
leaq 0x90(%rsp), %rdi
leaq 0x58(%rsp), %rdx
movq %rbx, %rsi
callq 0x128c4
testl %eax, %eax
jne 0x104f9
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbx, %rsi
callq 0x1280c
testl %eax, %eax
jne 0x104f9
cmpq $0x1, 0x28(%rsp)
jne 0x104f9
movq 0x58(%rsp), %rdx
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
movq %rdx, 0x10(%rsp)
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x104f9
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbx, %rsi
callq 0x1280c
testl %eax, %eax
jne 0x104f9
cmpq $0x6064b50, 0x28(%rsp)  # imm = 0x6064B50
jne 0x104f9
cmpq $0x0, 0x10(%rsp)
je 0x104f9
leaq 0x90(%rsp), %r12
movq 0x58(%r12), %rsi
movq %r12, %rdi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
setne 0x18(%rsp)
movq 0x58(%r12), %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rdi
callq 0x1280c
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x70(%rsp), %rdx
movq %r12, %rdi
callq 0x128c4
movl %eax, %ebx
orl %ebp, %ebx
movq 0x58(%r12), %rsi
leaq 0x80(%rsp), %rdx
movq %r12, %rdi
callq 0x12a1b
movl %eax, 0x8(%rsp)
movq 0x58(%r12), %rsi
leaq 0x78(%rsp), %rdx
movq %r12, %rdi
callq 0x12a1b
movl %eax, %r13d
movq 0x58(%r12), %rsi
leaq 0x48(%rsp), %rdx
movq %r12, %rdi
callq 0x1280c
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x1280c
movl %eax, %r15d
orl %ebp, %r15d
movq 0x58(%r12), %rsi
leaq 0x68(%rsp), %rdx
movq %r12, %rdi
callq 0x128c4
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x88(%rsp), %r14
movq %r12, %rdi
movq %r14, %rdx
callq 0x128c4
orl %ebp, %eax
orl %r15d, %eax
orl 0x8(%rsp), %r13d
orl %eax, %r13d
orl %ebx, %r13d
setne %al
orb 0x18(%rsp), %al
movzbl %al, %eax
negl %eax
movq (%r14), %rdx
leaq 0x68(%rsp), %rcx
movq (%rcx), %rcx
movq %rdx, 0x18(%rsp)
xorq %rdx, %rcx
leaq 0x40(%rsp), %rdx
orq (%rdx), %rcx
leaq 0x48(%rsp), %rdx
orq (%rdx), %rcx
movl $0xffffff99, %r14d      # imm = 0xFFFFFF99
cmovel %eax, %r14d
movq 0x58(%r12), %rsi
leaq 0x28(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x128c4
movl %eax, %ebp
movq 0x58(%r12), %rsi
leaq 0x58(%rsp), %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0x128c4
orl %ebp, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %r14d, %eax
movq $0x0, 0x50(%rsp)
movq (%r15), %rcx
movq %rcx, 0x8(%rsp)
movq (%rbx), %r14
movq 0x38(%rsp), %r12
movq 0x30(%rsp), %r13
jmp 0x107d0
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq *0xb8(%rsp)
jmp 0x10993
movq %r13, %rdi
callq 0xc0c0
leaq 0x90(%rsp), %rdi
movq 0x58(%rdi), %r12
xorl %r14d, %r14d
movq %r12, %rsi
xorl %edx, %edx
movl $0x2, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x10648
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
callq 0xceb0
movq %rax, %rbp
movl $0xffff, %r15d          # imm = 0xFFFF
cmpq %r15, %rax
cmovbq %rax, %r15
movl $0x404, %edi            # imm = 0x404
callq 0xca50
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x10645
cmpq $0x5, %rbp
jb 0x10636
movq %rbp, %rax
negq %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
addq $0x3, %rax
movq %rax, 0x18(%rsp)
movl $0x4, %r14d
movq %r14, %r13
addq $0x400, %r13            # imm = 0x400
cmpq %r15, %r13
movq %r15, %r14
cmovbq %r13, %r14
movq %rbp, %rdx
subq %r14, %rdx
movl $0x404, %eax            # imm = 0x404
cmpq %rax, %r14
movl $0x404, %ebx            # imm = 0x404
cmovbq %r14, %rbx
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xc4e0
testq %rax, %rax
jne 0x10636
movq 0xc8(%rsp), %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq *0x98(%rsp)
cmpq %rbx, %rax
jne 0x10636
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
leal (%rbx,%rax), %ecx
movq 0x8(%rsp), %rax
addq %r14, %rax
subq %rcx, %rax
addl $-0x3, %ebx
addq 0x18(%rsp), %rcx
cmpb $0x50, -0x3(%rcx)
jne 0x10614
cmpb $0x4b, -0x2(%rcx)
jne 0x10614
cmpb $0x5, -0x1(%rcx)
jne 0x10614
cmpb $0x6, (%rcx)
je 0x10629
incq %rax
decq %rcx
decl %ebx
jg 0x105fd
cmpq %r15, %r13
jb 0x10581
jmp 0x10636
testq %rax, %rax
je 0x1061e
negq %rax
movq %rax, %r14
jmp 0x10639
xorl %r14d, %r14d
movq 0x10(%rsp), %rdi
callq 0xc0c0
jmp 0x10648
xorl %r14d, %r14d
leaq 0x90(%rsp), %rbx
movq 0x58(%rbx), %rsi
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xc4e0
movq %rax, 0x8(%rsp)
movq 0x58(%rbx), %rsi
leaq 0x20(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1280c
movl %eax, %r12d
movq 0x58(%rbx), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x12a1b
movl %eax, %r13d
movq 0x58(%rbx), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x12a1b
movl %eax, %r15d
movq 0x58(%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x12a1b
testl %eax, %eax
je 0x106c9
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
jmp 0x106eb
cmpq $0x0, 0x8(%rsp)
setne %al
orl %r12d, %r13d
orl %r13d, %r15d
setne %cl
orb %al, %cl
movzbl %cl, %eax
negl %eax
movl %eax, 0x8(%rsp)
movq 0x20(%rsp), %rbp
leaq 0x90(%rsp), %r12
movq 0x58(%r12), %rsi
leaq 0x20(%rsp), %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0x12a1b
movl %eax, %ebx
xorl %r14d, %r14d
movl $0x0, %eax
testl %ebx, %ebx
jne 0x1071b
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xe8(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x1280c
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x10772
xorl %eax, %eax
negl %ebx
sbbl %eax, %eax
orl 0x8(%rsp), %eax
xorq 0x18(%rsp), %rbp
orq %r13, %rbp
orq 0x60(%rsp), %rbp
movl $0xffffff99, %r15d      # imm = 0xFFFFFF99
cmovel %eax, %r15d
movq 0x20(%rsp), %r14
leaq 0x90(%rsp), %rbx
movq 0x58(%rbx), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x1280c
movl %eax, %ebp
testl %eax, %eax
jne 0x1079d
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x107a6
movq $0x0, 0x8(%rsp)
movq 0x38(%rsp), %r12
movq 0x30(%rsp), %r13
movq 0xe8(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0x12a1b
orl %ebp, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %r15d, %eax
movq 0x8(%rsp), %rbp
leaq (%r14,%rbp), %rcx
movq 0x10(%rsp), %rdx
subq %rcx, %rdx
jb 0x108e3
testl %eax, %eax
jne 0x108e3
movq %rdx, 0x10(%rsp)
movq 0x50(%rsp), %rbx
testq %rbx, %rbx
je 0x1083d
leaq 0x1(%rbx), %rdi
callq 0xca50
movq %rax, 0x10200(%rsp)
testq %rax, %rax
je 0x1083d
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 0x90(%rsp), %r15
movq 0x10(%rsp), %rbx
movq %rbx, 0x10160(%r15)
movl $0xff0, %edi            # imm = 0xFF0
callq 0xca50
movq %rax, %r13
movq 0x58(%r15), %rsi
addq %rbx, %rbp
xorl %ebx, %ebx
movq %r15, %rdi
movq %rbp, 0x8(%rsp)
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xc4e0
movq %rax, %rcx
negq %rcx
sbbl %ebx, %ebx
testq %r14, %r14
je 0x10903
testq %rax, %rax
jne 0x10903
leaq 0xf0(%rsp), %rbp
movl $0xff0, %r12d           # imm = 0xFF0
cmpq %r12, %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)
cmpq %r15, %rax
jne 0x108fe
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x11f7d
movl %eax, %ebx
subq %r15, %r14
je 0x10903
testl %ebx, %ebx
je 0x10899
jmp 0x10903
movq 0xc8(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq *0xb8(%rsp)
xorl %eax, %eax
jmp 0x10952
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r13, %rdi
callq 0xc0c0
leaq 0x90(%rsp), %rdi
movq 0x10(%rsp), %rax
movq %rax, 0x10158(%rdi)
movq 0x18(%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 %ebx, %ebx
sete %al
andb %cl, %al
movq 0x38(%rsp), %r12
movq 0x30(%rsp), %r13
testq %r12, %r12
je 0x10963
movq 0x10200(%rsp), %rcx
movq %rcx, (%r12)
testb %al, %al
je 0x1097e
leaq 0x90(%rsp), %rsi
movl $0x10178, %edx          # imm = 0x10178
movq %r13, %rdi
callq 0xc900
jmp 0x10996
movq 0x10200(%rsp), %rdi
callq 0xc0c0
movq %r13, %rdi
callq 0xc0c0
xorl %r13d, %r13d
movq %r13, %rax
addq $0x10208, %rsp          # imm = 0x10208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq