// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, 0x8(%rsp)
movq %rdx, %r13
subq %rsi, %r13
cmpq $0x5, %r13
jb 0x1c80e
movq %rcx, %rbx
addq $-0x4, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x1cf74
movq %rax, 0x10(%r15)
leaq 0x1(%rax), %rsi
movq %r15, %rdi
callq 0x1cbc6
cmpq $0x2, %rbx
setb %al
cmpq $0x1000, %r13           # imm = 0x1000
setb %cl
orb %al, %cl
jne 0x1c83a
movq %r12, 0x18(%rsp)
movq %r13, %r12
shrq $0xb, %r12
cmpq %rbx, %r12
cmovaeq %rbx, %r12
xorl %ebx, %ebx
movq %r13, %rax
xorl %edx, %edx
divq %r12
movq %rax, %r13
decq %r12
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %r12, %rsi
callq 0x15522
leaq 0x20(%rsp), %rbp
movq %r15, 0x28(%rsp)
leaq (%r14,%r13), %rax
addq $0x4, %rax
movq %rax, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x28a(%rip), %rsi       # 0x1ca21
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbp, %r8
callq 0x1cb2a
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax,%rbx,8)
jne 0x1c94d
movq 0x10(%rsp), %rcx
movq %rcx, (%rax,%rbx,8)
incq %rbx
movq 0x8(%rsp), %r14
addq %r13, %r14
movq %r14, 0x8(%rsp)
cmpq %rbx, %r12
jne 0x1c779
movq %r15, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
callq 0x1ca21
xorl %ebx, %ebx
movq 0x30(%rsp), %rdi
addq %rbx, %rdi
callq 0x4580
addq $0x8, %rbx
decq %r12
jne 0x1c7e9
leaq 0x30(%rsp), %rdi
callq 0x15590
jmp 0x1c93e
orq %r12, %r14
je 0x1c91b
movq $0x3ff, 0x10(%r15)      # imm = 0x3FF
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cbc6
movl $0x5, %edx
movl $0x1, %edi
movq %r14, %rsi
callq 0x264cf
movl %eax, %esi
addq $0x5, %r14
movq (%r15), %rdi
movq 0x10(%r15), %r8
leaq -0x1(%r8), %r9
leaq 0x5fc84(%rip), %rax     # 0x7c4e8
movq (%rax), %r10
movl %esi, %r11d
shrl $0x10, %r11d
movl %r11d, %ebx
xorl %esi, %ebx
movl %ebx, %ecx
andl %r8d, %ecx
movl $0x1, %eax
shll %cl, %eax
shrl $0x5, %ecx
orl %eax, (%rdi,%rcx,4)
movl %esi, %eax
shll $0x9, %eax
subl %esi, %eax
xorl %edx, %edx
divq %r8
movq %rdx, %rcx
movl $0x1, %eax
shll %cl, %eax
shrl $0x5, %ecx
orl %eax, (%rdi,%rcx,4)
xorq $0x3d, %rbx
leaq (%rbx,%rbx,8), %rax
movq %rax, %rcx
shrq $0x4, %rcx
xorq %rax, %rcx
imulq $0x27d4eb2d, %rcx, %rcx # imm = 0x27D4EB2D
movq %rcx, %rax
shrq $0xf, %rax
xorq %rcx, %rax
xorl %edx, %edx
divq %r9
movq %rdx, %rcx
movl $0x1, %eax
shll %cl, %eax
shrq $0x5, %rcx
orl %eax, (%rdi,%rcx,4)
cmpq %r12, %r14
jae 0x1c93e
movzbl -0x5(%r14), %eax
movzbl (%r14), %ecx
movzwl (%r10,%rax,2), %eax
movzwl (%r10,%rcx,2), %ecx
subl %eax, %esi
addl %ecx, %esi
imull $0xfffb, %eax, %eax     # imm = 0xFFFB
addl %esi, %r11d
addl %eax, %r11d
shll $0x10, %r11d
movzwl %si, %eax
leal (%r11,%rax), %esi
addl $0xffff0000, %esi       # imm = 0xFFFF0000
incq %r14
jmp 0x1c867
cmpq $0x0, 0x8(%r15)
je 0x1c93e
movq $0x0, 0x8(%r15)
movq (%r15), %rdi
testq %rdi, %rdi
je 0x1c93e
callq 0x43e0
movq $0x0, (%r15)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x40b0
jmp 0x1c956
jmp 0x1c956
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x15590
movq %rbx, %rdi
callq 0x45e0