// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/src/diff/DiffData.cpp
// Function: getZipIsSameWithStream(hpatch_TStreamInput const*, hpatch_TStreamInput const*, int, bool*)
bool getZipIsSameWithStream(const hpatch_TStreamInput* oldZipStream,
                            const hpatch_TStreamInput* newZipStream,
                            int newApkFilesRemoved,bool* out_isOldHaveApkV2Sign){
    UnZipper            newZip;
    UnZipper            oldZip;
    std::map<std::string,int> oldMap;
    bool            result=true;
    bool            _isInClear=false;
    int             fileCount=0;
    
    UnZipper_init(&oldZip);
    UnZipper_init(&newZip);
    check_clear(UnZipper_openStream(&oldZip,oldZipStream));
    check_clear(UnZipper_openStream(&newZip,newZipStream));
    
    if (out_isOldHaveApkV2Sign){
        *out_isOldHaveApkV2Sign=UnZipper_isHaveApkV2Sign(&oldZip);
    }
    
    fileCount=UnZipper_fileCount(&oldZip);
    test_clear(fileCount==UnZipper_fileCount(&newZip)+newApkFilesRemoved);
    for (int i=0;i<fileCount; ++i)
        oldMap[zipFile_name(&oldZip,i)]=i;
    test_clear(oldMap.size()==(size_t)fileCount);
    
    for (int i=0;i<fileCount-newApkFilesRemoved; ++i) {
        std::map<std::string,int>::iterator it=oldMap.find(zipFile_name(&newZip,i));
        test_clear(it!=oldMap.end());
        int old_i=it->second;
        oldMap.erase(it);//del
        test_clear(UnZipper_file_crc32(&oldZip,old_i)==UnZipper_file_crc32(&newZip,i));
        test_clear(zipFileData_isSame(&oldZip,old_i,&newZip,i));
    }
    check_clear(oldMap.size()==newApkFilesRemoved);
    if (newApkFilesRemoved>0){
        for (std::map<std::string,int>::iterator it=oldMap.begin();it!=oldMap.end();++it){
            int old_i=it->second;
            check_clear(UnZipper_file_isApkV1Sign(&oldZip,old_i)
                        ||UnZipper_file_isStampCertFile(&oldZip,old_i)
                        ||(UnZipper_file_uncompressedSize(&oldZip,old_i)==0));
        }
    }

clear:
    _isInClear=true;
    check_clear(UnZipper_close(&newZip));
    check_clear(UnZipper_close(&oldZip));
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rcx, %rbx
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x58(%rsp), %rdi
callq 0x3ff18
leaq 0x108(%rsp), %rdi
callq 0x3ff18
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ffab
testb %al, %al
je 0x78be
leaq 0x108(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ffab
testb %al, %al
je 0x78e9
testq %rbx, %rbx
je 0x7603
movq 0xf0(%rsp), %rax
cmpq 0xa8(%rsp), %rax
setb (%rbx)
leaq 0x58(%rsp), %rdi
callq 0x3f9dd
movl %eax, %r14d
leaq 0x108(%rsp), %rdi
callq 0x3f9dd
addl 0x4(%rsp), %eax
cmpl %eax, %r14d
jne 0x77d2
testl %r14d, %r14d
jle 0x7699
xorl %ebx, %ebx
leaq 0x18(%rsp), %r13
leaq 0x58(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movl %ebx, %esi
callq 0x3f9e6
movl %eax, %ebp
movq %r15, %rdi
movl %ebx, %esi
callq 0x3f9fa
movslq %ebp, %rdx
addq %rax, %rdx
movq %r13, 0x8(%rsp)
movq %r12, %rdi
movq %rax, %rsi
callq 0x7368
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x9d08
movl %ebx, (%rax)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7692
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
incl %ebx
cmpl %ebx, %r14d
jne 0x7640
movslq %r14d, %rax
cmpq %rax, 0x50(%rsp)
jne 0x77d2
movl $0x6, %r15d
subl 0x4(%rsp), %r14d
jle 0x781d
movb $0x1, %al
movl %eax, (%rsp)
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r13
xorl %ebx, %ebx
leaq 0x108(%rsp), %rdi
movl %ebx, %esi
callq 0x3f9e6
movl %eax, %r12d
leaq 0x108(%rsp), %rdi
movl %ebx, %esi
callq 0x3f9fa
movslq %r12d, %rdx
addq %rax, %rdx
movq %r15, 0x8(%rsp)
movq %r13, %rdi
movq %rax, %rsi
callq 0x7368
leaq 0x28(%rsp), %rdi
movq %r13, %rbp
movq %r13, %rsi
callq 0xa7b2
movq %rax, %r12
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x772a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
movl $0x2, %r15d
leaq 0x30(%rsp), %rax
cmpq %rax, %r12
je 0x77a8
movl 0x40(%r12), %r13d
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0xa7f8
leaq 0x58(%rsp), %rdi
movl %r13d, %esi
callq 0x4094c
movl %eax, %r12d
leaq 0x108(%rsp), %rdi
movl %ebx, %esi
callq 0x4094c
cmpl %eax, %r12d
jne 0x77a8
leaq 0x58(%rsp), %rdi
movl %r13d, %esi
leaq 0x108(%rsp), %rdx
movl %ebx, %ecx
callq 0x73f8
movl %eax, %ecx
xorb $0x1, %cl
movzbl %cl, %r15d
addl %r15d, %r15d
movl (%rsp), %ecx
movzbl %cl, %ecx
testb %al, %al
movl $0x0, %eax
cmovel %eax, %ecx
movl %ecx, (%rsp)
jmp 0x77af
movl $0x0, (%rsp)
testl %r15d, %r15d
jne 0x77cd
incl %ebx
cmpl %ebx, %r14d
leaq 0x18(%rsp), %r15
movq %rbp, %r13
jne 0x76c9
movl $0x6, %r15d
movl (%rsp), %ebp
jmp 0x7820
xorl %ebp, %ebp
leaq 0x108(%rsp), %rdi
callq 0x3ff24
testb %al, %al
je 0x7914
leaq 0x58(%rsp), %rdi
callq 0x3ff24
testb %al, %al
je 0x793f
leaq 0x28(%rsp), %rdi
callq 0x9dbc
andb $0x1, %bpl
movl %ebp, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
cmpl $0x2, %r15d
je 0x77d4
cmpl $0x6, %r15d
jne 0x77fb
movl 0x4(%rsp), %ecx
movslq %ecx, %rax
cmpq %rax, 0x50(%rsp)
jne 0x7995
testl %ecx, %ecx
setle %al
movq 0x40(%rsp), %rbx
leaq 0x30(%rsp), %rcx
cmpq %rcx, %rbx
sete %cl
orb %al, %cl
jne 0x77d4
leaq 0x58(%rsp), %r14
leaq 0x52b2d(%rip), %r15     # 0x5a394
movl 0x40(%rbx), %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0x3fac9
testb %al, %al
jne 0x78a4
movq %r14, %rdi
movl %r12d, %esi
movq %r15, %rdx
movl $0x11, %ecx
callq 0x3fb77
testb %al, %al
jne 0x78a4
movq %r14, %rdi
movl %r12d, %esi
callq 0x4092e
testl %eax, %eax
jne 0x796a
movq %rbx, %rdi
callq 0x4230
movq %rax, %rbx
leaq 0x30(%rsp), %rax
cmpq %rax, %rbx
jne 0x7867
jmp 0x77d4
leaq 0x52c3d(%rip), %rdi     # 0x5a502
callq 0x44e0
leaq 0x5277f(%rip), %rdi     # 0x5a050
leaq 0x5277e(%rip), %rsi     # 0x5a056
leaq 0x527c7(%rip), %rcx     # 0x5a0a6
movl $0x4b, %edx
callq 0x4200
leaq 0x52c43(%rip), %rdi     # 0x5a533
callq 0x44e0
leaq 0x52754(%rip), %rdi     # 0x5a050
leaq 0x52753(%rip), %rsi     # 0x5a056
leaq 0x5279c(%rip), %rcx     # 0x5a0a6
movl $0x4c, %edx
callq 0x4200
leaq 0x52c72(%rip), %rdi     # 0x5a58d
callq 0x44e0
leaq 0x52729(%rip), %rdi     # 0x5a050
leaq 0x52728(%rip), %rsi     # 0x5a056
leaq 0x52771(%rip), %rcx     # 0x5a0a6
movl $0x6c, %edx
callq 0x4200
leaq 0x52c66(%rip), %rdi     # 0x5a5ac
callq 0x44e0
leaq 0x526fe(%rip), %rdi     # 0x5a050
leaq 0x526fd(%rip), %rsi     # 0x5a056
leaq 0x52746(%rip), %rcx     # 0x5a0a6
movl $0x6d, %edx
callq 0x4200
leaq 0x52c5a(%rip), %rdi     # 0x5a5cb
callq 0x44e0
leaq 0x526d3(%rip), %rdi     # 0x5a050
leaq 0x526d2(%rip), %rsi     # 0x5a056
leaq 0x5271b(%rip), %rcx     # 0x5a0a6
movl $0x66, %edx
callq 0x4200
leaq 0x52bc8(%rip), %rdi     # 0x5a564
callq 0x44e0
leaq 0x526a8(%rip), %rdi     # 0x5a050
leaq 0x526a7(%rip), %rsi     # 0x5a056
leaq 0x526f0(%rip), %rcx     # 0x5a0a6
movl $0x60, %edx
callq 0x4200
jmp 0x79f3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x79e4
jmp 0x79f6
jmp 0x79f3
jmp 0x79f3
jmp 0x79f3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x79f6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x79f6
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x9dbc
movq %rbx, %rdi
callq 0x45e0