// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/src/../HDiffPatch/decompress_plugin_demo.h
// Function: lzma2_decompress_part(void*, unsigned char*, unsigned char*)
static hpatch_BOOL _lzma2_decompress_part(hpatch_decompressHandle decompressHandle,
                                            unsigned char* out_part_data,unsigned char* out_part_data_end){
        _lzma2_TDecompress* self=(_lzma2_TDecompress*)decompressHandle;
        unsigned char* out_cur=out_part_data;
        assert(out_part_data<=out_part_data_end);
        while (out_cur<out_part_data_end){
            size_t copyLen=(self->decEnv.decoder.dicPos-self->decCopyPos);
            if (copyLen>0){
                if (copyLen>(size_t)(out_part_data_end-out_cur))
                    copyLen=(out_part_data_end-out_cur);
                memcpy(out_cur,self->decEnv.decoder.dic+self->decCopyPos,copyLen);
                out_cur+=copyLen;
                self->decCopyPos+=copyLen;
                if ((self->decEnv.decoder.dicPos==self->decEnv.decoder.dicBufSize)
                    &&(self->decEnv.decoder.dicPos==self->decCopyPos)){
                    self->decEnv.decoder.dicPos=0;
                    self->decCopyPos=0;
                }
            }else{
                ELzmaStatus status;
                SizeT inSize,dicPos_back;
                SRes res;
                hpatch_StreamPos_t codeLen=(self->code_end - self->code_begin);
                if ((self->decReadPos==kDecompressBufSize)&&(codeLen>0)) {
                    size_t readLen=kDecompressBufSize;
                    if (readLen>codeLen) readLen=(size_t)codeLen;
                    self->decReadPos=kDecompressBufSize-readLen;
                    if (!self->codeStream->read(self->codeStream,self->code_begin,self->dec_buf+self->decReadPos,
                                                self->dec_buf+self->decReadPos+readLen)) return hpatch_FALSE;//error;
                    self->code_begin+=readLen;
                }
                
                inSize=kDecompressBufSize-self->decReadPos;
                dicPos_back=self->decEnv.decoder.dicPos;
                res=Lzma2Dec_DecodeToDic(&self->decEnv,self->decEnv.decoder.dicBufSize,
                                        self->dec_buf+self->decReadPos,&inSize,LZMA_FINISH_ANY,&status);
                if(res==SZ_OK){
                    if ((inSize==0)&&(self->decEnv.decoder.dicPos==dicPos_back))
                        _dec_onDecErr_rt();//error;
                }else{
                    _dec_onDecErr_rt();//error;
                }
                self->decReadPos+=inSize;
            }
        }
        return hpatch_TRUE;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpq %rdx, %rsi
ja 0x6faa
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x28(%rdi), %r12
leaq 0xcc(%rdi), %r13
leaq 0x80cc(%rdi), %rax
movq %rax, 0x18(%rsp)
leaq 0xc8(%rdi), %rax
movq %rax, 0x8(%rsp)
cmpq %rbp, %r14
jae 0x6f96
movq 0x60(%r15), %rax
movq 0xb8(%r15), %rsi
subq %rsi, %rax
jne 0x6f24
movq 0x18(%r15), %rsi
movq 0x20(%r15), %rbx
cmpq $0x8000, 0xc0(%r15) # imm = 0x8000
sete %al
subq %rsi, %rbx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6ed3
movl $0x8000, %eax           # imm = 0x8000
cmpq %rax, %rbx
cmovaeq %rax, %rbx
movl $0x8000, %edx           # imm = 0x8000
subq %rbx, %rdx
movq %rdx, 0xc0(%r15)
movq 0x10(%r15), %rdi
addq %r13, %rdx
movq 0x18(%rsp), %rcx
callq *0x10(%rdi)
testl %eax, %eax
je 0x6f20
addq %rbx, 0x18(%r15)
movq 0xc0(%r15), %rdx
movl $0x8000, %eax           # imm = 0x8000
subq %rdx, %rax
movq %rax, 0x10(%rsp)
movq 0x58(%r15), %rsi
movq 0x60(%r15), %rbx
addq %r13, %rdx
movq %r12, %rdi
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
leaq 0x24(%rsp), %r9
callq 0x57b22
testl %eax, %eax
je 0x6f71
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x6f20
movq 0x8(%rsp), %rax
movl $0x3, (%rax)
xorl %eax, %eax
jmp 0x6f8a
movq %rbp, %rbx
subq %r14, %rbx
cmpq %rbx, %rax
cmovbq %rax, %rbx
addq 0x50(%r15), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4290
addq %rbx, %r14
addq 0xb8(%r15), %rbx
movq %rbx, 0xb8(%r15)
movq 0x60(%r15), %rcx
movb $0x1, %al
cmpq 0x58(%r15), %rcx
jne 0x6f8a
cmpq %rbx, %rcx
jne 0x6f8a
xorl %ecx, %ecx
movq %rcx, 0x60(%r15)
movq %rcx, 0xb8(%r15)
jmp 0x6f8a
movq 0x10(%rsp), %rax
testq %rax, %rax
jne 0x6f81
cmpq %rbx, 0x60(%r15)
je 0x6f0b
addq %rax, 0xc0(%r15)
movb $0x1, %al
testb %al, %al
jne 0x6e61
xorl %eax, %eax
jmp 0x6f9b
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x523d6(%rip), %rdi     # 0x59387
leaq 0x52374(%rip), %rsi     # 0x5932c
leaq 0x524eb(%rip), %rcx     # 0x594aa
movl $0x380, %edx            # imm = 0x380
callq 0x4200