// File: sisong[P]ApkDiffPatch/src/diff/Differ.cpp
// Function: ZipDiff(char const*, char const*, char const*, hdiff_TCompress const*, hpatch_TDecompress*, int, unsigned long, bool*, int)
bool ZipDiff(const char* oldZipPath,const char* newZipPath,const char* outDiffFileName,
             const hdiff_TCompress* compressPlugin,hpatch_TDecompress* decompressPlugin,
             int diffMatchScore,size_t patchStepMemSize,bool* out_isNewZipApkV2SignNoError,int threadNum){
    hpatch_TFileStreamInput    oldZipStream;
    hpatch_TFileStreamInput    newZipStream;
    hpatch_TFileStreamOutput   outDiffStream;
    bool            result=true;
    bool            _isInClear=false;
    
    hpatch_TFileStreamInput_init(&oldZipStream);
    hpatch_TFileStreamInput_init(&newZipStream);
    hpatch_TFileStreamOutput_init(&outDiffStream);
    check(hpatch_TFileStreamInput_open(&oldZipStream,oldZipPath));
    check(hpatch_TFileStreamInput_open(&newZipStream,newZipPath));
    check(hpatch_TFileStreamOutput_open(&outDiffStream,outDiffFileName,(hpatch_StreamPos_t)(-1)));
    hpatch_TFileStreamOutput_setRandomOut(&outDiffStream,hpatch_TRUE);
    result=ZipDiffWithStream(&oldZipStream.base,&newZipStream.base,&outDiffStream.base,
                             compressPlugin,decompressPlugin,diffMatchScore,patchStepMemSize,
                             out_isNewZipApkV2SignNoError,threadNum);
clear:
    _isInClear=true;
    check(hpatch_TFileStreamOutput_close(&outDiffStream));
    check(hpatch_TFileStreamInput_close(&newZipStream));
    check(hpatch_TFileStreamInput_close(&oldZipStream));
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movb $0x1, -0x101(%rbp)
movb $0x0, -0x102(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x12940
leaq -0xb0(%rbp), %rdi
callq 0x12940
leaq -0x100(%rbp), %rdi
callq 0x12970
movq -0x8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x8da90
cmpl $0x0, %eax
jne 0x127b4
leaq 0x9ad36(%rip), %rdi     # 0xad4cc
movb $0x0, %al
callq 0x4060
movb $0x0, -0x101(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x127b2
jmp 0x12880
jmp 0x127b4
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x8da90
cmpl $0x0, %eax
jne 0x127ee
leaq 0x9ad76(%rip), %rdi     # 0xad546
movb $0x0, %al
callq 0x4060
movb $0x0, -0x101(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x127ec
jmp 0x12880
jmp 0x127ee
movq -0x18(%rbp), %rsi
leaq -0x100(%rbp), %rdi
movq $-0x1, %rdx
callq 0x8e140
cmpl $0x0, %eax
jne 0x1282c
leaq 0x9b4b9(%rip), %rdi     # 0xadcca
movb $0x0, %al
callq 0x4060
movb $0x0, -0x101(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x1282a
jmp 0x12880
jmp 0x1282c
leaq -0x100(%rbp), %rdi
movl $0x1, %esi
callq 0x129a0
leaq -0x70(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movl -0x2c(%rbp), %r9d
movq 0x10(%rbp), %r11
movq 0x18(%rbp), %r10
movl 0x20(%rbp), %eax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x129c0
andb $0x1, %al
movb %al, -0x101(%rbp)
movb $0x1, -0x102(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x8edd0
cmpl $0x0, %eax
jne 0x128ba
leaq 0x9b48a(%rip), %rdi     # 0xadd29
movb $0x0, %al
callq 0x4060
movb $0x0, -0x101(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x128b8
jmp 0x12880
jmp 0x128ba
leaq -0xb0(%rbp), %rdi
callq 0x8e030
cmpl $0x0, %eax
jne 0x128ed
leaq 0x9acb3(%rip), %rdi     # 0xad585
movb $0x0, %al
callq 0x4060
movb $0x0, -0x101(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x128eb
jmp 0x12880
jmp 0x128ed
leaq -0x70(%rbp), %rdi
callq 0x8e030
cmpl $0x0, %eax
jne 0x12920
leaq 0x9acb8(%rip), %rdi     # 0xad5ba
movb $0x0, %al
callq 0x4060
movb $0x0, -0x101(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x1291e
jmp 0x12880
jmp 0x12920
movb -0x101(%rbp), %al
andb $0x1, %al
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)