// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp
// Function: hdiff_private::TDigestMatcher::_search_cover_thread(hpatch_TOutputCovers*, unsigned char*, void*)
void TDigestMatcher::_search_cover_thread(hpatch_TOutputCovers* out_covers,
                                          unsigned char* pmem,void* mt_data){
#if (_IS_USED_MULTITHREAD)
    const size_t kPartPepeatSize=m_kMatchBlockSize-1;
    mt_data_t& mt=*(mt_data_t*)mt_data;
    const uint_work workCount=mt.workCount;
    const hpatch_StreamPos_t rollCount=m_newData->streamSize-(m_kMatchBlockSize-1);
    std::atomic<uint_work>& workIndex=*(std::atomic<uint_work>*)&mt.workIndex;
    while (true){
        uint_work curWorkIndex=workIndex++;
        if (curWorkIndex>=workCount) break;
        hpatch_StreamPos_t new_begin=rollCount*curWorkIndex/workCount;
        hpatch_StreamPos_t new_end=(curWorkIndex+1<workCount)?rollCount*(curWorkIndex+1)/workCount:rollCount;
        assert(new_end+kPartPepeatSize<=m_newData->streamSize);
        TStreamInputClip newClip;
        TStreamInputClip_init(&newClip,m_newData,new_begin,new_end+kPartPepeatSize);
        _search_cover(&newClip.base,new_begin,out_covers,pmem,
                      mt.newDataLocker.locker,mt.dataLocker.locker);
    }
#endif 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq 0xc8(%rcx), %rax
subq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rcx), %rax
movq 0x8(%rax), %rax
movq 0xc8(%rcx), %rcx
subq $0x1, %rcx
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x427c0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x38(%rbp), %rax
jb 0x3febd
jmp 0x3ffab
movq -0x40(%rbp), %rax
imulq -0x50(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x38(%rbp)
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
cmpq -0x38(%rbp), %rax
jae 0x3ff01
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x1, %rcx
imulq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x38(%rbp)
movq %rax, -0xa0(%rbp)
jmp 0x3ff0c
movq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rcx
movq -0xa0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq -0x28(%rbp), %rax
movq 0x8(%rcx), %rcx
cmpq 0x8(%rcx), %rax
ja 0x3ff32
jmp 0x3ff51
leaq 0x704cc(%rip), %rdi     # 0xb0405
leaq 0x703ee(%rip), %rsi     # 0xb032e
movl $0x2ce, %edx            # imm = 0x2CE
leaq 0x704e8(%rip), %rcx     # 0xb0434
callq 0x4270
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
addq -0x28(%rbp), %rcx
leaq -0x90(%rbp), %rdi
callq 0x86680
movq -0x98(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movq -0x30(%rbp), %rax
movq (%rax), %r9
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
callq 0x3f3c0
jmp 0x3fe9f
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)