// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: read_diffz_head
hpatch_BOOL read_diffz_head(hpatch_compressedDiffInfo* out_diffInfo,_THDiffzHead* out_head,
                            const hpatch_TStreamInput* compressedDiff){
    TStreamCacheClip  _diffHeadClip;
    TStreamCacheClip* diffHeadClip=&_diffHeadClip;
    TByte             temp_cache[hpatch_kStreamCacheSize];
    _TStreamCacheClip_init(&_diffHeadClip,compressedDiff,0,compressedDiff->streamSize,
                           temp_cache,hpatch_kStreamCacheSize);
    {//type
        const char* kVersionType="HDIFF13";
        char* tempType=out_diffInfo->compressType;
        if (!_TStreamCacheClip_readType_end(diffHeadClip,'&',tempType)) return _hpatch_FALSE;
        if (0!=strcmp(tempType,kVersionType)) return _hpatch_FALSE;
    }
    {//read compressType
        if (!_TStreamCacheClip_readType_end(diffHeadClip,'\0',
                                            out_diffInfo->compressType)) return _hpatch_FALSE;
        out_head->typesEndPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
    }
    _clip_unpackUIntTo(&out_diffInfo->newDataSize,diffHeadClip);
    _clip_unpackUIntTo(&out_diffInfo->oldDataSize,diffHeadClip);
    _clip_unpackUIntTo(&out_head->coverCount,diffHeadClip);
    out_head->compressSizeBeginPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
    _clip_unpackUIntTo(&out_head->cover_buf_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->compress_cover_buf_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->rle_ctrlBuf_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->compress_rle_ctrlBuf_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->rle_codeBuf_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->compress_rle_codeBuf_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->newDataDiff_size,diffHeadClip);
    _clip_unpackUIntTo(&out_head->compress_newDataDiff_size,diffHeadClip);
    out_head->headEndPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
    
    out_diffInfo->compressedCount=((out_head->compress_cover_buf_size)?1:0)
                                 +((out_head->compress_rle_ctrlBuf_size)?1:0)
                                 +((out_head->compress_rle_codeBuf_size)?1:0)
                                 +((out_head->compress_newDataDiff_size)?1:0);
    if (out_head->compress_cover_buf_size>0)
        out_head->coverEndPos=out_head->headEndPos+out_head->compress_cover_buf_size;
    else
        out_head->coverEndPos=out_head->headEndPos+out_head->cover_buf_size;
    return hpatch_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1070, %rsp           # imm = 0x1070
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
leaq -0x1060(%rbp), %r8
leaq -0x50(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x1000, %r9d           # imm = 0x1000
callq 0x871e0
leaq 0x27d25(%rip), %rax     # 0xaf8c1
movq %rax, -0x1068(%rbp)
movq -0x10(%rbp), %rax
addq $0x14, %rax
movq %rax, -0x1070(%rbp)
movq -0x58(%rbp), %rdi
movq -0x1070(%rbp), %rdx
movl $0x26, %esi
callq 0x869b0
cmpl $0x0, %eax
jne 0x87bd8
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x1070(%rbp), %rdi
movq -0x1068(%rbp), %rsi
callq 0x44f0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x87bff
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x14, %rdx
xorl %esi, %esi
callq 0x869b0
cmpl $0x0, %eax
jne 0x87c23
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rax
movq (%rax), %rcx
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x58(%rbp), %rdx
subq 0x20(%rdx), %rax
subq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87c65
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87c89
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87ca9
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rax
movq (%rax), %rcx
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x58(%rbp), %rdx
subq 0x20(%rdx), %rax
subq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87cef
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87d13
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x18, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87d37
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x20, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87d5b
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x28, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87d7f
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x30, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87da3
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x38, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87dc7
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x40, %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x87deb
movl $0x0, -0x4(%rbp)
jmp 0x87eb6
movq -0x58(%rbp), %rax
movq (%rax), %rcx
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x58(%rbp), %rdx
subq 0x20(%rdx), %rax
subq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
xorl %ecx, %ecx
movl $0x1, %eax
cmpq $0x0, %rdx
cmovnel %eax, %ecx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
xorl %eax, %eax
movl $0x1, %edx
cmpq $0x0, %rsi
cmovnel %edx, %eax
addl %eax, %ecx
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
xorl %eax, %eax
movl $0x1, %edx
cmpq $0x0, %rsi
cmovnel %edx, %eax
addl %eax, %ecx
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
xorl %eax, %eax
movl $0x1, %edx
cmpq $0x0, %rsi
cmovnel %edx, %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jbe 0x87e97
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
jmp 0x87eaf
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1070, %rsp           # imm = 0x1070
popq %rbp
retq
nopw %cs:(%rax,%rax)