// File: /workspace/github_cpp_makefile_star2_O2/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 0x48e42
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 0xe9(%rip), %rcx        # 0x48eb7
movq %rcx, 0x88(%r14)
movq %rax, (%r14)
movq 0x8(%r15), %rsi
movq %rsi, 0x98(%r14)
leaq 0xd0(%r14), %rdi
addl %ebx, %esi
callq 0x37a01
testb %al, %al
je 0x48e61
movq 0x98(%r14), %rcx
testq %rcx, %rcx
je 0x48e18
movq 0x170(%r14), %rdx
addq %rdx, %rcx
movq %r15, %rdi
xorl %esi, %esi
callq *0x10(%r15)
testl %eax, %eax
je 0x48e8c
orl $-0x1, 0xa4(%r14)
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 0x12e11(%rip), %rdi     # 0x5bc5a
leaq 0x12dd0(%rip), %rsi     # 0x5bc20
leaq 0x12e18(%rip), %rcx     # 0x5bc6f
movl $0xda, %edx
callq 0x4230
leaq 0x12fc7(%rip), %rdi     # 0x5be2f
callq 0x4510
leaq 0x61dc(%rip), %rdi      # 0x4f050
leaq 0x12da5(%rip), %rsi     # 0x5bc20
leaq 0x12ded(%rip), %rcx     # 0x5bc6f
movl $0xf2, %edx
callq 0x4230
leaq 0x13011(%rip), %rdi     # 0x5bea4
callq 0x4510
leaq 0x61b1(%rip), %rdi      # 0x4f050
leaq 0x12d7a(%rip), %rsi     # 0x5bc20
leaq 0x12dc2(%rip), %rcx     # 0x5bc6f
movl $0xf5, %edx
callq 0x4230