// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: read_diff_head
static hpatch_BOOL read_diff_head(_THDiffHead* out_diffHead,
                                  const hpatch_TStreamInput* serializedDiff){
    hpatch_StreamPos_t       diffPos0;
    const hpatch_StreamPos_t diffPos_end=serializedDiff->streamSize;
    TByte       temp_cache[hpatch_kStreamCacheSize];
    TStreamCacheClip  diffHeadClip;
    _TStreamCacheClip_init(&diffHeadClip,serializedDiff,0,diffPos_end,temp_cache,hpatch_kStreamCacheSize);
    _clip_unpackUIntTo(&out_diffHead->coverCount,&diffHeadClip);
    _clip_unpackUIntTo(&out_diffHead->lengthSize,&diffHeadClip);
    _clip_unpackUIntTo(&out_diffHead->inc_newPosSize,&diffHeadClip);
    _clip_unpackUIntTo(&out_diffHead->inc_oldPosSize,&diffHeadClip);
    _clip_unpackUIntTo(&out_diffHead->newDataDiffSize,&diffHeadClip);
    diffPos0=(hpatch_StreamPos_t)(_TStreamCacheClip_readPosOfSrcStream(&diffHeadClip));
    out_diffHead->headEndPos=diffPos0;
#ifdef __RUN_MEM_SAFE_CHECK
    if (out_diffHead->lengthSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
#endif
    diffPos0+=out_diffHead->lengthSize;
#ifdef __RUN_MEM_SAFE_CHECK
    if (out_diffHead->inc_newPosSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
#endif
    diffPos0+=out_diffHead->inc_newPosSize;
#ifdef __RUN_MEM_SAFE_CHECK
    if (out_diffHead->inc_oldPosSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
#endif
    diffPos0+=out_diffHead->inc_oldPosSize;
    out_diffHead->coverEndPos=diffPos0;
#ifdef __RUN_MEM_SAFE_CHECK
    if (out_diffHead->newDataDiffSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
#endif
    return hpatch_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1060, %rsp           # imm = 0x1060
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rcx
leaq -0x1030(%rbp), %r8
leaq -0x1060(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x1000, %r9d           # imm = 0x1000
callq 0x871e0
movq -0x10(%rbp), %rsi
leaq -0x1060(%rbp), %rdi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8be17
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
leaq -0x1060(%rbp), %rdi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8be3e
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
leaq -0x1060(%rbp), %rdi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8be65
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
leaq -0x1060(%rbp), %rdi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8be8c
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
leaq -0x1060(%rbp), %rdi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8beb3
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x1060(%rbp), %rax
movq -0x1038(%rbp), %rcx
subq -0x1040(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
subq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x8befc
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
subq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x8bf2a
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x28(%rbp), %rcx
subq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x8bf58
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
subq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x8bf92
movl $0x0, -0x4(%rbp)
jmp 0x8bf99
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1060, %rsp           # imm = 0x1060
popq %rbp
retq
nopw %cs:(%rax,%rax)