// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdx, %rbx
subq %rsi, %rbx
je 0x23f94
movq %rsi, %r12
movq %rdi, %r15
movq 0x38(%rdi), %r14
movq 0x20(%rdi), %rsi
movq 0x28(%rdi), %rax
movq 0x58(%r15), %rcx
movq 0x8(%r15), %rdx
movq 0x40(%r15), %rdi
movb 0x60(%r15), %r8b
testq %r14, %r14
je 0x23de8
cmpq $-0x1, %rax
je 0x23e38
jmp 0x23e82
movq %rdx, %r9
cmpq 0x18(%rcx), %rdi
jae 0x23e26
movq 0x10(%rcx), %r10
cmpb $0x1, 0x20(%rcx)
jne 0x23e0f
leaq (%rdi,%rdi,2), %r11
movl (%r10,%r11,4), %eax
movl 0x4(%r10,%r11,4), %r9d
movl 0x8(%r10,%r11,4), %r14d
jmp 0x23e21
leaq (%rdi,%rdi,2), %r11
movq (%r10,%r11,8), %rax
movq 0x8(%r10,%r11,8), %r9
movq 0x10(%r10,%r11,8), %r14
cmpq %rsi, %r9
jbe 0x23e5c
subq %rsi, %r9
movq %r9, 0x38(%r15)
movq $-0x1, 0x28(%r15)
movq %r9, %r14
testb $0x1, %r8b
je 0x23e76
addq %r14, %rsi
movq %rsi, 0x20(%r15)
movq $0x0, 0x38(%r15)
movq $-0x1, %rax
xorl %r14d, %r14d
jmp 0x23dd8
jne 0x23fd5
movq %r14, 0x38(%r15)
movq %rax, 0x28(%r15)
incq %rdi
movq %rdi, 0x40(%r15)
jmp 0x23ddd
cmpq %r14, %rbx
cmovbq %rbx, %r14
movq %r14, %r13
jmp 0x23e93
cmpq %r14, %rbx
movq %r14, %r13
cmovbq %rbx, %r13
cmpb $0x0, 0x61(%r15)
je 0x23ee1
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x41c0
movq 0x28(%r15), %rax
cmpq $-0x1, %rax
je 0x23eb3
addq %r13, %rax
movq %rax, 0x28(%r15)
jmp 0x23eba
movq $-0x1, %rax
movq 0x20(%r15), %rsi
addq %r13, %rsi
movq %rsi, 0x20(%r15)
movq 0x38(%r15), %r14
subq %r13, %r14
movq %r14, 0x38(%r15)
addq %r13, %r12
subq %r13, %rbx
jne 0x23dc8
jmp 0x23f94
movq 0x48(%r15), %rdi
leaq (%r12,%r13), %rcx
movq %r12, %rdx
callq *0x10(%rdi)
testl %eax, %eax
je 0x23ff4
testq %r14, %r14
je 0x23f8c
movq %rbx, 0x18(%rsp)
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 %r12, 0x10(%rsp)
movq %r13, 0x8(%rsp)
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 0x23fa3
cmpq %rbp, 0x20(%rsp)
je 0x23f6d
xorl %eax, %eax
movb (%rbp,%rax), %cl
subb %cl, (%r12,%rax)
incq %rax
cmpq %rax, %rbx
jne 0x23f5d
addq %rbx, %r14
addq %rbx, %r12
subq %rbx, %r13
jne 0x23f31
movq 0x18(%rsp), %rbx
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r13
jmp 0x23ea0
xorl %r13d, %r13d
jmp 0x23ea0
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 0x3a0f2(%rip), %rsi     # 0x5e0a9
movq %rax, %rdi
callq 0x4110
movq 0x58022(%rip), %rsi     # 0x7bfe8
movq 0x57feb(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
leaq 0x3965a(%rip), %rdi     # 0x5d636
leaq 0x3928e(%rip), %rsi     # 0x5d271
leaq 0x39670(%rip), %rcx     # 0x5d65a
movl $0x154, %edx            # imm = 0x154
callq 0x4200
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x396a6(%rip), %rsi     # 0x5d6ae
movq %rax, %rdi
callq 0x4110
jmp 0x23fbf
jmp 0x24014
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0
nop