LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffStream::TNewDataSubDiffStream(hpatch_TStreamInput const*, hpatch_TStreamInput const*, hdiff_private::TCovers const&, bool, bool)
TNewDataSubDiffStream::TNewDataSubDiffStream(const hdiff_TStreamInput* _newData,const hdiff_TStreamInput* _oldData,
                                             const TCovers& _covers,bool _isOnlySubCover,bool _isZeroSubDiff)
:newData(_newData),oldData(_oldData),covers(_covers),
  isOnlySubCover(_isOnlySubCover),isZeroSubDiff(_isZeroSubDiff),_cache(kSubDiffCacheSize){
    initRead();
    streamImport=this;
    if (isOnlySubCover){
        streamSize=0;
        for (size_t i=0;i<covers.coverCount();++i){
            hpatch_TCover cover;
            covers.covers(i,&cover);
            streamSize+=cover.length;
        }
    }else{
        streamSize=newData->streamSize;
    }
    read=_read;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, 0x48(%rdi)
movq %rdx, 0x50(%rdi)
movq %rcx, 0x58(%rdi)
movb %bpl, 0x60(%rdi)
movb %r9b, 0x61(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rdi)
movq $0x0, 0x78(%rdi)
movl $0x80000, %edi          # imm = 0x80000
callq 0x4400
testq %rax, %rax
je 0x23fcc
movq %rax, 0x68(%rbx)
addq $0x80000, %rax          # imm = 0x80000
movq %rax, 0x70(%rbx)
movq %rax, 0x78(%rbx)
xorl %eax, %eax
movq %rax, 0x20(%rbx)
movq $-0x1, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movq %rax, 0x40(%rbx)
movq %rbx, (%rbx)
testb %bpl, %bpl
je 0x23fae
movq $0x0, 0x8(%rbx)
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x23fb6
movq 0x8(%rbx), %rcx
movb 0x20(%r14), %dl
movq 0x10(%r14), %rsi
movl $0x8, %edi
testb %dl, %dl
je 0x23f98
movl (%rsi,%rdi), %r8d
jmp 0x23f9c
movq (%rsi,%rdi,2), %r8
addq %r8, %rcx
movq %rcx, 0x8(%rbx)
addq $0xc, %rdi
decq %rax
jne 0x23f8e
jmp 0x23fb6
movq 0x8(%r15), %rax
movq %rax, 0x8(%rbx)
leaq 0x6f(%rip), %rax        # 0x2402c
movq %rax, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x3832f(%rip), %rsi     # 0x5c30f
movq %rax, %rdi
callq 0x4110
movq 0x57ff9(%rip), %rsi     # 0x7bfe8
movq 0x57fc2(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffStream::initRead()
void TNewDataSubDiffStream::initRead(){
    curReadNewPos=0;
    curReadOldPos=_kNullPos;
    curReadPos=0;
    nextCoveri=0;
    curDataLen=0;
}

// Assembly:
xorl %eax, %eax
movq %rax, 0x20(%rdi)
movq $-0x1, 0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movq %rax, 0x40(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffStream::_read(hpatch_TStreamInput const*, unsigned long long, unsigned char*, unsigned char*)
hpatch_BOOL TNewDataSubDiffStream::_read(const struct hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
                                             unsigned char* out_data,unsigned char* out_data_end){
    TNewDataSubDiffStream* self=(TNewDataSubDiffStream*)stream->streamImport;
    if (readFromPos==0) self->initRead();
    if (readFromPos!=self->curReadPos) return hpatch_FALSE;
    self->curReadPos+=(size_t)(out_data_end-out_data);
    assert(self->curReadPos<=self->streamSize);
    self->readTo(out_data,out_data_end);
    return hpatch_TRUE;
}

// Assembly:
pushq %rax
movq (%rdi), %rdi
testq %rsi, %rsi
jne 0x2404e
xorl %eax, %eax
movq %rax, 0x20(%rdi)
movq $-0x1, 0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movq %rax, 0x40(%rdi)
movq 0x30(%rdi), %r8
xorl %eax, %eax
cmpq %rsi, %r8
jne 0x2407c
movq %rcx, %rax
subq %rdx, %rax
addq %rax, %r8
movq %r8, 0x30(%rdi)
cmpq 0x8(%rdi), %r8
ja 0x2407e
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x2409e
movl $0x1, %eax
popq %rcx
retq
leaq 0x39681(%rip), %rdi     # 0x5d706
leaq 0x391f5(%rip), %rsi     # 0x5d281
leaq 0x39696(%rip), %rcx     # 0x5d729
movl $0x178, %edx            # imm = 0x178
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffCoverStream::TNewDataSubDiffCoverStream(hpatch_TStreamInput const*, hpatch_TStreamInput const*, bool)
TNewDataSubDiffCoverStream::TNewDataSubDiffCoverStream(const hpatch_TStreamInput* _newStream,
                                                       const hpatch_TStreamInput* _oldStream,
                                                       bool _isZeroSubDiff)
:isZeroSubDiff(_isZeroSubDiff),newStream(_newStream),oldStream(_oldStream),
newData(0),oldData(0),_cache(_isZeroSubDiff?0:kSubDiffCacheSize*2){
    setCover(cover,0,0,0);
    streamImport=this;
    read=_read;
    if (!isZeroSubDiff){
        newData=_cache.data();
        oldData=_cache.data()+kSubDiffCacheSize;
    }
    initRead();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebp
movq %rdi, %rbx
movb %bpl, 0x20(%rdi)
movq %rsi, 0x38(%rdi)
movq %rdx, 0x40(%rdi)
movl %ebp, %eax
xorb $0x1, %al
movzbl %al, %r14d
shll $0x14, %r14d
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x70(%rdi)
movq $0x0, 0x80(%rdi)
testl %ecx, %ecx
je 0x243cb
movq %r14, 0x78(%rbx)
jmp 0x243ea
movq %r14, %rdi
callq 0x4400
testq %rax, %rax
je 0x24437
movq %rax, 0x70(%rbx)
addq %rax, %r14
movq %r14, 0x78(%rbx)
movq %r14, 0x80(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rbx)
movq $0x0, 0x58(%rbx)
movq %rbx, (%rbx)
leaq 0x79(%rip), %rax        # 0x2447c
movq %rax, 0x10(%rbx)
testb %bpl, %bpl
jne 0x2441e
movq 0x70(%rbx), %rax
movq %rax, 0x60(%rbx)
addq $0x80000, %rax          # imm = 0x80000
movq %rax, 0x68(%rbx)
movq 0x58(%rbx), %rax
movq %rax, 0x8(%rbx)
movq %rax, 0x28(%rbx)
movq $0x0, 0x30(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x37ec4(%rip), %rsi     # 0x5c30f
movq %rax, %rdi
callq 0x4110
movq 0x57b8e(%rip), %rsi     # 0x7bfe8
movq 0x57b57(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffCoverStream::resetCoverLen(unsigned long long)
void TNewDataSubDiffCoverStream::resetCoverLen(hpatch_StreamPos_t coverLen){
    const hpatch_StreamPos_t skipLen=cover.length-(curDataLen+inStreamLen);
    if (coverLen<=skipLen){ // all cache data invalid
        cover.length=coverLen;
        initRead();
    }else{
        if (coverLen<skipLen+curDataLen)
            curDataLen=(size_t)(coverLen-skipLen);
        inStreamLen=coverLen-(skipLen+curDataLen);
        cover.length=coverLen;
        streamSize=coverLen;
    }
}

// Assembly:
movq 0x30(%rdi), %rcx
movq 0x58(%rdi), %rax
movq 0x28(%rdi), %rdx
addq %rcx, %rdx
subq %rdx, %rax
movq %rsi, %rdx
subq %rax, %rdx
jbe 0x24515
addq %rax, %rcx
cmpq %rsi, %rcx
jbe 0x244fe
movq %rdx, 0x30(%rdi)
addq 0x30(%rdi), %rax
movq %rsi, %rcx
subq %rax, %rcx
movq %rcx, 0x28(%rdi)
movq %rsi, 0x58(%rdi)
movq %rsi, 0x8(%rdi)
retq
movq %rsi, 0x58(%rdi)
movq %rsi, 0x8(%rdi)
movq %rsi, 0x28(%rdi)
movq $0x0, 0x30(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffCoverStream::readTo(unsigned long long, unsigned char*, unsigned char*)
hpatch_BOOL TNewDataSubDiffCoverStream::readTo(hpatch_StreamPos_t readFromPos,
                                               unsigned char* out_data,unsigned char* out_data_end){
    // newStream:[       |                                          |              ]
    //              cover.newPos                        cover.newPos+cover.length
    // _cache:           |  skipLen  [  curDataLen  ]  inStreamLen  |
    //                                          |
    //                                     readFromPos   
    while (out_data!=out_data_end){
        hpatch_StreamPos_t skipLen=cover.length-(curDataLen+inStreamLen);
        if ((readFromPos<skipLen)||(readFromPos>=(skipLen+curDataLen))){
            if (!_updateCache(readFromPos)) return hpatch_FALSE;
            skipLen=cover.length-(curDataLen+inStreamLen);
        }
        size_t srcPos=(size_t)(readFromPos-skipLen);
        size_t len=std::min((size_t)(curDataLen-srcPos),(size_t)(out_data_end-out_data));
        for (size_t i=0;i<len;i++)
            out_data[i]=newData[srcPos+i]-oldData[srcPos+i];
        readFromPos+=len;
        out_data+=len;
    }
    return hpatch_TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
cmpq %rbx, %r14
je 0x245e6
movq 0x30(%r12), %rax
movq 0x58(%r12), %rcx
movq 0x28(%r12), %rdx
addq %rax, %rdx
subq %rdx, %rcx
cmpq %rcx, %r15
jb 0x24569
addq %rcx, %rax
cmpq %rax, %r15
jb 0x2458a
movq %r12, %rdi
movq %r15, %rsi
callq 0x245fc
testl %eax, %eax
je 0x245e2
movq 0x30(%r12), %rax
movq 0x58(%r12), %rcx
addq 0x28(%r12), %rax
subq %rax, %rcx
movq %r15, %rax
subq %rcx, %rax
movq 0x30(%r12), %rdx
subq %rax, %rdx
movq %rbx, %rcx
subq %r14, %rcx
cmpq %rdx, %rcx
cmovaeq %rdx, %rcx
movq %r14, %rdx
movq %rcx, %rsi
testq %rcx, %rcx
je 0x245d0
movq 0x60(%r12), %rdi
movq 0x68(%r12), %r8
movb (%rdi,%rax), %dil
subb (%r8,%rax), %dil
movb %dil, (%rdx)
incq %rdx
incq %rax
decq %rsi
jne 0x245b0
addq %rcx, %r15
addq %rcx, %r14
movb $0x1, %al
testb %al, %al
jne 0x2453e
jmp 0x245ed
xorl %eax, %eax
jmp 0x245d8
movl $0x1, %eax
jmp 0x245ef
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffCoverStream::_updateCache(unsigned long long)
hpatch_BOOL TNewDataSubDiffCoverStream::_updateCache(hpatch_StreamPos_t readFromPos){
    assert(readFromPos<cover.length);
    curDataLen=kSubDiffCacheSize;
    if (curDataLen+readFromPos>cover.length)
        curDataLen=(size_t)(cover.length-readFromPos);
    inStreamLen=cover.length-(curDataLen+readFromPos);
    if (!newStream->read(newStream,cover.newPos+readFromPos,newData,newData+curDataLen))
        return hpatch_FALSE;
    if (!oldStream->read(oldStream,cover.oldPos+readFromPos,oldData,oldData+curDataLen))
        return hpatch_FALSE;
    return hpatch_TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x58(%rdi), %rax
movq %rax, %rcx
subq %rsi, %rcx
jbe 0x24676
movq %rsi, %rbx
movq %rdi, %r14
movl $0x80000, %edx          # imm = 0x80000
addq %rdx, %rsi
cmpq %rax, %rsi
cmovbeq %rdx, %rcx
movq %rcx, 0x30(%rdi)
subq %rcx, %rax
subq %rbx, %rax
movq %rax, 0x28(%rdi)
movq 0x50(%rdi), %rsi
addq %rbx, %rsi
movq 0x38(%rdi), %rdi
movq 0x60(%r14), %rdx
addq %rdx, %rcx
callq *0x10(%rdi)
testl %eax, %eax
je 0x2466c
addq 0x48(%r14), %rbx
movq 0x40(%r14), %rdi
movq 0x68(%r14), %rdx
movq 0x30(%r14), %rcx
addq %rdx, %rcx
movq %rbx, %rsi
callq *0x10(%rdi)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x2466e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x39145(%rip), %rdi     # 0x5d7c2
leaq 0x38bfd(%rip), %rsi     # 0x5d281
leaq 0x39150(%rip), %rcx     # 0x5d7db
movl $0x1ce, %edx            # imm = 0x1CE
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStepStream::TStepStream(hpatch_TStreamInput const*, hpatch_TStreamInput const*, bool, hdiff_private::TCovers const&, unsigned long)
TStepStream::TStepStream(const hpatch_TStreamInput* newStream,const hpatch_TStreamInput* oldStream,
                         bool isZeroSubDiff,const TCovers& _covers,size_t _patchStepMemSize)
:subDiff(newStream,oldStream,isZeroSubDiff),newDataDiff(_covers,newStream),
covers(_covers),patchStepMemSize(_patchStepMemSize),newDataSize(newStream->streamSize),
readFromPosBack(0),readBufPos(0){
    initStream();
    streamImport=this;
    read=_read;
    streamSize=sumBufSize_forInit;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, %r14
movq %r8, %r15
movq %rsi, %r12
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x2438a
leaq 0xa8(%rbx), %r13
movq %r15, 0xc8(%rbx)
movq %r12, 0xd0(%rbx)
movq 0x8(%r12), %rsi
movq %r15, %rdi
callq 0x23e44
xorps %xmm0, %xmm0
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
movups %xmm0, 0xf8(%rbx)
xorl %ecx, %ecx
movq %rcx, 0x108(%rbx)
movq %r13, 0xa8(%rbx)
movq %rax, 0xb0(%rbx)
leaq -0xbac(%rip), %rax      # 0x23b60
movq %rax, 0xb8(%rbx)
movq %rcx, 0xc0(%rbx)
movq %r15, 0x110(%rbx)
movq %r14, 0x118(%rbx)
movq 0x8(%r12), %rax
movq %rax, 0x120(%rbx)
movq %rcx, 0x258(%rbx)
movups %xmm0, 0x248(%rbx)
leaq 0x260(%rbx), %r15
movq %rcx, 0x2a0(%rbx)
movups %xmm0, 0x198(%rbx)
movups %xmm0, 0x188(%rbx)
movups %xmm0, 0x178(%rbx)
movups %xmm0, 0x168(%rbx)
movups %xmm0, 0x158(%rbx)
movq %r15, %rdi
callq 0x25ff0
movq $0x0, 0x268(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x2b0(%rbx)
movq %rbx, %rdi
callq 0x24846
movq %rbx, (%rbx)
leaq 0xf8(%rip), %rax        # 0x2489a
movq %rax, 0x10(%rbx)
movq 0x238(%rbx), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq %r15, %rdi
callq 0x15840
jmp 0x247cb
movq %rax, %r14
leaq 0x158(%rbx), %r12
leaq 0x170(%rbx), %r15
leaq 0x248(%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x247f7
movq 0x258(%rbx), %rsi
subq %rdi, %rsi
callq 0x4300
movq %r15, %rdi
callq 0x26210
movq (%r12), %rdi
testq %rdi, %rdi
je 0x24817
movq 0x168(%rbx), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x2483d
addq $0x90, %rbx
callq 0x43b0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStepStream::initStream()
void TStepStream::initStream(){
    isInInit=true;
    sumBufSize_forInit=0;
    beginStep();
    while(doStep()) { }
    isInInit=false;
    endCoverCount=curCoverCount;
    endMaxStepMemSize=curMaxStepMemSize;
    beginStep();
    //assert(buf.empty());
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x1, 0x230(%rdi)
movq $0x0, 0x238(%rdi)
callq 0x24932
movq %rbx, %rdi
callq 0x24aa2
testb %al, %al
jne 0x24861
movb $0x0, 0x230(%rbx)
movq 0x128(%rbx), %rax
movq 0x138(%rbx), %rcx
movq %rax, 0x130(%rbx)
movq %rcx, 0x140(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x24932
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStepStream::_read(hpatch_TStreamInput const*, unsigned long long, unsigned char*, unsigned char*)
hpatch_BOOL TStepStream::_read(const hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
                               unsigned char* out_data,unsigned char* out_data_end){
    TStepStream* self=(TStepStream*)stream->streamImport;
    if (readFromPos!=self->readFromPosBack){
        check(readFromPos==0);
        self->beginStep();
    }
    self->readFromPosBack=readFromPos+(size_t)(out_data_end-out_data);
    return self->readTo(out_data,out_data_end);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq (%rdi), %r12
cmpq %rsi, 0x2b0(%r12)
je 0x248c5
testq %r15, %r15
jne 0x248ec
movq %r12, %rdi
callq 0x24932
subq %r14, %r15
addq %rbx, %r15
movq %r15, 0x2b0(%r12)
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x250b0
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x38f4e(%rip), %rsi     # 0x5d84e
movq %rax, %rdi
callq 0x4110
movq 0x576d9(%rip), %rsi     # 0x7bfe8
movq 0x576a2(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStepStream::beginStep()
void TStepStream::beginStep(){
    curCoverCount=covers.coverCount();
    isHaveLeftCover=false;
    isHaveRightCover=false;
    isHaveLastCover=false;
    if (curCoverCount==0){
        isHaveLastCover=true;
        setCover(lastCover,0,newDataSize,0);
    }else{
        TCover back;
        covers.covers(curCoverCount-1,&back);
        if (back.newPos+back.length<newDataSize){
            isHaveLastCover=true;
            setCover(lastCover,back.oldPos+back.length,newDataSize,0);
        }
    }
    if (isHaveLastCover) ++curCoverCount;

    step_buf.clear();
    step_dataDiff.clear();
    readBufPos=0;
    curMaxStepMemSize=0;
    lastOldEnd=0;
    lastNewEnd=0;
    step_bufCover.clear();
    step_bufCover_size=0;
    step_bufRle.clear();
    step_dataDiffSize=0;
    newDataDiffReadPos=0;
    cur_i=0;
    pCurCover=0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x110(%rdi), %rcx
movq 0x18(%rcx), %rax
movq %rax, 0x128(%rdi)
movb $0x0, 0x1ba(%rdi)
movw $0x0, 0x1b8(%rdi)
testq %rax, %rax
je 0x2497c
leaq -0x1(%rax), %rsi
movq 0x10(%rcx), %rdx
cmpb $0x1, 0x20(%rcx)
jne 0x24997
leaq (%rsi,%rsi,2), %rdi
movl (%rdx,%rdi,4), %ecx
movl 0x4(%rdx,%rdi,4), %esi
movl 0x8(%rdx,%rdi,4), %edx
jmp 0x249a9
movb $0x1, 0x1b8(%rbx)
movq 0x120(%rbx), %rdi
movq $0x0, 0x1c0(%rbx)
jmp 0x249c9
leaq (%rsi,%rsi,2), %rdi
movq (%rdx,%rdi,8), %rcx
movq 0x8(%rdx,%rdi,8), %rsi
movq 0x10(%rdx,%rdi,8), %rdx
addq %rdx, %rsi
movq 0x120(%rbx), %rdi
cmpq %rdi, %rsi
jae 0x249db
movb $0x1, 0x1b8(%rbx)
addq %rdx, %rcx
movq %rcx, 0x1c0(%rbx)
movq %rdi, 0x1c8(%rbx)
movq $0x0, 0x1d0(%rbx)
cmpb $0x1, 0x1b8(%rbx)
jne 0x249ee
incq %rax
movq %rax, 0x128(%rbx)
movq 0x248(%rbx), %rax
cmpq %rax, 0x250(%rbx)
je 0x24a05
movq %rax, 0x250(%rbx)
leaq 0x260(%rbx), %rdi
callq 0x25ff0
xorl %eax, %eax
movq %rax, 0x268(%rbx)
movq %rax, 0x2b8(%rbx)
movq %rax, 0x138(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x148(%rbx)
movq 0x158(%rbx), %rax
cmpq %rax, 0x160(%rbx)
je 0x24a49
movq %rax, 0x160(%rbx)
movq $0x0, 0x240(%rbx)
movq 0x170(%rbx), %rax
cmpq %rax, 0x178(%rbx)
je 0x24a6b
movq %rax, 0x178(%rbx)
movq 0x188(%rbx), %rax
cmpq %rax, 0x190(%rbx)
je 0x24a82
movq %rax, 0x190(%rbx)
xorl %eax, %eax
movq %rax, 0x208(%rbx)
movq %rax, 0x228(%rbx)
movups %xmm0, 0x1a0(%rbx)
movq %rax, 0x1b0(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStepStream::_last_flush_step()
void TStepStream::_last_flush_step(){
    if (step_bufCover_size>0){
        step_dataDiff.reset(&newDataDiff,newDataDiffReadPos-step_dataDiffSize,newDataDiffReadPos);
        step_dataDiffSize=0;
        _flush_step_code();
    }else{
        assert(step_dataDiff.streamSize==0);
        assert(step_dataDiffSize==0);
    }
    assert(curMaxStepMemSize<=patchStepMemSize);
    assert(newDataDiffReadPos==newDataDiff.streamSize);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x240(%rdi)
je 0x252b1
leaq 0x260(%rbx), %rdi
leaq 0xa8(%rbx), %rsi
movq 0x1b0(%rbx), %rcx
movq %rcx, %rdx
subq 0x1a8(%rbx), %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x25364
movq $0x0, 0x1a8(%rbx)
movq %rbx, %rdi
callq 0x25438
jmp 0x252c5
cmpq $0x0, 0x268(%rbx)
jne 0x25325
cmpq $0x0, 0x1a8(%rbx)
jne 0x25344
movq 0x138(%rbx), %rax
cmpq 0x118(%rbx), %rax
ja 0x252e7
movq 0x1b0(%rbx), %rax
cmpq 0xb0(%rbx), %rax
jne 0x25306
popq %rbx
retq
leaq 0x3862a(%rip), %rdi     # 0x5d918
leaq 0x37f8c(%rip), %rsi     # 0x5d281
leaq 0x385d3(%rip), %rcx     # 0x5d8cf
movl $0x2a3, %edx            # imm = 0x2A3
callq 0x4200
leaq 0x3862f(%rip), %rdi     # 0x5d93c
leaq 0x37f6d(%rip), %rsi     # 0x5d281
leaq 0x385b4(%rip), %rcx     # 0x5d8cf
movl $0x2a4, %edx            # imm = 0x2A4
callq 0x4200
leaq 0x38587(%rip), %rdi     # 0x5d8b3
leaq 0x37f4e(%rip), %rsi     # 0x5d281
leaq 0x38595(%rip), %rcx     # 0x5d8cf
movl $0x2a0, %edx            # imm = 0x2A0
callq 0x4200
leaq 0x385b8(%rip), %rdi     # 0x5d903
leaq 0x37f2f(%rip), %rsi     # 0x5d281
leaq 0x38576(%rip), %rcx     # 0x5d8cf
movl $0x2a1, %edx            # imm = 0x2A1
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStreamClip::reset(hpatch_TStreamInput const*, unsigned long long, unsigned long long, hpatch_TDecompress*, unsigned long long)
void TStreamClip::reset(const hpatch_TStreamInput* stream,
                        hpatch_StreamPos_t clipBeginPos,hpatch_StreamPos_t clipEndPos,
                        hpatch_TDecompress* decompressPlugin,hpatch_StreamPos_t uncompressSize){
    clear();
    assert(clipBeginPos<=clipEndPos);
    assert(clipEndPos<=stream->streamSize);
    _src=stream;
    _src_begin=clipBeginPos;
    _src_end=clipEndPos;
    _decompressPlugin=decompressPlugin;
    _decompressHandle=0;
    _read_uncompress_pos=0;
    if ((uncompressSize==0)&&(decompressPlugin==0))
        uncompressSize=clipEndPos-clipBeginPos;
    this->streamImport=this;
    this->streamSize=uncompressSize;
    this->read=_clip_read;

    if (decompressPlugin)
        openDecompressHandle();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %rbx
callq 0x25ff0
movq $0x0, 0x8(%rbx)
movq %r12, %rax
subq %r13, %rax
jb 0x253f9
cmpq %r12, 0x8(%rbp)
jb 0x25418
movq %rbp, 0x20(%rbx)
movq %r13, 0x28(%rbx)
movq %r12, 0x30(%rbx)
movq %r14, %rcx
orq %r15, %rcx
cmovneq %r15, %rax
movq %r14, 0x38(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rbx)
movq %rbx, (%rbx)
movq %rax, 0x8(%rbx)
leaq 0xa35(%rip), %rax       # 0x25e00
movq %rax, 0x10(%rbx)
testq %r14, %r14
je 0x253ea
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x25f32
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x388ff(%rip), %rdi     # 0x5dcff
leaq 0x37e7a(%rip), %rsi     # 0x5d281
leaq 0x3890a(%rip), %rcx     # 0x5dd18
movl $0x32a, %edx            # imm = 0x32A
callq 0x4200
leaq 0x3898f(%rip), %rdi     # 0x5ddae
leaq 0x37e5b(%rip), %rsi     # 0x5d281
leaq 0x388eb(%rip), %rcx     # 0x5dd18
movl $0x32b, %edx            # imm = 0x32B
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::pushBack(unsigned char const*, unsigned long)
void TDiffStream::pushBack(const unsigned char* src,size_t n){
    if (n==0) return;
    checki(out_diff->write(out_diff,writePos,src,src+n),
           "TDiffStream::pushBack() write stream error!");
    writePos+=n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x257d0
movq %rsi, %rdx
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x8(%r14), %rsi
leaq (%rdx,%rbx), %rcx
callq *0x18(%rdi)
testl %eax, %eax
je 0x257d8
addq %rbx, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x381e9(%rip), %rsi     # 0x5d9d5
movq %rax, %rdi
callq 0x4110
movq 0x567ed(%rip), %rsi     # 0x7bfe8
movq 0x567b6(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::packUInt(unsigned long long)
size_t TDiffStream::packUInt(hpatch_StreamPos_t uValue){
    unsigned char  codeBuf[hpatch_kMaxPackedUIntBytes];
    unsigned char* codeEnd=codeBuf;
    check(hpatch_packUInt(&codeEnd,codeBuf+hpatch_kMaxPackedUIntBytes,uValue));
    pushBack(codeBuf,(size_t)(codeEnd-codeBuf));
    return codeEnd-codeBuf;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rdx
movq %rdi, %r14
leaq 0xd(%rsp), %rbx
movq %rsp, %rdi
movq %rbx, (%rdi)
leaq 0x18(%rsp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x437d8
testl %eax, %eax
je 0x2586a
movq (%rsp), %rdx
subq %rbx, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x257a8
movq (%rsp), %rax
subq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x38183(%rip), %rsi     # 0x5da01
movq %rax, %rdi
callq 0x4110
movq 0x5675b(%rip), %rsi     # 0x7bfe8
movq 0x56724(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::_packUInt_limit(unsigned long long, unsigned long)
void TDiffStream::_packUInt_limit(hpatch_StreamPos_t uValue,size_t limitOutSize){
    check(limitOutSize<=hpatch_kMaxPackedUIntBytes);
    unsigned char  _codeBuf[hpatch_kMaxPackedUIntBytes];
    packUInt_fixSize(_codeBuf,_codeBuf+limitOutSize,uValue);
    pushBack(_codeBuf,limitOutSize);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
cmpq $0xc, %rdx
jae 0x2590a
testq %rdx, %rdx
je 0x25928
leaq (%rsp,%rdx), %rax
addq $0xc, %rax
movl %esi, %ecx
andb $0x7f, %cl
movb %cl, (%rax)
leaq 0xd(%rsp), %rcx
cmpq %rcx, %rax
jbe 0x258ef
shrq $0x7, %rsi
movl %esi, %r8d
orb $-0x80, %r8b
movb %r8b, -0x1(%rax)
decq %rax
jmp 0x258d6
cmpq $0x80, %rsi
jae 0x25946
leaq 0xd(%rsp), %rsi
callq 0x257a8
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x38134(%rip), %rsi     # 0x5da52
movq %rax, %rdi
callq 0x4110
jmp 0x25962
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x387b9(%rip), %rsi     # 0x5e0f5
movq %rax, %rdi
callq 0x4110
jmp 0x25962
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x387c3(%rip), %rsi     # 0x5e11d
movq %rax, %rdi
callq 0x4110
movq 0x5667f(%rip), %rsi     # 0x7bfe8
movq 0x56648(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
jmp 0x2597c
jmp 0x2597c
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::packUInt_update(hdiff_private::TPlaceholder const&, unsigned long long)
void TDiffStream::packUInt_update(const TPlaceholder& pos,hpatch_StreamPos_t uValue){
    hpatch_StreamPos_t writePosBack=writePos;
    writePos=pos.pos;
    _packUInt_limit(uValue,(size_t)(pos.pos_end-pos.pos));
    assert(writePos==pos.pos_end);
    writePos=writePosBack;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %r15
movq (%rsi), %rcx
movq %rcx, 0x8(%rdi)
movq 0x8(%rsi), %rax
subq %rcx, %rax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x258b0
movq 0x8(%rbx), %rax
cmpq 0x8(%r14), %rax
jne 0x259cc
movq %r15, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x380b5(%rip), %rdi     # 0x5da88
leaq 0x378a7(%rip), %rsi     # 0x5d281
leaq 0x380bd(%rip), %rcx     # 0x5da9e
movl $0x2e3, %edx            # imm = 0x2E3
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::stream_read(hdiff_private::TPlaceholder const&, unsigned char*)
void TDiffStream::stream_read(const TPlaceholder& pos,hpatch_byte* out_data){
    assert(pos.pos<=pos.pos_end);
    assert(pos.size()==(size_t)pos.size());
    check(pos.pos_end<=writePos);
    checki(out_diff->read_writed!=0,"TDiffStream::stream_read() out_diff can't read error!");
    checki(out_diff->read_writed(out_diff,pos.pos,out_data,out_data+(size_t)pos.size()),
            "TDiffStream::stream_read() out_diff read error!");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq (%rsi), %rsi
movq 0x8(%rax), %rax
movq %rax, %rcx
subq %rsi, %rcx
jb 0x25a25
cmpq 0x8(%rdi), %rax
ja 0x25a44
movq (%rdi), %rdi
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x25a62
addq %rdx, %rcx
callq *%rax
testl %eax, %eax
je 0x25a80
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x380cd(%rip), %rdi     # 0x5daf9
leaq 0x3784e(%rip), %rsi     # 0x5d281
leaq 0x380d4(%rip), %rcx     # 0x5db0e
movl $0x2e8, %edx            # imm = 0x2E8
callq 0x4200
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x38108(%rip), %rsi     # 0x5db60
movq %rax, %rdi
callq 0x4110
jmp 0x25a9c
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x3810d(%rip), %rsi     # 0x5db83
movq %rax, %rdi
callq 0x4110
jmp 0x25a9c
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x38125(%rip), %rsi     # 0x5dbb9
movq %rax, %rdi
callq 0x4110
movq 0x56545(%rip), %rsi     # 0x7bfe8
movq 0x5650e(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
jmp 0x25ab6
jmp 0x25ab6
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::stream_update(hdiff_private::TPlaceholder const&, unsigned char const*)
void TDiffStream::stream_update(const TPlaceholder& pos,const hpatch_byte* in_data){
    assert(pos.pos<=pos.pos_end);
    assert(pos.size()==(size_t)pos.size());
    check(pos.pos_end<=writePos);

    hpatch_StreamPos_t writePosBack=writePos;
    writePos=pos.pos;
    pushBack(in_data,(size_t)pos.size());
    assert(writePos==pos.pos_end);
    writePos=writePosBack;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq (%rsi), %rcx
movq 0x8(%rsi), %rsi
movq %rsi, %rax
subq %rcx, %rax
jb 0x25b13
movq %rdi, %rbx
movq 0x8(%rdi), %r15
cmpq %r15, %rsi
ja 0x25b32
movq %rcx, 0x8(%rbx)
movq %rbx, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x257a8
movq 0x8(%rbx), %rax
cmpq 0x8(%r14), %rax
jne 0x25b64
movq %r15, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x37fdf(%rip), %rdi     # 0x5daf9
leaq 0x37760(%rip), %rsi     # 0x5d281
leaq 0x380c1(%rip), %rcx     # 0x5dbe9
movl $0x2f0, %edx            # imm = 0x2F0
callq 0x4200
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x3801a(%rip), %rsi     # 0x5db60
movq %rax, %rdi
callq 0x4110
movq 0x56493(%rip), %rsi     # 0x7bfe8
movq 0x5645c(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
leaq 0x37f1d(%rip), %rdi     # 0x5da88
leaq 0x3770f(%rip), %rsi     # 0x5d281
leaq 0x38070(%rip), %rcx     # 0x5dbe9
movl $0x2f7, %edx            # imm = 0x2F7
callq 0x4200
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TDiffStream::_pushStream(hpatch_TStreamInput const*)
void TDiffStream::_pushStream(const hpatch_TStreamInput* stream){
    unsigned char* buf=_temp_mem.data();
    hpatch_StreamPos_t sumReadedLen=0;
    while (sumReadedLen<stream->streamSize) {
        size_t readLen=kBufSize;
        if (readLen+sumReadedLen>stream->streamSize)
            readLen=(size_t)(stream->streamSize-sumReadedLen);
        checki(stream->read(stream,sumReadedLen,buf,buf+readLen),
               "TDiffStream::_pushStream() stream->read() error!");
        this->pushBack(buf,readLen);
        sumReadedLen+=readLen;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x25bfb
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rdi), %r15
xorl %r12d, %r12d
movl $0x80000, %ebp          # imm = 0x80000
leaq (%r12,%rbp), %rcx
movq %rax, %r13
subq %r12, %r13
cmpq %rax, %rcx
cmovbeq %rbp, %r13
leaq (%r15,%r13), %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x10(%rbx)
testl %eax, %eax
je 0x25c0a
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x257a8
addq %r13, %r12
movq 0x8(%rbx), %rax
cmpq %rax, %r12
jb 0x25bbc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x38025(%rip), %rsi     # 0x5dc43
movq %rax, %rdi
callq 0x4110
movq 0x563bb(%rip), %rsi     # 0x7bfe8
movq 0x56384(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStreamClip::_clip_read(hpatch_TStreamInput const*, unsigned long long, unsigned char*, unsigned char*)
hpatch_BOOL TStreamClip::_clip_read(const hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
                                    unsigned char* out_data,unsigned char* out_data_end){
    TStreamClip* self=(TStreamClip*)stream->streamImport;
    assert(out_data<out_data_end);
    if (readFromPos!=self->_read_uncompress_pos){
        if (self->_decompressPlugin){
            check(readFromPos==0); //not support random read compressed cdata
            //reset
            self->closeDecompressHandle();
            self->openDecompressHandle();
            self->_read_uncompress_pos=0;
        }else{
            self->_read_uncompress_pos=readFromPos;
        }
    }
    size_t readLen=out_data_end-out_data;
    assert(readFromPos+readLen <= self->streamSize);
    self->_read_uncompress_pos+=readLen;
    
    if (self->_decompressPlugin){
        return self->_decompressPlugin->decompress_part(self->_decompressHandle,out_data,out_data_end);
    }else{
        return self->_src->read(self->_src,self->_src_begin+readFromPos,out_data,out_data_end);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq %rcx, %rdx
jae 0x25eaf
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq (%rdi), %r12
cmpq %rsi, 0x48(%r12)
je 0x25e4f
cmpq $0x0, 0x38(%r12)
movq %r15, %rax
je 0x25e4a
testq %r15, %r15
jne 0x25eed
movq %r12, %rdi
callq 0x25ff0
movq %r12, %rdi
callq 0x25f32
xorl %eax, %eax
movq %rax, 0x48(%r12)
movq %rbx, %rax
subq %r14, %rax
leaq (%rax,%r15), %rcx
cmpq 0x8(%r12), %rcx
ja 0x25ece
addq %rax, 0x48(%r12)
movq 0x38(%r12), %rax
testq %rax, %rax
je 0x25e8b
movq 0x18(%rax), %rax
movq 0x40(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
movq 0x20(%r12), %rdi
movq 0x10(%rdi), %rax
addq 0x28(%r12), %r15
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
leaq 0x37fc6(%rip), %rdi     # 0x5de7c
leaq 0x373c4(%rip), %rsi     # 0x5d281
leaq 0x37fce(%rip), %rcx     # 0x5de92
movl $0x34c, %edx            # imm = 0x34C
callq 0x4200
leaq 0x3804a(%rip), %rdi     # 0x5df1f
leaq 0x373a5(%rip), %rsi     # 0x5d281
leaq 0x37faf(%rip), %rcx     # 0x5de92
movl $0x359, %edx            # imm = 0x359
callq 0x4200
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x3794d(%rip), %rsi     # 0x5d84e
movq %rax, %rdi
callq 0x4110
movq 0x560d8(%rip), %rsi     # 0x7bfe8
movq 0x560a1(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStreamClip::openDecompressHandle()
void TStreamClip::openDecompressHandle(){
    assert(_decompressHandle==0);
    assert(_decompressPlugin!=0);
    _decompressHandle=_decompressPlugin->open(_decompressPlugin,this->streamSize,_src,_src_begin,_src_end);
    check(_decompressHandle!=0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x40(%rdi)
jne 0x25f6d
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x25f8c
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdx
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %r8
callq *0x8(%rdi)
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x25fab
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x3b8e0(%rip), %rdi     # 0x61854
leaq 0x37306(%rip), %rsi     # 0x5d281
leaq 0x37e8b(%rip), %rcx     # 0x5de0d
movl $0x343, %edx            # imm = 0x343
callq 0x4200
leaq 0x37eb2(%rip), %rdi     # 0x5de45
leaq 0x372e7(%rip), %rsi     # 0x5d281
leaq 0x37e6c(%rip), %rcx     # 0x5de0d
movl $0x344, %edx            # imm = 0x344
callq 0x4200
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x37e9b(%rip), %rsi     # 0x5de5a
movq %rax, %rdi
callq 0x4110
movq 0x5601a(%rip), %rsi     # 0x7bfe8
movq 0x55fe3(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStreamClip::closeDecompressHandle()
void TStreamClip::closeDecompressHandle(){
    hpatch_decompressHandle handle=_decompressHandle;
    _decompressHandle=0;
    if (handle)
        check(_decompressPlugin->close(_decompressPlugin,handle));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x40(%rdi), %rsi
movq $0x0, 0x40(%rdi)
testq %rsi, %rsi
je 0x26010
movq 0x38(%rdi), %rdi
callq *0x10(%rdi)
testl %eax, %eax
je 0x26018
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x37da1(%rip), %rsi     # 0x5ddcd
movq %rax, %rdi
callq 0x4110
movq 0x55fad(%rip), %rsi     # 0x7bfe8
movq 0x55f76(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::_TCheckOutNewDataStream::_TCheckOutNewDataStream(hpatch_TStreamInput const*, unsigned char*, unsigned long)
_TCheckOutNewDataStream::_TCheckOutNewDataStream(const hpatch_TStreamInput*  _newData,
                                                 unsigned char* _buf,size_t _bufSize)
:newData(_newData),writedLen(0),buf(_buf),bufSize(_bufSize){
    streamImport=this;
    streamSize=newData->streamSize;
    read_writed=_read_writed;
    write=_write_check;
}

// Assembly:
movq %rsi, 0x20(%rdi)
movq $0x0, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rcx, 0x38(%rdi)
movq %rdi, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
leaq 0x10(%rip), %rax        # 0x26094
movq %rax, 0x10(%rdi)
leaq 0x39(%rip), %rax        # 0x260c8
movq %rax, 0x18(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::_TCheckOutNewDataStream::_read_writed(hpatch_TStreamOutput const*, unsigned long long, unsigned char*, unsigned char*)
hpatch_BOOL _TCheckOutNewDataStream::_read_writed(const struct hpatch_TStreamOutput* stream,hpatch_StreamPos_t readFromPos,
                                                  unsigned char* out_data,unsigned char* out_data_end){
    _TCheckOutNewDataStream* self=(_TCheckOutNewDataStream*)stream->streamImport;
    _test_rt(readFromPos<=self->writedLen);
    _test_rt((hpatch_size_t)(out_data_end-out_data)<=(hpatch_StreamPos_t)(self->writedLen-readFromPos)); 
    return self->newData->read(self->newData,readFromPos,out_data,out_data_end); 
}

// Assembly:
pushq %rax
movq (%rdi), %rax
movq 0x28(%rax), %rdi
subq %rsi, %rdi
jb 0x260b8
movq %rcx, %r8
subq %rdx, %r8
cmpq %rdi, %r8
ja 0x260bf
movq 0x20(%rax), %rdi
movq 0x10(%rdi), %rax
popq %r8
jmpq *%rax
callq 0x4914
jmp 0x260c4
callq 0x48f8
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::_TCheckOutNewDataStream::_write_check(hpatch_TStreamOutput const*, unsigned long long, unsigned char const*, unsigned char const*)
hpatch_BOOL _TCheckOutNewDataStream::_write_check(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t writeToPos,
                                                  const unsigned char* data,const unsigned char* data_end){
    _TCheckOutNewDataStream* self=(_TCheckOutNewDataStream*)stream->streamImport;
    _test_rt(self->writedLen==writeToPos);
    self->writedLen+=(size_t)(data_end-data);
    _test_rt(self->writedLen<=self->streamSize);
    
    hpatch_StreamPos_t readPos=writeToPos;
    while (data<data_end) {
        size_t readLen=(size_t)(data_end-data);
        if (readLen>self->bufSize) readLen=self->bufSize;
        _test_rt(self->newData->read(self->newData,readPos,self->buf,self->buf+readLen));
        _test_rt(0==memcmp(data,self->buf,readLen));
        data+=readLen;
        readPos+=readLen;
    }
    return hpatch_TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq (%rdi), %r13
movq 0x28(%r13), %rax
cmpq %rsi, %rax
jne 0x2615a
movq %rcx, %rbx
movq %rdx, %r14
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x28(%r13)
cmpq 0x8(%r13), %rax
ja 0x26161
movq %rsi, %r15
cmpq %rbx, %r14
jae 0x26153
movq %rbx, %r12
subq %r14, %r12
movq 0x38(%r13), %rax
cmpq %rax, %r12
cmovaeq %rax, %r12
movq 0x20(%r13), %rdi
movq 0x30(%r13), %rdx
leaq (%rdx,%r12), %rcx
movq %r15, %rsi
callq *0x10(%rdi)
testl %eax, %eax
je 0x26143
movq 0x30(%r13), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x4310
testl %eax, %eax
jne 0x2614a
addq %r12, %r14
addq %r12, %r15
movb $0x1, %al
testb %al, %al
jne 0x260f6
jmp 0x26166
callq 0x4968
jmp 0x2614f
callq 0x494c
xorl %eax, %eax
jmp 0x2613d
movl $0x1, %eax
jmp 0x26168
callq 0x4930
jmp 0x26166
callq 0x4984
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::do_compress(std::vector<unsigned char, std::allocator<unsigned char>>&, hpatch_TStreamInput const*, hdiff_TCompress const*, bool)
void do_compress(std::vector<unsigned char>& out_code,const hpatch_TStreamInput* data,
                        const hdiff_TCompress* compressPlugin,bool isMustCompress){
    out_code.clear();
    if (!compressPlugin) return;
    if (data->streamSize==0) return;
    hpatch_StreamPos_t maxCodeSize=compressPlugin->maxCompressedSize(data->streamSize);
    if ((maxCodeSize<=data->streamSize)||(maxCodeSize!=(size_t)maxCodeSize)) return; //error
    out_code.resize((size_t)maxCodeSize);
    hpatch_TStreamOutput codeStream;
    mem_as_hStreamOutput(&codeStream,out_code.data(),out_code.data()+out_code.size());
    hpatch_StreamPos_t codeSize=compressPlugin->compress(compressPlugin,&codeStream,data);
    if ((codeSize>0)&&(isMustCompress||(codeSize<data->streamSize)))
        out_code.resize((size_t)codeSize); //ok
    else
        out_code.clear();//error or cancel
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
je 0x26196
movq %rax, 0x8(%rbx)
testq %r15, %r15
je 0x26202
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x26202
callq *0x8(%r15)
cmpq 0x8(%r14), %rax
jbe 0x26202
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9d84
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rsp, %r12
movq %r12, %rdi
callq 0x4397b
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *0x18(%r15)
testq %rax, %rax
je 0x261f5
testb %bpl, %bpl
jne 0x261e8
cmpq 0x8(%r14), %rax
jae 0x261f5
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9d84
jmp 0x26202
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x26202
movq %rax, 0x8(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h
// Function: sssort_thread(int*, int*, long long*, long long*, mt_data_t*)
static void _sssort_thread(saint_t* c0,saint_t* c1,saidx_t* j,
                           sastore_t *buf,mt_data_t* mt){
    saidx_t k = 0;
    saidx_t l;
    const saidx_t*  bucket_B=mt->bucket_B;
    for(;;) {
        {
            CAutoLocker __autoLocker(mt->locker.locker);
            if(0 < (l = *j)) {
                saint_t d0 = *c0, d1 = *c1;
                do {
                k = BUCKET_BSTAR(d0, d1);
                if(--d1 <= d0) {
                    d1 = ALPHABET_SIZE - 1;
                    if(--d0 < 0) { break; }
                }
                } while(((l - k) <= 1) && (0 < (l = k)));
                *c0 = d0, *c1 = d1, *j = k;
            }
        }
        if(l == 0) { break; }
        sastore_t* SA=mt->SA;
        sssort(mt->T, mt->PAb, SA + k, SA + l,
               buf, mt->bufsize, 2, mt->n, *(SA + k) == (mt->m - 1));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %rbx
movq %rcx, 0x30(%rsp)
movq %rdx, %r15
movq %rsi, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x18(%r8), %rbp
xorl %r12d, %r12d
leaq 0x20(%rsp), %r13
movq (%rbx), %rax
movq $0x0, (%rsp)
movb $0x0, 0x8(%rsp)
testq %rax, %rax
je 0x2c3dc
movq %rax, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq %r13, %rdi
callq 0x2099a
movq 0x20(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq %rax, (%rsp)
movb 0x8(%rsp), %al
movb %al, 0x28(%rsp)
movb $0x1, 0x8(%rsp)
movq %r13, %rdi
callq 0x20984
movq (%r15), %r14
testq %r14, %r14
jle 0x2c441
movq 0x10(%rsp), %rax
movl (%rax), %edx
movq 0x18(%rsp), %rax
movl (%rax), %eax
movl %edx, %ecx
shll $0x8, %ecx
orl %eax, %ecx
movslq %ecx, %rcx
movq (%rbp,%rcx,8), %r12
decl %eax
cmpl %edx, %eax
jle 0x2c40b
movl %edx, %ecx
jmp 0x2c417
leal -0x1(%rdx), %ecx
movl $0xff, %eax
testl %edx, %edx
jle 0x2c430
movq %r14, %rdx
subq %r12, %rdx
cmpq $0x1, %rdx
jg 0x2c430
movq %r12, %r14
movl %ecx, %edx
testq %r12, %r12
jg 0x2c3f2
movq %r12, %r14
movq 0x10(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
movq %r12, (%r15)
movq %rsp, %rdi
callq 0x20984
testq %r14, %r14
je 0x2c495
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rax
movq 0x20(%rbx), %rsi
leaq (%rax,%r12,8), %rdx
leaq (%rax,%r14,8), %rcx
movq 0x28(%rbx), %r9
movq 0x38(%rbx), %rax
decq %rax
xorl %r10d, %r10d
cmpq %rax, (%rdx)
sete %r10b
subq $0x8, %rsp
movq 0x38(%rsp), %r8
pushq %r10
pushq 0x30(%rbx)
pushq $0x2
callq 0x27427
addq $0x20, %rsp
jmp 0x2c38e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20984
movq %rbx, %rdi
callq 0x45e0
// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/lzma/C/Lzma2Enc.c
// Function: Lzma2EncProps_Init
void Lzma2EncProps_Init(CLzma2EncProps *p)
{
  LzmaEncProps_Init(&p->lzmaProps);
  p->blockSize = LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO;
  p->numBlockThreads_Reduced = -1;
  p->numBlockThreads_Max = -1;
  p->numTotalThreads = -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x330dc
movq $0x0, 0x48(%rbx)
movq $-0x1, 0x50(%rbx)
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
popq %rbx
retq