// File: /workspace/github_cpp_makefile_star2_O3/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 0x3fb0c
leaq 0x108(%rsp), %rdi
callq 0x3fb0c
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3fb9f
testb %al, %al
je 0x7704
leaq 0x108(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3fb9f
testb %al, %al
je 0x772f
testq %rbx, %rbx
je 0x74ab
movq 0xf0(%rsp), %rax
cmpq 0xa8(%rsp), %rax
setb (%rbx)
leaq 0x58(%rsp), %rdi
callq 0x3f577
movl %eax, %ebp
leaq 0x108(%rsp), %rdi
callq 0x3f577
addl 0x4(%rsp), %eax
cmpl %eax, %ebp
jne 0x76bd
testl %ebp, %ebp
jle 0x753e
xorl %ebx, %ebx
leaq 0x18(%rsp), %r12
leaq 0x58(%rsp), %r14
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movl %ebx, %esi
callq 0x3f580
movl %eax, %r13d
movq %r14, %rdi
movl %ebx, %esi
callq 0x3f594
movslq %r13d, %rdx
addq %rax, %rdx
movq %r12, 0x8(%rsp)
movq %r15, %rdi
movq %rax, %rsi
callq 0x7208
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x9ad4
movl %ebx, (%rax)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x7538
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
incl %ebx
cmpl %ebx, %ebp
jne 0x74e5
movq 0x50(%rsp), %rax
movslq %ebp, %rcx
cmpq %rcx, %rax
jne 0x76bd
subl 0x4(%rsp), %ebp
jle 0x7635
xorl %r14d, %r14d
leaq 0x108(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movl %r14d, %esi
callq 0x3f580
movl %eax, %ebx
movq %r15, %rdi
movl %r14d, %esi
callq 0x3f594
movslq %ebx, %rdx
addq %rax, %rdx
leaq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq %r12, %rdi
movq %rax, %rsi
callq 0x7208
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0xa564
movq %rax, %r13
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x75c8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
leaq 0x30(%rsp), %rax
cmpq %rax, %r13
je 0x76bd
movl 0x40(%r13), %ebx
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0xa5aa
leaq 0x58(%rsp), %rdi
movl %ebx, %esi
callq 0x4053e
movl %eax, %r13d
movq %r15, %rdi
movl %r14d, %esi
callq 0x4053e
cmpl %eax, %r13d
jne 0x76bd
leaq 0x58(%rsp), %rdi
movl %ebx, %esi
movq %r15, %rdx
movl %r14d, %ecx
callq 0x72a0
testb %al, %al
je 0x76bd
incl %r14d
cmpl %r14d, %ebp
jne 0x7569
movq 0x50(%rsp), %rax
movl 0x4(%rsp), %edx
movslq %edx, %rcx
cmpq %rcx, %rax
jne 0x77db
testl %edx, %edx
setle %al
movq 0x40(%rsp), %r14
leaq 0x30(%rsp), %rcx
cmpq %rcx, %r14
sete %cl
orb %al, %cl
movb $0x1, %bl
jne 0x76bf
leaq 0x58(%rsp), %r15
leaq 0x52d28(%rip), %r12     # 0x5a394
movl 0x40(%r14), %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x3f661
testb %al, %al
jne 0x76a6
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
movl $0x11, %ecx
callq 0x3f732
testb %al, %al
jne 0x76a6
movq %r15, %rdi
movl %ebp, %esi
callq 0x40520
testl %eax, %eax
jne 0x77b0
movq %r14, %rdi
callq 0x4230
movq %rax, %r14
leaq 0x30(%rsp), %rax
cmpq %rax, %r14
jne 0x766c
jmp 0x76bf
xorl %ebx, %ebx
leaq 0x108(%rsp), %rdi
callq 0x3fb18
testb %al, %al
je 0x775a
leaq 0x58(%rsp), %rdi
callq 0x3fb18
testb %al, %al
je 0x7785
leaq 0x28(%rsp), %rdi
callq 0x9b88
movl %ebx, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52df7(%rip), %rdi     # 0x5a502
callq 0x44e0
leaq 0x52939(%rip), %rdi     # 0x5a050
leaq 0x52938(%rip), %rsi     # 0x5a056
leaq 0x52981(%rip), %rcx     # 0x5a0a6
movl $0x4b, %edx
callq 0x4200
leaq 0x52dfd(%rip), %rdi     # 0x5a533
callq 0x44e0
leaq 0x5290e(%rip), %rdi     # 0x5a050
leaq 0x5290d(%rip), %rsi     # 0x5a056
leaq 0x52956(%rip), %rcx     # 0x5a0a6
movl $0x4c, %edx
callq 0x4200
leaq 0x52e2c(%rip), %rdi     # 0x5a58d
callq 0x44e0
leaq 0x528e3(%rip), %rdi     # 0x5a050
leaq 0x528e2(%rip), %rsi     # 0x5a056
leaq 0x5292b(%rip), %rcx     # 0x5a0a6
movl $0x6c, %edx
callq 0x4200
leaq 0x52e20(%rip), %rdi     # 0x5a5ac
callq 0x44e0
leaq 0x528b8(%rip), %rdi     # 0x5a050
leaq 0x528b7(%rip), %rsi     # 0x5a056
leaq 0x52900(%rip), %rcx     # 0x5a0a6
movl $0x6d, %edx
callq 0x4200
leaq 0x52e14(%rip), %rdi     # 0x5a5cb
callq 0x44e0
leaq 0x5288d(%rip), %rdi     # 0x5a050
leaq 0x5288c(%rip), %rsi     # 0x5a056
leaq 0x528d5(%rip), %rcx     # 0x5a0a6
movl $0x66, %edx
callq 0x4200
leaq 0x52d82(%rip), %rdi     # 0x5a564
callq 0x44e0
leaq 0x52862(%rip), %rdi     # 0x5a050
leaq 0x52861(%rip), %rsi     # 0x5a056
leaq 0x528aa(%rip), %rcx     # 0x5a0a6
movl $0x60, %edx
callq 0x4200
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
jne 0x782f
jmp 0x7841
jmp 0x783e
jmp 0x783e
jmp 0x783e
jmp 0x783e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x7841
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x7841
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x9b88
movq %rbx, %rdi
callq 0x45e0