// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1030, %rsp           # imm = 0x1030
movq %rdi, %rbx
movq 0x8(%rsi), %r12
movq %rsp, %rdi
movq $0x0, (%rdi)
movq %r12, 0x8(%rdi)
movq %rsi, 0x10(%rdi)
leaq 0x30(%rsp), %rax
movq %rax, 0x18(%rdi)
movl $0x1000, %eax           # imm = 0x1000
movq %rax, 0x20(%rdi)
movq %rax, 0x28(%rdi)
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %edx, %edx
callq 0x43f27
testl %eax, %eax
je 0x46f60
leaq 0x8(%rbx), %rsi
movq %rsp, %rdi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x43f27
testl %eax, %eax
je 0x46f60
leaq 0x10(%rbx), %r14
movq %rsp, %rdi
xorl %ebp, %ebp
movq %r14, %rsi
xorl %edx, %edx
callq 0x43f27
testl %eax, %eax
je 0x46f60
leaq 0x18(%rbx), %r15
movq %rsp, %rdi
xorl %ebp, %ebp
movq %r15, %rsi
xorl %edx, %edx
callq 0x43f27
testl %eax, %eax
je 0x46f60
leaq 0x20(%rbx), %rsi
movq %rsp, %rdi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x43f27
testl %eax, %eax
je 0x46f60
movq 0x20(%rsp), %rax
subq 0x28(%rsp), %rax
addq (%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x8(%rbx), %rcx
movq %r12, %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
ja 0x46f60
addq %rcx, %rax
movq (%r14), %rcx
movq %r12, %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
ja 0x46f60
addq %rax, %rcx
movq (%r15), %rax
movq %r12, %rdx
subq %rcx, %rdx
cmpq %rdx, %rax
ja 0x46f60
addq %rcx, %rax
movq %rax, 0x30(%rbx)
subq %rax, %r12
xorl %ebp, %ebp
cmpq %r12, 0x20(%rbx)
setbe %bpl
movl %ebp, %eax
addq $0x1030, %rsp           # imm = 0x1030
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq