// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/src/diff/OldRef.cpp
// Function: getOldRefList(UnZipper*, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&, UnZipper*, std::vector<unsigned int, std::allocator<unsigned int>>&)
bool getOldRefList(UnZipper* newZip,const std::vector<uint32_t>& samePairList,
                   const std::vector<uint32_t>& newRefList,
                   UnZipper* oldZip,std::vector<uint32_t>& out_oldRefList){
    std::vector<uint32_t> oldSameList(samePairList.size()/2);
    for (size_t i=0; i<oldSameList.size(); ++i)
        oldSameList[i]=samePairList[i*2+1];
    std::sort(oldSameList.begin(),oldSameList.end());
    
    int oldZipFileCount=UnZipper_fileCount(oldZip);
    std::vector<uint32_t> decompressList;
    size_t iOldSame=0;
    for (int i=0; i<oldZipFileCount; ++i) {
        bool isInSame=false;
        while ((iOldSame<oldSameList.size())&&(i==(int)oldSameList[iOldSame])){
            isInSame=true;
            ++iOldSame;
        }
        if (UnZipper_file_uncompressedSize(oldZip,i)<=0)
            continue;
        if(!UnZipper_file_isCompressed(oldZip,i))
            out_oldRefList.push_back(i);//反正不用解压,不用判断其是否有参考意义了;
        else if (!isInSame) //跳过和newZip中相同的文件,但某些情况可能会使得结果变大;
            decompressList.push_back(i);
    }
    assert(iOldSame==oldSameList.size());
    //optimize: continue to reduce the decompressList?
    out_oldRefList.insert(out_oldRefList.end(),decompressList.begin(),decompressList.end());
    std::sort(out_oldRefList.begin(),out_oldRefList.end());
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movq 0x8(%rsi), %rsi
subq (%r15), %rsi
sarq $0x2, %rsi
shrq %rsi
leaq 0x30(%rsp), %r12
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0xb02e
movq (%r12), %rdi
movq 0x8(%r12), %rsi
movq %rsi, %rax
subq %rdi, %rax
sarq $0x2, %rax
movq (%r15), %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0xaee2
movl 0x4(%rcx,%rdx,8), %r8d
movl %r8d, (%rdi,%rdx,4)
incq %rdx
jmp 0xaecf
callq 0xaa7d
movq %r14, %rdi
callq 0x36bfd
movl %eax, %ebp
leaq 0x10(%rsp), %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
xorl %r12d, %r12d
testl %ebp, %ebp
cmovlel %r12d, %ebp
xorl %r15d, %r15d
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
sarq $0x2, %rax
cmpl %ebp, %r12d
je 0xaf97
cmpq %rax, %r15
cmovaq %r15, %rax
xorl %r13d, %r13d
cmpq %r15, %rax
je 0xaf40
cmpl (%rcx,%r15,4), %r12d
jne 0xaf43
incq %r15
movb $0x1, %r13b
jmp 0xaf2d
movq %rax, %r15
movq %r14, %rdi
movl %r12d, %esi
callq 0x37b03
testl %eax, %eax
je 0xaf8f
movq %r14, %rdi
movl %r12d, %esi
callq 0x370d6
testb %al, %al
je 0xaf7d
testb $0x1, %r13b
jne 0xaf8f
movl %r12d, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x937e
jmp 0xaf8f
movl %r12d, 0xc(%rsp)
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x937e
incl %r12d
jmp 0xaf0d
cmpq %rax, %r15
jne 0xafe3
movq 0x8(%rbx), %rsi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq %rbx, %rdi
callq 0xa80a
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0xaa7d
leaq 0x10(%rsp), %rdi
callq 0x90f0
leaq 0x30(%rsp), %rdi
callq 0x90f0
movb $0x1, %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x45476(%rip), %rdi     # 0x50460
leaq 0x4548c(%rip), %rsi     # 0x5047d
leaq 0x45499(%rip), %rcx     # 0x50491
pushq $0x39
popq %rdx
callq 0x4230
jmp 0xb00f
jmp 0xb00f
jmp 0xb006
movq %rax, %rbx
jmp 0xb01c
jmp 0xb00f
jmp 0xb00f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x90f0
leaq 0x30(%rsp), %rdi
callq 0x90f0
movq %rbx, %rdi
callq 0x4600