// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: arrayCovers_load
static hpatch_BOOL _arrayCovers_load(_TArrayCovers** out_self,hpatch_TCovers* src_covers,
                                     hpatch_BOOL isUsedCover32,hpatch_BOOL* out_isReadError,
                                     TByte** ptemp_cache,TByte* temp_cache_end){
    TByte* temp_cache=*ptemp_cache;
    hpatch_StreamPos_t _coverCount=src_covers->leave_cover_count(src_covers);
    hpatch_StreamPos_t memSize=arrayCovers_memSize(_coverCount,isUsedCover32);
    hpatch_size_t i;
    void*  pCovers;
    _TArrayCovers* self=0;
    hpatch_size_t coverCount=(hpatch_size_t)_coverCount;
    
    *out_isReadError=hpatch_FALSE;
    if (coverCount!=_coverCount) return hpatch_FALSE;
    
    _cache_alloc(self,_TArrayCovers,sizeof(_TArrayCovers),temp_cache,temp_cache_end);
    _cache_alloc(pCovers,void,memSize,temp_cache,temp_cache_end);
    if (isUsedCover32){
        hpatch_TCCover32* pdst=(hpatch_TCCover32*)pCovers;
        for (i=0;i<coverCount;++i,++pdst) {
            hpatch_TCover cover;
            if (!src_covers->read_cover(src_covers,&cover))
                { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
            pdst->oldPos=(hpatch_uint32_t)cover.oldPos;
            pdst->newPos=(hpatch_uint32_t)cover.newPos;
            pdst->length=(hpatch_uint32_t)cover.length;
        }
    }else{
        hpatch_TCCover64* pdst=(hpatch_TCCover64*)pCovers;
        for (i=0;i<coverCount;++i,++pdst) {
            if (!src_covers->read_cover(src_covers,(hpatch_TCover*)pdst))
                { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
        }
    }
    if (!src_covers->is_finish(src_covers))
        { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }

    self->pCCovers=pCovers;
    self->is32=isUsedCover32;
    self->coverCount=coverCount;
    self->cur_index=0;
    self->ICovers.close=_covers_close_nil;
    self->ICovers.is_finish=_arrayCovers_is_finish;
    self->ICovers.leave_cover_count=_arrayCovers_leaveCoverCount;
    self->ICovers.read_cover=_arrayCovers_read_cover;
    *out_self=self;
    *ptemp_cache=temp_cache;
    return hpatch_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x8aec0
movq %rax, -0x50(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x70(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x8aa4e
movl $0x0, -0x4(%rbp)
jmp 0x8ac83
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
cmpq $0x48, %rax
jae 0x8aa6b
movl $0x0, -0x4(%rbp)
jmp 0x8ac83
movq -0x40(%rbp), %rax
addq $0x7, %rax
andq $-0x8, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movq -0x50(%rbp), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
jae 0x8aaab
movl $0x0, -0x4(%rbp)
jmp 0x8ac83
movq -0x40(%rbp), %rax
addq $0x7, %rax
andq $-0x8, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x8ab63
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x8ab61
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq *%rax
cmpl $0x0, %eax
jne 0x8ab1b
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8ac83
movq -0x90(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, (%rax)
movq -0x88(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x78(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x78(%rbp)
jmp 0x8aae1
jmp 0x8abd4
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x8abd2
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq *%rax
cmpl $0x0, %eax
jne 0x8abb0
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8ac83
jmp 0x8abb2
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x98(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x98(%rbp)
jmp 0x8ab76
jmp 0x8abd4
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
jne 0x8abfd
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8ac83
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x1c(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x68(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x68(%rbp), %rax
leaq 0x2ba(%rip), %rcx       # 0x8aef0
movq %rcx, 0x18(%rax)
movq -0x68(%rbp), %rax
leaq 0x2bb(%rip), %rcx       # 0x8af00
movq %rcx, 0x10(%rax)
movq -0x68(%rbp), %rax
leaq 0x2dc(%rip), %rcx       # 0x8af30
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
leaq 0x2fe(%rip), %rcx       # 0x8af60
movq %rcx, 0x8(%rax)
movq -0x68(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nop