// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/patch/NewStream.cpp
// Function: NewStream_open(NewStream*, Zipper*, UnZipper*, unsigned long, bool, unsigned long, hpatch_TStreamInput const*, unsigned int const*, unsigned long, unsigned int*, unsigned long, int, int, unsigned int const*, unsigned long, int)
bool NewStream_open(NewStream* self,Zipper* out_newZip,UnZipper* oldZip,
                    size_t newDataSize,bool newZipIsDataNormalized,
                    size_t newZipCESize,const hpatch_TStreamInput* extraEdit,
                    const uint32_t* samePairList,size_t samePairCount,
                    uint32_t* newRefOtherCompressedList,size_t newRefOtherCompressedCount,
                    int newOtherCompressLevel,int newOtherCompressMemLevel,
                    const uint32_t* reCompressList,size_t reCompressCount,
                    int threadNum _VIRTUAL_IN_D(virtual_in) _VIRTUAL_OUT_D(virtual_out)){
    assert(self->_out_newZip==0);
    self->isFinish=false;
    self->_out_newZip=out_newZip;
    self->_oldZip=oldZip;
    self->_newZipIsDataNormalized=newZipIsDataNormalized;
    self->_newZipCESize=newZipCESize;
    self->_samePairList=samePairList;
    self->_samePairCount=samePairCount;
    self->_newRefOtherCompressedList=newRefOtherCompressedList;
    self->_newRefOtherCompressedCount=newRefOtherCompressedCount;
    self->_newOtherCompressIsValid=(newOtherCompressLevel|newOtherCompressMemLevel)!=0;
    self->_newOtherCompressLevel=newOtherCompressLevel;
    self->_newOtherCompressMemLevel=newOtherCompressMemLevel;
    self->_newReCompressSizeList=reCompressList;
    self->_newReCompressSizeCount=reCompressCount;
    self->_fileCount=out_newZip->_fileEntryMaxCount;
    self->_threadNum=threadNum;
    
    self->_stream.streamImport=self;
    self->_stream.streamSize=newDataSize;
    self->_stream.write=_NewStream_write;
    self->stream=&self->_stream;
    
    self->_extraEditSize=(size_t)extraEdit->streamSize;
    check(UnZipper_openVirtualVCE(&self->_newZipVCE,(ZipFilePos_t)(newZipCESize+self->_extraEditSize),self->_fileCount));
    if (self->_extraEditSize>0){
        check(extraEdit->read(extraEdit,0,self->_newZipVCE._cache_fvce,
                              self->_newZipVCE._cache_fvce+self->_extraEditSize));
    }
    
    self->_curFileIndex=-1;
    self->_curWriteToPosEnd=newZipCESize;
    self->_curSamePairIndex=0;
    self->_curNewOtherCompressIndex=0;
    self->_curNewReCompressSizeIndex=0;
    self->_isAlwaysReCompress=false;
#if (_IS_NEED_VIRTUAL_ZIP)
    self->_vin=virtual_in;
    self->_vout=virtual_out;
#endif
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpq $0x0, 0x10(%rdi)
jne 0x532d7
movq %r9, %rbx
movq %rdi, %r14
movl 0x50(%rsp), %eax
movb $0x0, 0x8(%rdi)
movq %rsi, 0x10(%rdi)
movq %rdx, 0x18(%rdi)
movl 0x48(%rsp), %edx
movb %r8b, 0x20(%rdi)
movq 0x28(%rsp), %rdi
movq %r9, 0x28(%r14)
movq %rdi, 0x30(%r14)
movq 0x30(%rsp), %rdi
movq %rdi, 0x38(%r14)
movq 0x38(%rsp), %rdi
movq %rdi, 0x40(%r14)
movq 0x40(%rsp), %rdi
movq %rdi, 0x48(%r14)
movl %eax, %edi
orl %edx, %edi
setne 0x50(%r14)
movl %edx, 0x54(%r14)
movl 0x68(%rsp), %edi
movl %eax, 0x58(%r14)
movq 0x58(%rsp), %rax
movq %rax, 0x60(%r14)
movq 0x60(%rsp), %rax
movq %rax, 0x68(%r14)
movq 0x20(%rsp), %r15
movl 0x5c(%rsi), %edx
movl %edx, 0x90(%r14)
movl %edi, 0xa0(%r14)
leaq 0x70(%r14), %rax
movq %r14, 0x70(%r14)
movq %rcx, 0x78(%r14)
leaq 0xec(%rip), %rcx        # 0x5334c
movq %rcx, 0x88(%r14)
movq %rax, (%r14)
movq 0x8(%r15), %rsi
movq %rsi, 0x98(%r14)
leaq 0xd0(%r14), %rdi
addl %ebx, %esi
callq 0x40419
testb %al, %al
je 0x532f6
movq 0x98(%r14), %rcx
testq %rcx, %rcx
je 0x532aa
movq 0x170(%r14), %rdx
addq %rdx, %rcx
movq %r15, %rdi
xorl %esi, %esi
callq *0x10(%r15)
testl %eax, %eax
je 0x53321
movl $0xffffffff, 0xa4(%r14) # imm = 0xFFFFFFFF
movq %rbx, 0xa8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0xb0(%r14)
movups %xmm0, 0xb9(%r14)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1391c(%rip), %rdi     # 0x66bfa
leaq 0x138db(%rip), %rsi     # 0x66bc0
leaq 0x13923(%rip), %rcx     # 0x66c0f
movl $0xda, %edx
callq 0x4200
leaq 0x13ad2(%rip), %rdi     # 0x66dcf
callq 0x44e0
leaq 0x6d47(%rip), %rdi      # 0x5a050
leaq 0x138b0(%rip), %rsi     # 0x66bc0
leaq 0x138f8(%rip), %rcx     # 0x66c0f
movl $0xf2, %edx
callq 0x4200
leaq 0x13b1c(%rip), %rdi     # 0x66e44
callq 0x44e0
leaq 0x6d1c(%rip), %rdi      # 0x5a050
leaq 0x13885(%rip), %rsi     # 0x66bc0
leaq 0x138cd(%rip), %rcx     # 0x66c0f
movl $0xf5, %edx
callq 0x4200