// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/patch/ZipDiffData.cpp
// Function: openZipDiffData(hpatch_TStreamInput const*, hpatch_TDecompress*, unsigned long*)
static bool _openZipDiffData(const hpatch_TStreamInput* diffData,hpatch_TDecompress* decompressPlugin,
                  size_t* out_headInfoPos=0){
    const char* kVersionType="ZiPat1&";
    const size_t kVersionTypeLen=7;
    assert(kVersionTypeLen==strlen(kVersionType));
    
    TByte buf[kVersionTypeLen + hpatch_kMaxPluginTypeLength+1+1];
    int readLen=sizeof(buf)-1;
    buf[readLen]='\0';
    if ((size_t)readLen>diffData->streamSize)
        readLen=(int)diffData->streamSize;
    check(diffData->read(diffData,0,buf,buf+readLen));
    //check type+version
    check(0==strncmp((const char*)buf,kVersionType,kVersionTypeLen));
    {//read compressType
        check(decompressPlugin!=0);
        const char* compressType=(const char*)buf+kVersionTypeLen;
        size_t compressTypeLen=strlen(compressType);//safe
        check(compressTypeLen<=hpatch_kMaxPluginTypeLength);
        if (out_headInfoPos)
            *out_headInfoPos=kVersionTypeLen+compressTypeLen+1;
        hpatch_compressedDiffInfo compressedInfo={0,0,1};
        memcpy(compressedInfo.compressType,compressType,compressTypeLen+1); //'\0'
        return 0!=decompressPlugin->is_can_open(compressedInfo.compressType);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, %r14
movq %rsi, %rbx
movq %rsp, %rdx
movb $0x0, 0x10b(%rdx)
movq 0x8(%rdi), %rax
movl $0x10b, %ecx            # imm = 0x10B
cmpq %rcx, %rax
cmovbq %rax, %rcx
addq %rsp, %rcx
xorl %esi, %esi
callq *0x10(%rdi)
testl %eax, %eax
je 0x3e280
movl $0x6150695a, %eax       # imm = 0x6150695A
xorl (%rsp), %eax
movl $0x26317461, %ecx       # imm = 0x26317461
xorl 0x3(%rsp), %ecx
orl %eax, %ecx
jne 0x3e2ab
testq %rbx, %rbx
je 0x3e2d6
leaq 0x7(%rsp), %r15
movq %r15, %rdi
callq 0x4140
cmpq $0x104, %rax            # imm = 0x104
jae 0x3e301
movq %rax, %r12
testq %r14, %r14
je 0x3e22f
leaq 0x8(%r12), %rax
movq %rax, (%r14)
leaq 0x110(%rsp), %r14
movl $0x118, %edx            # imm = 0x118
movq %r14, %rdi
xorl %esi, %esi
callq 0x41c0
movl $0x1, 0x10(%r14)
leaq 0x124(%rsp), %r14
incq %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4290
movq %r14, %rdi
callq *(%rbx)
testl %eax, %eax
setne %al
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x21b55(%rip), %rdi     # 0x5fddc
callq 0x44e0
leaq 0x1bdbd(%rip), %rdi     # 0x5a050
leaq 0x21a79(%rip), %rsi     # 0x5fd13
leaq 0x21ae8(%rip), %rcx     # 0x5fd89
movl $0x40, %edx
callq 0x4200
leaq 0x21b5c(%rip), %rdi     # 0x5fe0e
callq 0x44e0
leaq 0x1bd92(%rip), %rdi     # 0x5a050
leaq 0x21a4e(%rip), %rsi     # 0x5fd13
leaq 0x21abd(%rip), %rcx     # 0x5fd89
movl $0x42, %edx
callq 0x4200
leaq 0x1caa4(%rip), %rdi     # 0x5ad81
callq 0x44e0
leaq 0x1bd67(%rip), %rdi     # 0x5a050
leaq 0x21a23(%rip), %rsi     # 0x5fd13
leaq 0x21a92(%rip), %rcx     # 0x5fd89
movl $0x44, %edx
callq 0x4200
leaq 0x21b47(%rip), %rdi     # 0x5fe4f
callq 0x44e0
leaq 0x1bd3c(%rip), %rdi     # 0x5a050
leaq 0x219f8(%rip), %rsi     # 0x5fd13
leaq 0x21a67(%rip), %rcx     # 0x5fd89
movl $0x47, %edx
callq 0x4200