// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp
// Function: hdiff_private::TFastMatchForSString::buildMatchCache(unsigned char const*, unsigned char const*, unsigned long)
void TFastMatchForSString::buildMatchCache(const TChar* src_begin,const TChar* src_end,size_t threadNum){
        #define kFMZoom 4  //ctrl memory size & match speed
        size_t srcSize=src_end-src_begin;
        if (srcSize>=kFMMinStrSize){
            const size_t rollSize=srcSize-(kFMMinStrSize-1);
            bf.init(rollSize,kFMZoom); //alloc large memory
#if (_IS_USED_MULTITHREAD)
            const size_t kInsertMinParallelSize=4096;
            if ((threadNum>1)&&(rollSize>=kInsertMinParallelSize)) {
                const size_t maxThreanNum=rollSize/(kInsertMinParallelSize/2);
                threadNum=(threadNum<=maxThreanNum)?threadNum:maxThreanNum;

                const size_t step=rollSize/threadNum;
                const size_t threadCount=threadNum-1;
                std::vector<std::thread> threads(threadCount);
                for (size_t i=0;i<threadCount;i++,src_begin+=step)
                    threads[i]=std::thread(_filter_insert<true>,&bf,src_begin,src_begin+step+(kFMMinStrSize-1));
                _filter_insert<true>(&bf,src_begin,src_end);
                for (size_t i=0;i<threadCount;i++)
                    threads[i].join();
            }else
#endif
            {
                _filter_insert<false>(&bf,src_begin,src_end);
            }
        }else if ((srcSize>0)||(src_begin!=0))
            bf.init(0,kFMZoom);
        else{
            bf.clear();
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, (%rsp)
movq %rdx, %rbx
subq %rsi, %rbx
cmpq $0x5, %rbx
jb 0x18828
movq %rcx, %r13
addq $-0x4, %rbx
pushq $0x4
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x18a9a
cmpq $0x2, %r13
setb %al
cmpq $0x1000, %rbx           # imm = 0x1000
setb %cl
orb %al, %cl
jne 0x18848
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, %rbp
shrq $0xb, %rbp
cmpq %r13, %rbp
cmovaeq %r13, %rbp
xorl %r14d, %r14d
movq %rbx, %rax
xorl %edx, %edx
divq %rbp
movq %rax, %r13
decq %rbp
leaq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rbx
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x11f04
movq %rbp, %r15
subq $0x1, %r15
jb 0x18891
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq (%r12,%r13), %rax
addq $0x4, %rax
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
leaq 0x11d(%rip), %rsi       # 0x1890a
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
leaq 0x18(%rsp), %r8
callq 0x18aba
movq 0x28(%rsp), %rdi
addq %r14, %rdi
movq %rbx, %rsi
callq 0x11f56
movq %rbx, %rdi
callq 0x11f70
movq (%rsp), %r12
addq %r13, %r12
movq %r12, (%rsp)
addq $0x8, %r14
jmp 0x187c2
orq %r15, %r12
je 0x1887b
pushq $0x4
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18a9a
movq %r12, %rdi
callq 0x18a8c
movl %eax, %ebp
addq $0x5, %r12
movq %r14, %rdi
movl %ebp, %esi
callq 0x19228
cmpq %r15, %r12
jae 0x188c8
leaq 0x1(%r12), %rbx
movl %ebp, %edi
movq %r12, %rsi
callq 0x191ba
movl %eax, %ebp
movq %rbx, %r12
jmp 0x18856
movq %r14, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18b50
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
callq 0x1890a
xorl %ebx, %ebx
subq $0x1, %rbp
jb 0x188be
movq 0x28(%rsp), %rdi
addq %rbx, %rdi
callq 0x45a0
addq $0x8, %rbx
jmp 0x188a5
leaq 0x28(%rsp), %rdi
callq 0x11f7e
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x188db
jmp 0x188db
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x11f7e
movq %rbx, %rdi
callq 0x4600