// File: /workspace/github_cpp_makefile_star2_O3/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 0x11785
testb %al, %al
je 0x118e1
movl 0x8(%rsp), %eax
movq %r15, %rcx
subq %r12, %rcx
cmpq %rax, %rcx
jne 0x118e1
movq %rbp, 0x10(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xc(%rsp)
cmovneq 0xe0(%rsp), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x118e8
movl 0x4(%rsp), %eax
leaq 0x50(%rsp), %rbp
movl %eax, 0x20(%rbp)
movq -0x10(%rbp), %rsi
movq %rbp, %rdi
movq %r13, %rdx
callq 0x433a9
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 0x119c6
leaq 0x161(%rip), %rax       # 0x11a40
jmp 0x118ef
xorl %ebp, %ebp
jmp 0x119a0
leaq 0x18b(%rip), %rax       # 0x11a7a
movq %rax, 0x18(%rsp)
movq %r12, 0x78(%rsp)
movq %r15, 0x80(%rsp)
leaq 0x1b2(%rip), %rax       # 0x11aba
movq %rax, 0x28(%rsp)
movq %r14, 0x88(%rsp)
movq %rbx, 0x90(%rsp)
leaq 0x1e4(%rip), %rax       # 0x11b08
movq %rax, 0x20(%rsp)
movl 0x9c(%rsp), %r15d
leaq 0x8000(%r15), %r14
movq %r14, %rdi
callq 0x4400
testq %rax, %rax
je 0x119ca
movq %rax, %rbx
movl 0x8(%rsp), %esi
cmpb $0x1, 0x98(%rsp)
jne 0x1196f
leaq 0x10(%rsp), %rdi
movq %rbx, %rdx
movl %r15d, %ecx
movl %r14d, %r8d
callq 0xced1
jmp 0x1197f
leaq 0x10(%rsp), %rdi
movq %rbx, %rdx
movl %r14d, %ecx
callq 0xca7d
testl %eax, %eax
je 0x11996
movq 0x78(%rsp), %rax
cmpq 0x80(%rsp), %rax
sete %bpl
jmp 0x11998
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x43b0
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x119b2
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
xorl %ebp, %ebp
jmp 0x119b2
movl $0x10, %edi
callq 0x4190
movq %rax, %rbx
leaq 0x4a931(%rip), %rsi     # 0x5c30f
movq %rax, %rdi
callq 0x4110
movq 0x6a5fb(%rip), %rsi     # 0x7bfe8
movq 0x6a5c4(%rip), %rdx     # 0x7bfb8
movq %rbx, %rdi
callq 0x4590
jmp 0x11a1a
movq %rax, %r14
movq %rbx, %rdi
callq 0x4260
jmp 0x11a1d
movq %rax, %r14
movq %rbx, %rdi
callq 0x43b0
jmp 0x11a1d
jmp 0x11a37
movq %rax, %r14
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x11a2f
movq 0x38(%rsp), %rdi
callq *0x10(%rdi)
movq %r14, %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x9b7c
nop