// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp
// Function: hdiff_private::filter_insert_parallel(hdiff_private::TBloomFilter<unsigned long>&, unsigned long const*, unsigned long const*, unsigned long)
static void filter_insert_parallel(TBloomFilter<adler_hash_t>& filter,const adler_uint_t* begin,
                                   const adler_uint_t* end,size_t threadNum){
#if (_IS_USED_MULTITHREAD)
    const size_t kInsertMinParallelSize=4096;
    const size_t size=end-begin;
    if ((threadNum>1)&&(size>=kInsertMinParallelSize)) {
        const size_t maxThreanNum=size/(kInsertMinParallelSize/2);
        threadNum=(threadNum<=maxThreanNum)?threadNum:maxThreanNum;

        const size_t step=size/threadNum;
        const size_t threadCount=threadNum-1;
        std::vector<std::thread> threads(threadCount);
        for (size_t i=0;i<threadCount;i++,begin+=step)
            threads[i]=std::thread(_filter_insert<true>,&filter,begin,begin+step);
        _filter_insert<true>(&filter,begin,end);
        for (size_t i=0;i<threadCount;i++)
            threads[i].join();
    }else
#endif
    {
        _filter_insert<false>(&filter,begin,end);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x1000, -0x28(%rbp)    # imm = 0x1000
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movq %rax, -0x30(%rbp)
cmpq $0x1, -0x20(%rbp)
jbe 0x3f16f
cmpq $0x1000, -0x30(%rbp)    # imm = 0x1000
jb 0x3f16f
movq -0x30(%rbp), %rax
shrq $0xb, %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
ja 0x3efc2
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
jmp 0x3efcd
movq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
decq %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x29f40
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x29f60
jmp 0x3f028
leaq -0x61(%rbp), %rdi
callq 0x29fd0
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x3f109
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
leaq 0x13f4(%rip), %rsi      # 0x40460
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0x98(%rbp), %r8
callq 0x43240
jmp 0x3f08c
movq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x2a090
movq %rax, %rdi
leaq -0x88(%rbp), %rsi
callq 0x2a0b0
leaq -0x88(%rbp), %rdi
callq 0x2a0f0
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x3f039
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x29fd0
jmp 0x3f189
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2a120
jmp 0x3f189
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x40460
jmp 0x3f11c
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x3f164
movq -0xa0(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x2a090
movq %rax, %rdi
callq 0x4620
jmp 0x3f14e
jmp 0x3f150
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x3f127
leaq -0x60(%rbp), %rdi
callq 0x2a120
jmp 0x3f180
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x404b0
addq $0xc0, %rsp
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x4680
nopw %cs:(%rax,%rax)