// 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::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 $0x38, %rsp
subq %rsi, %rdx
sete %al
je 0x2428b
movq %rsi, %r12
movq %rdi, %r15
movq 0x58(%r15), %rcx
movq 0x8(%r15), %r14
movq 0x20(%r15), %rsi
movb 0x60(%r15), %dil
movq 0x38(%r15), %r10
movq 0x40(%r15), %r8
movq 0x28(%r15), %r9
testq %r10, %r10
jne 0x2414f
cmpq 0x18(%rcx), %r8
jae 0x24103
cmpb $0x1, 0x20(%rcx)
leaq (%r8,%r8,2), %r11
jne 0x2410b
movq 0x10(%rcx), %rbx
movl (%rbx,%r11,4), %r9d
movl 0x4(%rbx,%r11,4), %r10d
movl 0x8(%rbx,%r11,4), %r11d
jmp 0x2411d
movq %r14, %r10
subq %rsi, %r10
jmp 0x24122
movq 0x10(%rcx), %rbx
movq (%rbx,%r11,8), %r9
movq 0x8(%rbx,%r11,8), %r10
movq 0x10(%rbx,%r11,8), %r11
subq %rsi, %r10
jbe 0x24137
movq %r10, 0x38(%r15)
movq $-0x1, 0x28(%r15)
movq $-0x1, %r9
jmp 0x2414f
jne 0x242cc
movq %r11, 0x38(%r15)
movq %r9, 0x28(%r15)
incq %r8
movq %r8, 0x40(%r15)
movq %r11, %r10
cmpq $-0x1, %r9
jne 0x2417d
testb $0x1, %dil
je 0x2417d
addq %r10, %rsi
movq %rsi, 0x20(%r15)
movq $0x0, 0x38(%r15)
movl $0x0, %r10d
testb $0x1, %al
je 0x240da
jmp 0x2428b
movq 0x38(%r15), %rbx
cmpq %rbx, %rdx
movq %rbx, %rax
cmovbq %rdx, %rax
cmpq $-0x1, %r9
movq %rdx, 0x18(%rsp)
movq %r12, 0x10(%rsp)
movq %rax, 0x8(%rsp)
je 0x24247
cmpb $0x0, 0x61(%r15)
jne 0x24247
movq 0x20(%r15), %rsi
movq 0x48(%r15), %rdi
leaq (%r12,%rax), %rcx
movq %r12, %rdx
callq *0x10(%rdi)
testl %eax, %eax
je 0x242eb
testq %rbx, %rbx
je 0x24254
movq 0x50(%r15), %rax
movq %rax, 0x30(%rsp)
movq 0x68(%r15), %rbp
movq 0x70(%r15), %rax
movq %rax, 0x20(%rsp)
subq %rbp, %rax
movq %rax, 0x28(%rsp)
movq 0x28(%r15), %r14
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r13
movq 0x28(%rsp), %rbx
cmpq %rbx, %r13
cmovbq %r13, %rbx
leaq (%rbp,%rbx), %rcx
movq 0x30(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq *0x10(%rdi)
testl %eax, %eax
je 0x2429a
cmpq %rbp, 0x20(%rsp)
je 0x2423a
xorl %eax, %eax
movb (%rbp,%rax), %cl
subb %cl, (%r12,%rax)
incq %rax
cmpq %rax, %rbx
jne 0x2422a
addq %rbx, %r14
addq %rbx, %r12
subq %rbx, %r13
jne 0x241fe
jmp 0x24254
movq %r12, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x41c0
movq 0x28(%r15), %rax
cmpq $-0x1, %rax
movq 0x8(%rsp), %rcx
je 0x2426a
addq %rcx, %rax
movq %rax, 0x28(%r15)
addq %rcx, 0x20(%r15)
subq %rcx, 0x38(%r15)
movq 0x10(%rsp), %r12
addq %rcx, %r12
movq 0x18(%rsp), %rdx
subq %rcx, %rdx
sete %al
jne 0x240be
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x39e0b(%rip), %rsi     # 0x5e0b9
movq %rax, %rdi
callq 0x4110
movq 0x57d2b(%rip), %rsi     # 0x7bfe8
movq 0x57cf4(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
leaq 0x39373(%rip), %rdi     # 0x5d646
leaq 0x38fa7(%rip), %rsi     # 0x5d281
leaq 0x39389(%rip), %rcx     # 0x5d66a
movl $0x154, %edx            # imm = 0x154
callq 0x4200
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x393bf(%rip), %rsi     # 0x5d6be
movq %rax, %rdi
callq 0x4110
jmp 0x242b6
jmp 0x2430b
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0