// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TNewDataSubDiffStream::readTo(unsigned char*, unsigned char*)
void TNewDataSubDiffStream::readTo(unsigned char* out_data,unsigned char* out_data_end){
    size_t readLen=out_data_end-out_data;
    while (readLen>0){
        if (curDataLen==0){
            if (nextCoveri<covers.coverCount()){
                hpatch_TCover cover;
                covers.covers(nextCoveri,&cover);
                if ((size_t)cover.newPos>curReadNewPos){
                    curDataLen=(size_t)(cover.newPos-curReadNewPos);
                    curReadOldPos=_kNullPos;
                }else{
                    assert((size_t)cover.newPos==curReadNewPos);
                    curDataLen=(size_t)cover.length;
                    curReadOldPos=cover.oldPos;
                    ++nextCoveri;
                }
            }else{
                curDataLen=(size_t)(streamSize-curReadNewPos);
                curReadOldPos=_kNullPos;
            }
        }
        if ((curReadOldPos==_kNullPos)&&isOnlySubCover){
            curReadNewPos+=curDataLen;
            curDataLen=0;
            continue;
        }
        
        size_t len=(size_t)std::min(curDataLen,(hpatch_StreamPos_t)readLen);
        if ((!isZeroSubDiff)&&(curReadOldPos!=_kNullPos)){
            check(newData->read(newData,curReadNewPos,out_data,out_data+len));
            _subData(out_data,len,oldData,curReadOldPos,_cache.data(),_cache.size());
        }else{
            memset(out_data,0,len);
        }
        if (curReadOldPos!=_kNullPos) curReadOldPos+=len;
        curReadNewPos+=len;
        curDataLen-=len;
        out_data+=len;
        readLen-=len;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbp
movq %rdi, %r12
subq %rsi, %rdx
movq 0x38(%rdi), %r15
movq 0x20(%rdi), %rsi
movq 0x28(%rdi), %rax
pushq $-0x1
popq %r14
movq %rdi, (%rsp)
testq %rdx, %rdx
je 0x1f487
movq 0x8(%r12), %rcx
movq 0x58(%r12), %r11
movb 0x60(%r12), %dil
movq 0x40(%r12), %r8
testq %r15, %r15
jne 0x1f356
cmpq 0x18(%r11), %r8
jae 0x1f30c
movq 0x10(%r11), %r9
cmpb $0x1, 0x20(%r11)
jne 0x1f314
imulq $0xc, %r8, %r10
movl (%r9,%r10), %eax
movl 0x4(%r9,%r10), %r15d
movl 0x8(%r9,%r10), %r9d
jmp 0x1f326
movq %rcx, %r15
subq %rsi, %r15
jmp 0x1f32b
imulq $0x18, %r8, %r10
movq (%r9,%r10), %rax
movq 0x8(%r9,%r10), %r15
movq 0x10(%r9,%r10), %r9
subq %rsi, %r15
jbe 0x1f33b
movq %r15, 0x38(%r12)
orq $-0x1, 0x28(%r12)
movq %r14, %rax
jmp 0x1f356
jne 0x1f4c6
movq %r9, 0x38(%r12)
movq %rax, 0x28(%r12)
incq %r8
movq %r8, 0x40(%r12)
movq %r9, %r15
cmpq $-0x1, %rax
jne 0x1f37b
testb $0x1, %dil
je 0x1f37b
addq %r15, %rsi
movq %rsi, 0x20(%r12)
andq $0x0, 0x38(%r12)
movq %r14, %rax
xorl %r15d, %r15d
jmp 0x1f2e2
cmpq %r15, %rdx
cmovbq %rdx, %r15
cmpq $-0x1, %rax
movq %rdx, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
je 0x1f427
cmpb $0x0, 0x61(%r12)
jne 0x1f427
movq 0x48(%r12), %rdi
leaq (%r15,%rbp), %rcx
movq %rbp, %rdx
callq *0x10(%rdi)
testl %eax, %eax
je 0x1f4e5
movq 0x28(%r12), %r13
movq 0x50(%r12), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%r12), %r14
movq 0x70(%r12), %rax
subq %r14, %rax
movq %rax, 0x18(%rsp)
movq %r15, %r12
testq %r12, %r12
je 0x1f434
movq 0x18(%rsp), %rbx
cmpq %rbx, %r12
cmovbq %r12, %rbx
leaq (%r14,%rbx), %rcx
movq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq *0x10(%rdi)
testl %eax, %eax
je 0x1f496
xorl %eax, %eax
cmpq %rax, %rbx
je 0x1f41c
movb (%r14,%rax), %cl
subb %cl, (%rbp,%rax)
incq %rax
jmp 0x1f40a
addq %rbx, %r13
addq %rbx, %rbp
subq %rbx, %r12
jmp 0x1f3dd
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x41f0
movq (%rsp), %r12
movq 0x28(%r12), %rcx
pushq $-0x1
popq %r14
movq %r14, %rax
cmpq $-0x1, %rcx
je 0x1f455
addq %r15, %rcx
movq %rcx, 0x28(%r12)
movq %rcx, %rax
movq 0x20(%r12), %rsi
addq %r15, %rsi
movq %rsi, 0x20(%r12)
movq 0x38(%r12), %rcx
subq %r15, %rcx
movq %rcx, 0x38(%r12)
movq 0x8(%rsp), %rbp
addq %r15, %rbp
movq 0x10(%rsp), %rdx
subq %r15, %rdx
movq %rcx, %r15
jmp 0x1f2c5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x41c0
movq %rax, %rbx
leaq 0x33d21(%rip), %rsi     # 0x531c9
movq %rax, %rdi
callq 0x4120
movq 0x55b31(%rip), %rsi     # 0x74fe8
movq 0x55afa(%rip), %rdx     # 0x74fb8
movq %rbx, %rdi
callq 0x45b0
leaq 0x33289(%rip), %rdi     # 0x52756
leaq 0x32ebd(%rip), %rsi     # 0x52391
leaq 0x3329f(%rip), %rcx     # 0x5277a
movl $0x154, %edx            # imm = 0x154
callq 0x4230
pushq $0x10
popq %rdi
callq 0x41c0
movq %rax, %rbx
leaq 0x332d7(%rip), %rsi     # 0x527ce
movq %rax, %rdi
callq 0x4120
jmp 0x1f4b0
jmp 0x1f503
movq %rax, %r14
movq %rbx, %rdi
callq 0x4290
movq %r14, %rdi
callq 0x4600