// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp
// Function: hdiff_private::TDigestMatcher::search_cover(hpatch_TOutputCovers*)
void TDigestMatcher::search_cover(hpatch_TOutputCovers* out_covers){
    if (m_blocks.empty()) return;
    if (m_newData->streamSize<m_kMatchBlockSize) return;
#if (_IS_USED_MULTITHREAD)
    size_t threadNum=getSearchThreadNum();
    if (threadNum>1){
        const hpatch_StreamPos_t rollCount=m_newData->streamSize-(m_kMatchBlockSize-1);
        size_t bestStep=(kBestParallelSize/2>m_kMatchBlockSize)?kBestParallelSize:2*m_kMatchBlockSize;
        hpatch_StreamPos_t workCount=(rollCount+bestStep-1)/bestStep;
        workCount=(threadNum>workCount)?threadNum:workCount;
        mt_data_t mt_data;
        mt_data.workCount=(uint_work)workCount;
        if ((sizeof(mt_data.workCount)<sizeof(workCount))&&(mt_data.workCount!=workCount))
            throw std::runtime_error("TDigestMatcher::search_cover() multi-thread workCount error!");
        mt_data.workIndex=0;
        const size_t threadCount=threadNum-1;
        std::vector<std::thread> threads(threadCount);
        unsigned char* pmem=m_mem.data();
        for (size_t i=0;i<threadCount;i++,pmem+=(m_newCacheSize+m_oldCacheSize))
            threads[i]=std::thread(__search_cover_mt,this,out_covers,pmem,&mt_data);
        __search_cover_mt(this,out_covers,pmem,&mt_data);
        for (size_t i=0;i<threadCount;i++)
            threads[i].join();
        out_covers->collate_covers(out_covers);
    }else
#endif
    {
        _search_cover(m_newData,0,out_covers,m_mem.data());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
addq $0x10, %rdi
callq 0x424b0
testb $0x1, %al
jne 0x3ffed
jmp 0x3fff2
jmp 0x40342
movq -0xc0(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x8(%rax), %rax
cmpq 0xc8(%rcx), %rax
jae 0x4000f
jmp 0x40342
movq -0xc0(%rbp), %rdi
callq 0x3e5e0
movq %rax, -0x18(%rbp)
cmpq $0x1, -0x18(%rbp)
jbe 0x402ec
movq -0xc0(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x8(%rax), %rax
movq 0xc8(%rcx), %rdx
subq $0x1, %rdx
subq %rdx, %rax
movq %rax, -0x20(%rbp)
movl $0x400000, %eax         # imm = 0x400000
cmpq 0xc8(%rcx), %rax
jbe 0x40067
movl $0x800000, %eax         # imm = 0x800000
movq %rax, -0xc8(%rbp)
jmp 0x4007f
movq -0xc0(%rbp), %rax
movq 0xc8(%rax), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
subq $0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x28(%rbp)
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x400b9
movq -0x18(%rbp), %rax
movq %rax, -0xd0(%rbp)
jmp 0x400c4
movq -0x30(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x42880
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rax
decq %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x29f40
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x29f60
jmp 0x40127
leaq -0x71(%rbp), %rdi
callq 0x29fd0
movq -0xc0(%rbp), %rdi
addq $0x90, %rdi
callq 0x29c40
movq %rax, -0xe8(%rbp)
jmp 0x4014c
movq -0xe8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x4025c
movq -0xc0(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x1ca(%rip), %rsi       # 0x40360
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0x90(%rbp), %r8
leaq -0xb0(%rbp), %r9
callq 0x428d0
jmp 0x401bd
movq -0x98(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2a090
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2a0b0
leaq -0xa0(%rbp), %rdi
callq 0x2a0f0
movq -0xc0(%rbp), %rcx
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movq 0xa8(%rcx), %rax
addq 0xb0(%rcx), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
jmp 0x40165
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x71(%rbp), %rdi
callq 0x29fd0
jmp 0x402e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2a120
jmp 0x402e1
movq -0xc0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq 0x40360
jmp 0x40279
movq $0x0, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x402c1
movq -0xb8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2a090
movq %rax, %rdi
callq 0x4620
jmp 0x402ab
jmp 0x402ad
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x40284
movq -0x10(%rbp), %rdi
movq 0x8(%rdi), %rax
callq *%rax
jmp 0x402cd
leaq -0x70(%rbp), %rdi
callq 0x2a120
leaq -0x50(%rbp), %rdi
callq 0x429b0
jmp 0x40342
leaq -0x50(%rbp), %rdi
callq 0x429b0
jmp 0x4034b
movq -0xc0(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0xf8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
addq $0x90, %rdi
callq 0x29c40
movq -0xc0(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rcx
movq %rax, %r8
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rdx
movq $0x0, (%rsp)
callq 0x3f3c0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x4680
nopw %cs:(%rax,%rax)