// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: covers_read_cover
static  hpatch_BOOL _covers_read_cover(hpatch_TCovers* covers,hpatch_TCover* out_cover){
    _TCovers* self=(_TCovers*)covers;
    hpatch_StreamPos_t oldPosBack=self->oldPosBack;
    hpatch_StreamPos_t newPosBack=self->newPosBack;
    hpatch_StreamPos_t coverCount=self->coverCount;
    if (coverCount>0)
        self->coverCount=coverCount-1;
    else
        return _hpatch_FALSE;
    
    {
        hpatch_StreamPos_t copyLength,coverLength, oldPos,inc_oldPos;
        TByte inc_oldPos_sign;
        const TByte* pSign=_TStreamCacheClip_accessData(self->code_inc_oldPosClip,1);
        if (pSign)
            inc_oldPos_sign=(*pSign)>>(8-kSignTagBit);
        else
            return _hpatch_FALSE;
        _clip_unpackUIntWithTagTo(&inc_oldPos,self->code_inc_oldPosClip,kSignTagBit);
        oldPos=(inc_oldPos_sign==0)?(oldPosBack+inc_oldPos):(oldPosBack-inc_oldPos);
        _clip_unpackUIntTo(&copyLength,self->code_inc_newPosClip);
        _clip_unpackUIntTo(&coverLength,self->code_lengthsClip);
        newPosBack+=copyLength;
        oldPosBack=oldPos;
        oldPosBack+=(self->isOldPosBackNeedAddLength)?coverLength:0;
        
        out_cover->oldPos=oldPos;
        out_cover->newPos=newPosBack;
        out_cover->length=coverLength;
        newPosBack+=coverLength;
    }
    self->oldPosBack=oldPosBack;
    self->newPosBack=newPosBack;
    return hpatch_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jbe 0x8ca08
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x8ca14
movl $0x0, -0x4(%rbp)
jmp 0x8cb70
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdi
movl $0x1, %esi
callq 0x86ac0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x8ca40
movq -0x68(%rbp), %rax
movzbl (%rax), %eax
sarl $0x7, %eax
movb %al, -0x59(%rbp)
jmp 0x8ca4c
movl $0x0, -0x4(%rbp)
jmp 0x8cb70
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x58(%rbp), %rsi
movl $0x1, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8ca73
movl $0x0, -0x4(%rbp)
jmp 0x8cb70
movzbl -0x59(%rbp), %eax
cmpl $0x0, %eax
jne 0x8ca8a
movq -0x28(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x8ca96
movq -0x28(%rbp), %rax
subq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8cac2
movl $0x0, -0x4(%rbp)
jmp 0x8cb70
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rdi
leaq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x86d00
cmpl $0x0, %eax
jne 0x8cae6
movl $0x0, -0x4(%rbp)
jmp 0x8cb70
movq -0x40(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x8cb0e
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x8cb16
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x8cb16
movq -0x78(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)