// File: sisong[P]ApkDiffPatch/src/diff/DiffData.cpp
// Function: serializeZipDiffData(std::vector<unsigned char, std::allocator<unsigned char>>&, UnZipper*, UnZipper*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<unsigned char, std::allocator<unsigned char>> const&, hdiff_TCompress const*, unsigned long)
bool serializeZipDiffData(std::vector<TByte>& out_data, UnZipper* newZip,UnZipper* oldZip,
                          size_t newZipAlignSize,size_t compressLevel,size_t compressMemLevel,
                          size_t otherCompressLevel,size_t otherCompressMemLevel,
                          const std::vector<uint32_t>& samePairList,
                          const std::vector<uint32_t>& newRefOtherCompressedList,
                          const std::vector<uint32_t>& newRefCompressedSizeList,
                          const std::vector<uint32_t>& oldRefList,
                          const std::vector<TByte>&    hdiffzData,
                          const hdiff_TCompress* compressPlugin,
                          const size_t patchModel){
    ZipDiffData  data;
    memset(&data,0,sizeof(ZipDiffData));
    data.PatchModel=patchModel; //now must 0 or 1
    data.newZipFileCount=UnZipper_fileCount(newZip);
    data.newZipIsDataNormalized=newZip->_isDataNormalized?1:0;
    data.newZipAlignSize=newZipAlignSize;
    data.newCompressLevel=compressLevel;
    data.newCompressMemLevel=compressMemLevel;
    data.newOtherCompressLevel=otherCompressLevel;
    data.newOtherCompressMemLevel=otherCompressMemLevel;
    data.newZipCESize=UnZipper_CESize(newZip);
    data.samePairList=(uint32_t*)samePairList.data();
    data.samePairCount=samePairList.size()/2;
    data.newRefOtherCompressedList=(uint32_t*)newRefOtherCompressedList.data();
    data.newRefOtherCompressedCount=newRefOtherCompressedList.size();
    data.newRefCompressedSizeList=(uint32_t*)newRefCompressedSizeList.data();
    data.newRefCompressedSizeCount=newRefCompressedSizeList.size();
    data.oldZipIsDataNormalized=(UnZipper_isHaveApkV2Sign(oldZip)&&oldZip->_isDataNormalized)?1:0;
    data.oldIsFileDataOffsetMatch=(UnZipper_isHaveApkV2Sign(oldZip)&&oldZip->_isFileDataOffsetMatch)?1:0;
    data.oldZipCESize=UnZipper_CESize(oldZip);
    data.oldRefList=(uint32_t*)oldRefList.data();
    data.oldRefCount=oldRefList.size();
    data.oldCrc=OldStream_getOldCrc(oldZip,oldRefList.data(),oldRefList.size());
    data.normalizeSoPageAlign=UnZipper_getHugePageAlign(newZip,newZipAlignSize);
    return _serializeZipDiffData(out_data,&data,hdiffzData,compressPlugin,newZip);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
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)
movq %r9, -0x30(%rbp)
leaq -0x160(%rbp), %rdi
xorl %esi, %esi
movl $0x130, %edx            # imm = 0x130
callq 0x4210
movq 0x50(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7ea90
cltq
movq %rax, -0x158(%rbp)
movq -0x10(%rbp), %rax
movb 0x89(%rax), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cltq
movq %rax, -0x150(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x138(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x130(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rdi
callq 0xaec0
movq %rax, -0x120(%rbp)
movq 0x20(%rbp), %rdi
callq 0xc340
movq %rax, -0x118(%rbp)
movq 0x20(%rbp), %rdi
callq 0xc360
shrq %rax
movq %rax, -0x110(%rbp)
movq 0x28(%rbp), %rdi
callq 0xc340
movq %rax, -0x108(%rbp)
movq 0x28(%rbp), %rdi
callq 0xc360
movq %rax, -0x100(%rbp)
movq 0x30(%rbp), %rdi
callq 0xc340
movq %rax, -0xf8(%rbp)
movq 0x30(%rbp), %rdi
callq 0xc360
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9360
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x161(%rbp)
jne 0xad9b
jmp 0xadab
movq -0x18(%rbp), %rax
movb 0x89(%rax), %al
movb %al, -0x161(%rbp)
movb -0x161(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cltq
movq %rax, -0xe8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9360
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x162(%rbp)
jne 0xade1
jmp 0xadf1
movq -0x18(%rbp), %rax
movb 0x8a(%rax), %al
movb %al, -0x162(%rbp)
movb -0x162(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cltq
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
callq 0xaec0
movq %rax, -0xd8(%rbp)
movq 0x38(%rbp), %rdi
callq 0xc340
movq %rax, -0xd0(%rbp)
movq 0x38(%rbp), %rdi
callq 0xc360
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x178(%rbp)
movq 0x38(%rbp), %rdi
callq 0xc340
movq %rax, -0x170(%rbp)
movq 0x38(%rbp), %rdi
callq 0xc360
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
movq %rax, %rdx
callq 0x7bd60
movl %eax, -0xc0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x817c0
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movq 0x40(%rbp), %rdx
movq 0x48(%rbp), %rcx
movq -0x10(%rbp), %r8
leaq -0x160(%rbp), %rsi
callq 0xaef0
andb $0x1, %al
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopl (%rax,%rax)