// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/src/diff/Differ.cpp
// Function: HDiffZ(std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>>&, hdiff_TCompress const*, int, unsigned long, int)
static bool HDiffZ(std::vector<TByte>& oldData,std::vector<TByte>& newData,std::vector<TByte>& out_diffData,
                   const hdiff_TCompress* compressPlugin,int myBestMatchScore,size_t patchStepMemSize,int threadNum){
    double time0=clock_s();
    const size_t oldDataSize=oldData.size();
    const size_t newDataSize=newData.size();
    std::cout<<"\nrun hdiffz:\n";
    std::cout<<"  oldDataSize : "<<oldDataSize<<"\n  newDataSize : "<<newDataSize<<"\n";
    
    std::vector<TByte>& diffData=out_diffData;
    TByte* newData0=newData.data();
    TByte* oldData0=oldData.data();
    const bool isUseBigCacheMatch=true;
    const size_t matchBlockSize=1024*4;
    if (patchStepMemSize==0){
        create_compressed_diff_block(newData0,newData0+newDataSize,oldData0,oldData0+oldDataSize,
                                    diffData,compressPlugin,myBestMatchScore,
                                    isUseBigCacheMatch,matchBlockSize,threadNum);
    }else{
        std::cout<<"  create single compressed diffData...\n";
        create_single_compressed_diff_block(newData0,newData0+newDataSize,oldData0,oldData0+oldDataSize,
                                            diffData,compressPlugin,myBestMatchScore,patchStepMemSize,
                                            isUseBigCacheMatch,matchBlockSize,threadNum);
    }
    double time1=clock_s();
    std::cout<<"  diffDataSize: "<<diffData.size()<<"\n";
    std::cout<<"  diff  time: "<<(time1-time0)<<" s\n";
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movq %r8, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, %r14
movl 0x60(%rsp), %eax
movl %eax, 0x4(%rsp)
callq 0xc12e
movq 0x8(%r14), %r13
subq (%r14), %r13
movsd %xmm0, 0x20(%rsp)
movq 0x8(%r15), %rbp
subq (%r15), %rbp
movq 0x70128(%rip), %r12     # 0x7bfc0
leaq 0x4ecd6(%rip), %rsi     # 0x5ab75
movl $0xd, %edx
movq %r12, %rdi
callq 0x4370
leaq 0x4ecd0(%rip), %rsi     # 0x5ab83
movl $0x10, %edx
movq %r12, %rdi
callq 0x4370
movq %r12, %rdi
movq %r13, %rsi
callq 0x4220
movq %rax, %r12
leaq 0x4ecbf(%rip), %rsi     # 0x5ab94
movl $0x11, %edx
movq %rax, %rdi
callq 0x4370
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4220
leaq 0x4ed84(%rip), %rsi     # 0x5ac78
movl $0x1, %edx
movq %rax, %rdi
callq 0x4370
movq (%r15), %r15
movq (%r14), %r14
testq %rbx, %rbx
je 0xbf64
movq 0x700ad(%rip), %rdi     # 0x7bfc0
leaq 0x4ec8c(%rip), %rsi     # 0x5aba6
movl $0x27, %edx
callq 0x4370
addq %r15, %rbp
addq %r14, %r13
movslq 0x4(%rsp), %rax
subq $0x8, %rsp
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq 0x18(%rsp), %r15
movq %r15, %r8
movq 0x20(%rsp), %r9
pushq %rax
pushq $0x1000                 # imm = 0x1000
pushq $0x1
pushq %rbx
pushq 0x30(%rsp)
callq 0x18845
addq $0x30, %rsp
jmp 0xbf9d
addq %r15, %rbp
addq %r14, %r13
movslq 0x4(%rsp), %rax
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq 0x10(%rsp), %r15
movq %r15, %r8
movq 0x18(%rsp), %r9
pushq %rax
pushq $0x1000                 # imm = 0x1000
pushq $0x1
pushq 0x20(%rsp)
callq 0x1837d
addq $0x20, %rsp
callq 0xc12e
movsd %xmm0, 0x8(%rsp)
movq 0x70011(%rip), %r14     # 0x7bfc0
leaq 0x4ec18(%rip), %rsi     # 0x5abce
movl $0x10, %edx
movq %r14, %rdi
callq 0x4370
movq 0x8(%r15), %rsi
subq (%r15), %rsi
movq %r14, %rdi
callq 0x4220
leaq 0x4ec9f(%rip), %rsi     # 0x5ac78
movl $0x1, %edx
movq %rax, %rdi
callq 0x4370
leaq 0x4ebf2(%rip), %rsi     # 0x5abdf
movl $0xe, %edx
movq %r14, %rdi
callq 0x4370
movsd 0x8(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movq %r14, %rdi
callq 0x44f0
leaq 0x4d101(%rip), %rsi     # 0x59116
movl $0x3, %edx
movq %rax, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4370