// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp
// Function: hdiff_private::TStepStream::readTo(unsigned char*, unsigned char*)
hpatch_BOOL TStepStream::readTo(unsigned char* out_data,unsigned char* out_data_end){
    while (out_data!=out_data_end){
        hpatch_StreamPos_t stepDataLen=step_buf.size()+step_dataDiff.streamSize;
        if (readBufPos==stepDataLen){
            step_buf.clear();
            step_dataDiff.clear();
            readBufPos=0;
            while (doStep()) { 
                stepDataLen=step_buf.size()+step_dataDiff.streamSize;
                if (stepDataLen>0) 
                    break; 
            }
            check(stepDataLen>0);
        }
        size_t len=out_data_end-out_data;
        if (readBufPos+len>stepDataLen)
            len=(size_t)(stepDataLen-readBufPos);
        if (readBufPos<step_buf.size()){//copy data from step_buf
            size_t clen=len;
            if (readBufPos+clen>step_buf.size())
                clen=(size_t)(step_buf.size()-readBufPos);
            memcpy(out_data,step_buf.data()+(size_t)readBufPos,clen);
            readBufPos+=clen;
            out_data+=clen;
            len-=clen;
        }
        if (len>0){//copy data from step_dataDiff
            if (!step_dataDiff.read(&step_dataDiff,readBufPos-step_buf.size(),
                                    out_data,out_data+len)) return hpatch_FALSE;
            readBufPos+=len;
            out_data+=len;
        }
    }
    return hpatch_TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %eax
cmpq %rdx, %rsi
je 0x24f44
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
leaq 0x260(%rdi), %rax
movq %rax, (%rsp)
movq 0x2b8(%rdi), %rbx
movq 0x248(%r15), %rsi
movq 0x250(%r15), %rax
movq %rax, %rcx
subq %rsi, %rcx
movq 0x268(%r15), %rdx
addq %rcx, %rdx
cmpq %rdx, %rbx
jne 0x24e72
cmpq %rsi, %rax
je 0x24e1f
movq %rsi, 0x250(%r15)
movq (%rsp), %rdi
callq 0x25d20
xorl %eax, %eax
movq %rax, 0x268(%r15)
movq %rax, 0x2b8(%r15)
movq %r15, %rdi
callq 0x24794
testb %al, %al
je 0x24e77
movq 0x248(%r15), %rsi
movq 0x250(%r15), %rcx
subq %rsi, %rcx
movq 0x268(%r15), %rbx
addq %rcx, %rbx
jne 0x24e91
movq %r15, %rdi
callq 0x24794
testb %al, %al
jne 0x24e44
jmp 0x24f53
movq %rdx, %rbx
jmp 0x24e91
testq %rbx, %rbx
je 0x24f53
movq 0x248(%r15), %rsi
movq 0x250(%r15), %rcx
subq %rsi, %rcx
movq %r14, %rdx
subq %r13, %rdx
movq 0x2b8(%r15), %rax
leaq (%rax,%rdx), %rdi
movq %rbx, %r12
subq %rax, %r12
cmpq %rbx, %rdi
cmovbeq %rdx, %r12
movq %rcx, %rbp
subq %rax, %rbp
jbe 0x24ee7
leaq (%r12,%rax), %rdx
cmpq %rcx, %rdx
cmovbeq %r12, %rbp
addq %rax, %rsi
movq %r13, %rdi
movq %rbp, %rdx
callq 0x4290
movq 0x2b8(%r15), %rax
addq %rbp, %rax
movq %rax, 0x2b8(%r15)
addq %rbp, %r13
subq %rbp, %r12
testq %r12, %r12
je 0x24f2c
subq 0x250(%r15), %rax
addq 0x248(%r15), %rax
leaq (%r12,%r13), %rbp
movq (%rsp), %rdi
movq %rax, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq *0x270(%r15)
testl %eax, %eax
je 0x24f42
addq 0x2b8(%r15), %r12
movq %r12, 0x2b8(%r15)
movq %r12, %rax
movq %rbp, %r13
jmp 0x24f2f
movq %r13, %rbp
movq %rax, %rbx
cmpq %r14, %rbp
jne 0x24df0
movl $0x1, %eax
jmp 0x24f44
xorl %eax, %eax
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 0x388bc(%rip), %rsi     # 0x5d823
movq %rax, %rdi
callq 0x4110
movq 0x57072(%rip), %rsi     # 0x7bfe8
movq 0x5703b(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x45e0