// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: patch_single_stream
hpatch_BOOL patch_single_stream(sspatch_listener_t* listener,
                                const hpatch_TStreamOutput* __out_newData,
                                const hpatch_TStreamInput*  oldData,
                                const hpatch_TStreamInput*  singleCompressedDiff, 
                                hpatch_StreamPos_t  diffInfo_pos,
                                sspatch_coversListener_t* coversListener){
    hpatch_BOOL result=hpatch_TRUE;
    hpatch_TDecompress*     decompressPlugin=0;
    unsigned char*          temp_cache=0;
    unsigned char*          temp_cacheEnd=0;
    hpatch_singleCompressedDiffInfo diffInfo;
    hpatch_TStreamOutput    _out_newData=*__out_newData;
    hpatch_TStreamOutput*   out_newData=&_out_newData;
    TDiffToSingleStream     _toSStream;
    assert((listener)&&(listener->onDiffInfo));
    TDiffToSingleStream_init(&_toSStream,singleCompressedDiff);
    singleCompressedDiff=&_toSStream.base;

    if (!getSingleCompressedDiffInfo(&diffInfo,singleCompressedDiff,diffInfo_pos))
        return _hpatch_FALSE;
    if (diffInfo.newDataSize>out_newData->streamSize)
        return _hpatch_FALSE;
    out_newData->streamSize=diffInfo.newDataSize;
    if (diffInfo.oldDataSize!=oldData->streamSize)
        return _hpatch_FALSE;
    if (!listener->onDiffInfo(listener,&diffInfo,&decompressPlugin,&temp_cache,&temp_cacheEnd))
        return _hpatch_FALSE;

    if ((temp_cache==0)||(temp_cache>=temp_cacheEnd))
        result=_hpatch_FALSE;
    if (result){
        result=patch_single_compressed_diff(out_newData,oldData,singleCompressedDiff,diffInfo.diffDataPos,
                                            diffInfo.uncompressedSize,diffInfo.compressedSize,decompressPlugin,
                                            diffInfo.coverCount,(size_t)diffInfo.stepMemSize,
                                            temp_cache,temp_cacheEnd,coversListener);
    }
    if (listener->onPatchFinish)
        listener->onPatchFinish(listener,temp_cache,temp_cacheEnd);
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x11f8, %rsp           # imm = 0x11F8
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x46c6b
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x46c6b
movq %r9, %r15
movq %rdx, %r14
leaq 0x1b8(%rsp), %rsi
movq %rsi, (%rsi)
movq 0x8(%rcx), %rax
movq %rax, 0x8(%rsi)
leaq -0x1cb(%rip), %rax      # 0x4697e
movq %rax, 0x10(%rsi)
xorl %r12d, %r12d
movq %r12, 0x18(%rsi)
movq %rcx, 0x20(%rsi)
movq %r12, 0x28(%rsi)
movq $0x1000, 0x30(%rsi)     # imm = 0x1000
movl $0x0, 0x38(%rsi)
leaq 0x78(%rsp), %rdi
movq %r8, %rdx
callq 0x46721
testl %eax, %eax
je 0x46c59
movq 0x78(%rsp), %rax
cmpq 0x58(%rsp), %rax
ja 0x46c59
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rax
cmpq 0x8(%r14), %rax
jne 0x46c59
leaq 0x78(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0x40(%rsp), %rcx
leaq 0x38(%rsp), %r8
movq %rbx, %rdi
callq *0x8(%rbx)
testl %eax, %eax
je 0x46c59
movq 0x40(%rsp), %rax
testq %rax, %rax
setne %cl
movq 0x38(%rsp), %rdx
cmpq %rdx, %rax
setb %sil
andb %cl, %sil
xorl %r12d, %r12d
cmpb $0x1, %sil
jne 0x46c41
movq 0x98(%rsp), %rcx
movq 0x88(%rsp), %r8
movq 0x90(%rsp), %r9
movq 0x48(%rsp), %rsi
movups 0xa0(%rsp), %xmm0
movq %r15, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rax, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %rsi, (%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
movq %r14, %rsi
callq 0x45f98
movl %eax, %r12d
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x46c59
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq *%rax
movl %r12d, %eax
addq $0x11f8, %rsp           # imm = 0x11F8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1adcc(%rip), %rdi     # 0x61a3e
leaq 0x1a715(%rip), %rsi     # 0x6138e
leaq 0x1ade1(%rip), %rcx     # 0x61a61
movl $0x937, %edx            # imm = 0x937
callq 0x4200