// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
callq 0x14720
movsd %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0xbe90
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0xbe90
movq %rax, -0x48(%rbp)
movq 0xd1e47(%rip), %rdi     # 0xe5fc8
leaq 0x9a298(%rip), %rsi     # 0xae420
callq 0x4380
movq 0xd1e34(%rip), %rdi     # 0xe5fc8
leaq 0x9a293(%rip), %rsi     # 0xae42e
callq 0x4380
movq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0x40b0
movq %rax, %rdi
leaq 0x9a289(%rip), %rsi     # 0xae43f
callq 0x4380
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x40b0
movq %rax, %rdi
leaq 0x98275(%rip), %rsi     # 0xac446
callq 0x4380
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0xbb60
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
callq 0xbb60
movq %rax, -0x60(%rbp)
movb $0x1, -0x61(%rbp)
movq $0x1000, -0x70(%rbp)    # imm = 0x1000
cmpq $0x0, -0x30(%rbp)
jne 0x14254
movq -0x58(%rbp), %rdi
movq -0x58(%rbp), %rsi
addq -0x48(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x60(%rbp), %rcx
addq -0x40(%rbp), %rcx
movq -0x50(%rbp), %r8
movq -0x20(%rbp), %r9
movl -0x24(%rbp), %r10d
movslq 0x10(%rbp), %rax
movl %r10d, (%rsp)
movl $0x1, 0x8(%rsp)
movq $0x1000, 0x10(%rsp)     # imm = 0x1000
movq %rax, 0x18(%rsp)
callq 0x31950
jmp 0x142b7
movq 0xd1d6d(%rip), %rdi     # 0xe5fc8
leaq 0x9a1ef(%rip), %rsi     # 0xae451
callq 0x4380
movq -0x58(%rbp), %rdi
movq -0x58(%rbp), %rsi
addq -0x48(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x60(%rbp), %rcx
addq -0x40(%rbp), %rcx
movq -0x50(%rbp), %r8
movq -0x20(%rbp), %r9
movl -0x24(%rbp), %r11d
movq -0x30(%rbp), %r10
movslq 0x10(%rbp), %rax
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movq $0x1000, 0x18(%rsp)     # imm = 0x1000
movq %rax, 0x20(%rsp)
callq 0x31e90
callq 0x14720
movsd %xmm0, -0x78(%rbp)
movq 0xd1d00(%rip), %rdi     # 0xe5fc8
leaq 0x9a1aa(%rip), %rsi     # 0xae479
callq 0x4380
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rdi
callq 0xbe90
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x40b0
movq %rax, %rdi
leaq 0x9814f(%rip), %rsi     # 0xac446
callq 0x4380
movq 0xd1cc5(%rip), %rdi     # 0xe5fc8
leaq 0x9a180(%rip), %rsi     # 0xae48a
callq 0x4380
movq %rax, %rdi
movsd -0x78(%rbp), %xmm0
subsd -0x38(%rbp), %xmm0
callq 0x46e0
movq %rax, %rdi
leaq 0x980e0(%rip), %rsi     # 0xac40b
callq 0x4380
movb $0x1, %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)