// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/src/diff/Differ.cpp
// Function: checkZipDiffWithStream(hpatch_TStreamInput const*, hpatch_TStreamInput const*, hpatch_TStreamInput const*, int)
TCheckZipDiffResult checkZipDiffWithStream(const hpatch_TStreamInput* oldZipStream,
                                           const hpatch_TStreamInput* newZipStream,
                                           const hpatch_TStreamInput* diffStream,int threadNum){
    assert((size_t)newZipStream->streamSize==newZipStream->streamSize);
    std::vector<TByte>      temp_newZip;
    TVectorStreamOutput     temp_outNewZipStream(temp_newZip);
    if (PATCH_SUCCESS!=ZipPatchWithStream(oldZipStream,diffStream,&temp_outNewZipStream,0,0,threadNum))
        return CHECK_ZIPPATCH_ERROR;
    //else
        
    
    hpatch_TStreamInput     temp_inNewZipStream;
    mem_as_hStreamInput(&temp_inNewZipStream,temp_newZip.data(),temp_newZip.data()+temp_newZip.size());
    bool isByteByByteEqual=getIsEqual(newZipStream,&temp_inNewZipStream);
    if (isByteByByteEqual)
        return CHECK_BYTE_BY_BYTE_EQUAL_TRUE;
    
    bool isOldHaveApkV2Sign=false;
    bool isSame=getZipIsSameWithStream(newZipStream,&temp_inNewZipStream,0,&isOldHaveApkV2Sign);
    if (!isSame)
        return CHECK_SAME_LIKE_ERROR;
    if (isOldHaveApkV2Sign)
        return CHECK_SAME_LIKE_TRUE__BYTE_BY_BYTE_EQUAL_ERROR;
    else
        return CHECK_SAME_LIKE_TRUE__BYTE_BY_BYTE_EQUAL_FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %ecx, %r9d
leaq 0x20(%rsp), %rcx
andq $0x0, 0x10(%rcx)
movq %rsi, %rbx
leaq 0x60(%rsp), %rax
movq %rcx, 0x20(%rax)
movq %rax, (%rax)
orq $-0x1, 0x8(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
leaq 0x289(%rip), %rcx       # 0xa82a
movq %rcx, 0x18(%rax)
movq %rdx, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x49824
testl %eax, %eax
je 0xa5c1
pushq $0x4
popq %rbx
jmp 0xa687
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x40(%rsp), %rdi
callq 0x3a60a
movq 0x8(%rbx), %r14
testq %r14, %r14
js 0xa6a5
cmpq 0x48(%rsp), %r14
jne 0xa661
testq %r14, %r14
je 0xa655
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq (%r14,%r14), %r13
movq %r13, %rsi
callq 0x843c
movq (%rsp), %r15
leaq (%r15,%r14), %r12
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
callq *0x10(%rbx)
testl %eax, %eax
je 0xa659
addq %r15, %r13
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
callq *0x10(%rdi)
testl %eax, %eax
je 0xa659
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x4350
movl %eax, %ebp
movq %rsp, %rdi
callq 0x8b88
testl %ebp, %ebp
jne 0xa661
xorl %ebx, %ebx
jmp 0xa687
movq %rsp, %rdi
callq 0x8b88
movq %rsp, %rcx
movb $0x0, (%rcx)
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x6a02
movzbl (%rsp), %ecx
andl $0x1, %ecx
incl %ecx
testb %al, %al
pushq $0x3
popq %rbx
cmovnel %ecx, %ebx
leaq 0x20(%rsp), %rdi
callq 0x8b88
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x45618(%rip), %rdi     # 0x4fcc4
leaq 0x454ae(%rip), %rsi     # 0x4fb61
leaq 0x455c0(%rip), %rcx     # 0x4fc7a
movl $0x143, %edx            # imm = 0x143
callq 0x4230
jmp 0xa6c6
movq %rax, %rbx
movq %rsp, %rdi
callq 0x8b88
jmp 0xa6da
jmp 0xa6d7
jmp 0xa6d7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8b88
movq %rbx, %rdi
callq 0x4600