// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: getStreamClip
hpatch_BOOL getStreamClip(TStreamCacheClip* out_clip,_TDecompressInputStream* out_stream,
                          hpatch_StreamPos_t dataSize,hpatch_StreamPos_t compressedSize,
                          const hpatch_TStreamInput* stream,hpatch_StreamPos_t* pCurStreamPos,
                          hpatch_TDecompress* decompressPlugin,TByte* aCache,hpatch_size_t cacheSize){
    hpatch_StreamPos_t curStreamPos=*pCurStreamPos;
    if (compressedSize==0){
#ifdef __RUN_MEM_SAFE_CHECK
        if ((curStreamPos+dataSize)<curStreamPos) return _hpatch_FALSE;
        if ((curStreamPos+dataSize)>stream->streamSize) return _hpatch_FALSE;
#endif
        if (out_clip)
            _TStreamCacheClip_init(out_clip,stream,curStreamPos,curStreamPos+dataSize,aCache,cacheSize);
        curStreamPos+=dataSize;
    }else{
#ifdef __RUN_MEM_SAFE_CHECK
        if ((curStreamPos+compressedSize)<curStreamPos) return _hpatch_FALSE;
        if ((curStreamPos+compressedSize)>stream->streamSize) return _hpatch_FALSE;
#endif
        if (out_clip){
            out_stream->IInputStream.streamImport=out_stream;
            out_stream->IInputStream.streamSize=dataSize;
            out_stream->IInputStream.read=_decompress_read;
            out_stream->decompressPlugin=decompressPlugin;
            if (out_stream->decompressHandle==0){
                out_stream->decompressHandle=decompressPlugin->open(decompressPlugin,dataSize,stream,
                                                                    curStreamPos,curStreamPos+compressedSize);
                if (!out_stream->decompressHandle) return _hpatch_FALSE;
            }else{
                if (decompressPlugin->reset_code==0) return _hpatch_FALSE;
                if (!decompressPlugin->reset_code(out_stream->decompressHandle,dataSize,stream,curStreamPos,
                                                  curStreamPos+compressedSize)) return _hpatch_FALSE;
            }
            _TStreamCacheClip_init(out_clip,&out_stream->IInputStream,0,
                                   out_stream->IInputStream.streamSize,aCache,cacheSize);
        }
        curStreamPos+=compressedSize;
    }
    *pCurStreamPos=curStreamPos;
    return hpatch_TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %rcx, %r15
movq %rdi, %r14
movq (%r9), %rcx
xorl %ebp, %ebp
testq %r15, %r15
je 0x448d8
addq %rcx, %r15
jb 0x4496f
cmpq 0x8(%r8), %r15
ja 0x4496f
testq %r14, %r14
je 0x44967
movq %rsi, %r12
movq 0x30(%rsp), %rdi
movq %rsi, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0xd8(%rip), %rax        # 0x4497a
movq %rax, 0x10(%rsi)
movq %rdi, 0x20(%rsi)
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x44921
movq 0x20(%rdi), %r9
testq %r9, %r9
je 0x4496f
movq %rax, %rdi
movq %rdx, %rsi
movq %r8, %rdx
movq %r15, %r8
callq *%r9
testl %eax, %eax
jne 0x44937
jmp 0x4496f
addq %rcx, %rdx
jb 0x4496f
movq 0x8(%r8), %rax
cmpq %rax, %rdx
ja 0x4496f
testq %r14, %r14
je 0x44964
testq %r8, %r8
cmoveq %r8, %rax
movq %rdx, %r15
cmpq %rdx, %rax
jae 0x44941
leaq 0x1d196(%rip), %rdi     # 0x61a9f
leaq 0x1d1e0(%rip), %rsi     # 0x61af0
leaq 0x1d209(%rip), %rcx     # 0x61b20
movl $0x55, %edx
callq 0x4200
movq %rdx, %rsi
movq %r8, %rdx
movq %r15, %r8
callq *0x8(%rdi)
movq %rax, 0x28(%r12)
testq %rax, %rax
je 0x4496f
movq 0x8(%r12), %rdx
xorl %ecx, %ecx
movq %r12, %r8
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rsi
movq %rcx, (%r14)
movq %rdx, 0x8(%r14)
movq %r8, 0x10(%r14)
movq %rsi, 0x18(%r14)
movq %rax, 0x20(%r14)
movq %rax, 0x28(%r14)
jmp 0x44967
movq %rdx, %r15
movq %r15, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq