// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/diff.cpp
// Function: check_lite_diff(unsigned char const*, unsigned char const*, unsigned char const*, unsigned char const*, unsigned char const*, unsigned char const*, hpatch_TDecompress*)
bool check_lite_diff(const hpi_byte* newData,const hpi_byte* newData_end,
                     const hpi_byte* oldData,const hpi_byte* oldData_end,
                     const hpi_byte* lite_diff,const hpi_byte* lite_diff_end,
                     hpatch_TDecompress* decompressPlugin){
    TPatchiListener listener;
    listener.diffData_cur=lite_diff;
    listener.diffData_end=lite_diff_end;
    hpi_compressType _compress_type;
    hpi_pos_t saved_newSize;
    hpi_pos_t saved_uncompressSize;
    if (!_try_open_hpatchi_and_inplace(listener,&_compress_type,
                                       &saved_newSize,&saved_uncompressSize)) return false;
    if (saved_newSize!=(size_t)(newData_end-newData)) return false;
    listener.diff_data=&listener;
    listener.decompressPlugin=(_compress_type!=hpi_compressType_no)?decompressPlugin:0;
    if (listener.decompressPlugin){
        listener.uncompressSize=saved_uncompressSize;
        mem_as_hStreamInput(&listener.diffStream,listener.diffData_cur,lite_diff_end);
        listener.decompresser=decompressPlugin->open(decompressPlugin,saved_uncompressSize,&listener.diffStream,
                                                     0,(size_t)(lite_diff_end-listener.diffData_cur));
        if (listener.decompresser==0) return false;
        listener.read_diff=listener._read_diff_dec;
    }else{
        listener.read_diff=listener._read_diff;
    }
    listener.newData_cur=newData;
    listener.newData_end=newData_end;
    listener.write_new=listener._write_new;
    listener.oldData=oldData;
    listener.oldData_end=oldData_end;
    listener.read_old=listener._read_old;

    const size_t kACacheBufSize=1024*32;
    hdiff_private::TAutoMem _cache(kACacheBufSize+listener.extraSafeSize);
    
    if (listener.isInplacePatch){
        if (!hpatchi_inplaceB(&listener,saved_newSize,_cache.data(),listener.extraSafeSize,(hpi_size_t)_cache.size()))
            return false;
    }else if (!hpatch_lite_patch(&listener,saved_newSize,_cache.data(),(hpi_size_t)_cache.size())){
        return false;
    }
    return listener.newData_cur==listener.newData_end;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, %r13
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
leaq 0x10(%rsp), %rbp
movq %rax, 0x20(%rbp)
movq %rax, 0x90(%rbp)
movq %r8, 0x30(%rbp)
movq %r9, 0x38(%rbp)
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
movq %rbp, %rdi
callq 0x11a45
testb %al, %al
je 0x11b9d
movl 0x8(%rsp), %eax
movq %r15, %rcx
subq %r12, %rcx
cmpq %rax, %rcx
jne 0x11b9d
movq %rbp, 0x10(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xc(%rsp)
cmovneq 0xe0(%rsp), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x11bc5
movl 0x4(%rsp), %eax
leaq 0x50(%rsp), %rbp
movl %eax, 0x20(%rbp)
movq -0x10(%rbp), %rsi
movq %rbp, %rdi
movq %r13, %rdx
callq 0x4392d
movl 0x4(%rsp), %esi
subq 0x40(%rsp), %r13
movq 0xe0(%rsp), %rdi
movq %rbp, %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq *0x8(%rdi)
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x11b9d
leaq 0x159(%rip), %rax       # 0x11cf4
jmp 0x11bcc
xorl %ebp, %ebp
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x11bb1
movq 0x38(%rsp), %rdi
callq *0x10(%rdi)
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x162(%rip), %rax       # 0x11d2e
movq %rax, 0x18(%rsp)
movq %r12, 0x78(%rsp)
movq %r15, 0x80(%rsp)
leaq 0x189(%rip), %rax       # 0x11d6e
movq %rax, 0x28(%rsp)
movq %r14, 0x88(%rsp)
movq %rbx, 0x90(%rsp)
leaq 0x1bb(%rip), %rax       # 0x11dbc
movq %rax, 0x20(%rsp)
movl 0x9c(%rsp), %r15d
leaq 0x8000(%r15), %r14
movq %r14, %rdi
callq 0x4400
testq %rax, %rax
je 0x11c7e
movq %rax, %rbx
movl 0x8(%rsp), %esi
cmpb $0x1, 0x98(%rsp)
jne 0x11c48
leaq 0x10(%rsp), %rdi
movq %rbx, %rdx
movl %r15d, %ecx
movl %r14d, %r8d
callq 0xd160
jmp 0x11c58
leaq 0x10(%rsp), %rdi
movq %rbx, %rdx
movl %r14d, %ecx
callq 0xcced
testl %eax, %eax
je 0x11c6f
movq 0x78(%rsp), %rax
cmpq 0x80(%rsp), %rax
sete %bpl
jmp 0x11c71
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x43b0
jmp 0x11b9f
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x4a67d(%rip), %rsi     # 0x5c30f
movq %rax, %rdi
callq 0x4110
movq 0x6a347(%rip), %rsi     # 0x7bfe8
movq 0x6a310(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
jmp 0x11cce
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
jmp 0x11cd1
movq %rax, %r14
movq %rbx, %rdi
callq 0x43b0
jmp 0x11cd1
jmp 0x11ceb
movq %rax, %r14
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x11ce3
movq 0x38(%rsp), %rdi
callq *0x10(%rdi)
movq %r14, %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x9db0
nop