// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/diff/DiffData.cpp
// Function: getSamePairList(UnZipper*, UnZipper*, bool, int, int, std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&)
bool getSamePairList(UnZipper* newZip,UnZipper* oldZip,
                     bool newCompressedDataIsNormalized,
                     int zlibCompressLevel,int zlibCompressMemLevel,
                     std::vector<uint32_t>& out_samePairList,
                     std::vector<uint32_t>& out_newRefList,
                     std::vector<uint32_t>& out_newRefOtherCompressedList,
                     std::vector<uint32_t>& out_newRefCompressedSizeList){
    int oldFileCount=UnZipper_fileCount(oldZip);
    typedef std::multimap<uint32_t,int> TMap;
    TMap crcMap;
    for (int i=0; i<oldFileCount; ++i) {
        uint32_t crcOld=UnZipper_file_crc32(oldZip,i);
        crcMap.insert(TMap::value_type(crcOld,i));
    }
    
    int newFileCount=UnZipper_fileCount(newZip);
    for (int i=0; i<newFileCount; ++i) {
        ZipFilePos_t compressedSize=UnZipper_file_compressedSize(newZip,i);
        if (UnZipper_file_isReCompressedByApkV2Sign(newZip,i)){
            out_newRefOtherCompressedList.push_back(i);
            out_newRefCompressedSizeList.push_back(compressedSize);
        }else if ((0==UnZipper_file_uncompressedSize(newZip,i))
                  &&(!UnZipper_file_isCompressed(newZip,i))){ //empty entry
            check(0==compressedSize);
            //not need: out_newRefList.push_back(i);
        }else{
            bool findSame=false;
            int  oldSameIndex=-1;
            uint32_t crcNew=UnZipper_file_crc32(newZip,i);
            std::pair<TMap::const_iterator,TMap::const_iterator> range=crcMap.equal_range(crcNew);
            for (;range.first!=range.second;++range.first) {
                int oldIndex=range.first->second;
                if (zipFileData_isSame(newZip,i,oldZip,oldIndex)){
                    if (UnZipper_file_isReCompressedByApkV2Sign(oldZip,oldIndex))
                        continue;
                    if ((!UnZipper_file_isCompressed(oldZip,oldIndex))&&
                        UnZipper_file_isCompressed(newZip,i)) continue;
                    findSame=true;
                    oldSameIndex=oldIndex;
                    if (zipFile_name(newZip,i)==zipFile_name(oldZip,oldIndex)) break;
                }else{
                    printf("WARNING: crc32 equal but data not equal! file index: %d,%d\n",i,oldIndex);
                    hpatch_printPath_utf8(("   name: \""+zipFile_name(newZip,i)+"\"\n").c_str());
                    hpatch_printPath_utf8(("         \""+zipFile_name(oldZip,oldIndex)+"\"\n").c_str());
                }
            }
            if (findSame){
                out_samePairList.push_back(i);
                out_samePairList.push_back(oldSameIndex);
            }else{
                out_newRefList.push_back(i);
                if (UnZipper_file_isCompressed(newZip,i)){
                    if (newCompressedDataIsNormalized){
                        out_newRefCompressedSizeList.push_back(compressedSize);
                    }else{
                        std::vector<TByte> code;
                        check(getNormalizedCompressedCode(newZip,i,code,zlibCompressLevel,zlibCompressMemLevel));
                        out_newRefCompressedSizeList.push_back((uint32_t)code.size());
                    }
                }
            }
        }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, 0x60(%rsp)
movl %r8d, 0x90(%rsp)
movl %ecx, 0x8c(%rsp)
movl %edx, 0x94(%rsp)
movq %rsi, %r12
movq %rdi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x3f577
movl %eax, %ebx
leaq 0xb0(%rsp), %rax
movl $0x0, (%rax)
xorl %r14d, %r14d
movq %r14, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %r14, 0x20(%rax)
testl %ebx, %ebx
jle 0x8152
leaq 0xa8(%rsp), %r15
leaq 0x10(%rsp), %rbp
movq %r12, %rdi
movl %r14d, %esi
callq 0x4053e
movl %eax, 0x10(%rsp)
movl %r14d, 0x14(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0xa824
incl %r14d
cmpl %r14d, %ebx
jne 0x812b
movq 0x8(%rsp), %rdi
callq 0x3f577
movl %eax, 0x98(%rsp)
testl %eax, %eax
jle 0x87f4
leaq 0x78(%rsp), %r13
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x40533
movl %eax, 0x34(%rsp)
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3fab7
testb %al, %al
je 0x81bb
movl %ebp, 0x10(%rsp)
movq 0x118(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x8682
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x868c
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x40520
testl %eax, %eax
jne 0x81df
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3fadd
testb %al, %al
je 0x8709
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x4053e
movl %eax, 0x9c(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0x9c(%rsp), %rsi
callq 0xa9ae
movq %rax, %r15
movq %rdx, 0xa0(%rsp)
cmpq %rdx, %rax
je 0x8660
movl $0xffffffff, 0x58(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x5c(%rsp)
movl 0x24(%r15), %r14d
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x72a0
testb %al, %al
je 0x8321
movq %r12, %rdi
movl %r14d, %esi
callq 0x3fab7
testb %al, %al
jne 0x8612
movq %r12, %rdi
movl %r14d, %esi
callq 0x3fadd
testb %al, %al
jne 0x827f
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3fadd
testb %al, %al
jne 0x8612
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3f580
movl %eax, %ebx
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3f594
movslq %ebx, %rdx
addq %rax, %rdx
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x7208
movq %r12, %rdi
movl %r14d, %esi
callq 0x3f580
movl %eax, %ebx
movq %r12, %rdi
movl %r14d, %esi
callq 0x3f594
movslq %ebx, %rdx
addq %rax, %rdx
leaq 0x48(%rsp), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x7208
movq 0x18(%rsp), %rdx
cmpq 0x40(%rsp), %rdx
jne 0x85ba
movq 0x38(%rsp), %rbx
testq %rdx, %rdx
je 0x85c4
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x4310
testl %eax, %eax
sete %r13b
jmp 0x85c7
leaq 0x51f9b(%rip), %rdi     # 0x5a2c3
movl %ebp, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4060
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3f580
movl %eax, %ebx
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3f594
movslq %ebx, %rdx
addq %rax, %rdx
movq %r13, 0x68(%rsp)
leaq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x7208
movl $0xa, %r8d
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x51f83(%rip), %rcx     # 0x5a2ff
callq 0x4360
leaq 0x48(%rsp), %rsi
movq %rsi, 0x38(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x83a9
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x83af
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38(%rsp), %rdi
leaq 0x50cd0(%rip), %rsi     # 0x590a3
callq 0x4640
leaq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8400
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x8406
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rdi
callq 0x47654
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8444
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x8460
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x8477
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4300
movq %r12, %rdi
movl %r14d, %esi
callq 0x3f580
movl %eax, %ebx
movq %r12, %rdi
movl %r14d, %esi
callq 0x3f594
movslq %ebx, %rdx
addq %rax, %rdx
movq %r13, 0x68(%rsp)
leaq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x7208
movl $0xa, %r8d
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x51e4d(%rip), %rcx     # 0x5a30a
callq 0x4360
leaq 0x48(%rsp), %rsi
movq %rsi, 0x38(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x84ea
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x84f0
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38(%rsp), %rdi
leaq 0x50b8f(%rip), %rsi     # 0x590a3
callq 0x4640
leaq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8541
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x8547
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rdi
callq 0x47654
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8585
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x85a1
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x8612
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x8612
movq 0x38(%rsp), %rbx
xorl %r13d, %r13d
jmp 0x85c7
movb $0x1, %r13b
leaq 0x48(%rsp), %rax
cmpq %rax, %rbx
je 0x85e1
movq 0x48(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x4300
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x85fd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movb $0x1, %al
movl %eax, 0x5c(%rsp)
movl %r14d, 0x58(%rsp)
testb %r13b, %r13b
leaq 0x78(%rsp), %r13
jne 0x8637
movq %r15, %rdi
callq 0x4380
movq %rax, %r15
cmpq 0xa0(%rsp), %rax
jne 0x822b
movl 0x58(%rsp), %r14d
testb $0x1, 0x5c(%rsp)
je 0x8660
movl %ebp, 0x10(%rsp)
movq 0x60(%rsp), %rbx
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0x877f
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x8794
movl %ebp, 0x10(%rsp)
movq 0x110(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x86c0
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x86ca
leaq 0x10(%rsp), %rdx
callq 0xa8d2
movq 0x120(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x86b1
movl 0x34(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x87e5
leaq 0x34(%rsp), %rdx
callq 0xa6e8
jmp 0x87e5
leaq 0x10(%rsp), %rdx
callq 0xa8d2
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x3fadd
testb %al, %al
je 0x87e5
cmpb $0x0, 0x94(%rsp)
je 0x8719
movq 0x120(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
jne 0x869e
leaq 0x34(%rsp), %rdx
callq 0xa6e8
jmp 0x87e5
cmpl $0x0, 0x34(%rsp)
je 0x87e5
jmp 0x8815
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rdi
movl %ebp, %esi
leaq 0x10(%rsp), %rdx
movl 0x8c(%rsp), %ecx
movl 0x90(%rsp), %r8d
callq 0x7dc2
testb %al, %al
je 0x8840
movl 0x18(%rsp), %eax
movq 0x10(%rsp), %rdi
subl %edi, %eax
movl %eax, 0x38(%rsp)
movq 0x120(%rsp), %rcx
movq 0x8(%rcx), %rsi
cmpq 0x10(%rcx), %rsi
je 0x87c1
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rcx)
jmp 0x87d3
movq %rbx, %rdi
leaq 0x10(%rsp), %rdx
callq 0xa8d2
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
movl %r14d, 0x10(%rsp)
cmpq %rax, %rsi
je 0x87b0
movl %r14d, (%rsi)
addq $0x4, %rsi
movq 0x60(%rsp), %rax
movq %rsi, 0x8(%rax)
jmp 0x87e5
movq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xa8d2
jmp 0x87e5
movq %rcx, %rdi
leaq 0x38(%rsp), %rdx
callq 0xa8d2
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x87e5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
incl %ebp
cmpl 0x98(%rsp), %ebp
jne 0x8172
leaq 0xa8(%rsp), %rdi
callq 0x9c00
movb $0x1, %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x520e3(%rip), %rdi     # 0x5a8ff
callq 0x44e0
leaq 0x51828(%rip), %rdi     # 0x5a050
leaq 0x51827(%rip), %rsi     # 0x5a056
leaq 0x519ec(%rip), %rcx     # 0x5a222
movl $0x129, %edx            # imm = 0x129
callq 0x4200
leaq 0x520d1(%rip), %rdi     # 0x5a918
callq 0x44e0
leaq 0x517fd(%rip), %rdi     # 0x5a050
leaq 0x517fc(%rip), %rsi     # 0x5a056
leaq 0x519c1(%rip), %rcx     # 0x5a222
movl $0x14a, %edx            # imm = 0x14A
callq 0x4200
jmp 0x887c
jmp 0x8945
jmp 0x8945
jmp 0x8945
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8948
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
jmp 0x891f
jmp 0x8945
jmp 0x8945
jmp 0x8945
jmp 0x8945
jmp 0x8945
jmp 0x8945
jmp 0x8945
jmp 0x8945
jmp 0x88c4
movq %rax, %rbx
jmp 0x88f1
jmp 0x88cb
movq %rax, %rbx
jmp 0x890d
jmp 0x88d2
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x88f1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
leaq 0x48(%rsp), %rax
movq 0x38(%rsp), %rdi
cmpq %rax, %rdi
je 0x890d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x8948
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x8948
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8948
movq 0x20(%rsp), %rsi
jmp 0x891c
jmp 0x8945
jmp 0x8945
jmp 0x8945
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x9c00
movq %rbx, %rdi
callq 0x45e0