// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, %r14
movq %rsi, 0x8(%rsp)
movq %rdx, %r13
subq %rsi, %r13
cmpq $0x5, %r13
jb 0x1cc07
movq %rcx, %r15
addq $-0x4, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x1d3a8
movq %rax, 0x10(%r14)
leaq 0x1(%rax), %rsi
movq %r14, %rdi
callq 0x1d006
cmpq $0x2, %r15
setb %al
cmpq $0x1000, %r13           # imm = 0x1000
setb %cl
orb %al, %cl
jne 0x1cc33
movq %r12, 0x18(%rsp)
movq %r13, %r12
shrq $0xb, %r12
cmpq %r15, %r12
cmovaeq %r15, %r12
movq %r13, %rax
xorl %edx, %edx
divq %r12
movq %rax, %r15
leaq -0x1(%r12), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1585c
decq %r12
je 0x1cbc9
xorl %ebp, %ebp
leaq 0x8(%rsp), %rbx
leaq 0x20(%rsp), %r13
movq %r14, 0x28(%rsp)
movq 0x8(%rsp), %rax
addq %r15, %rax
addq $0x4, %rax
movq %rax, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x2bd(%rip), %rsi       # 0x1ce50
leaq 0x28(%rsp), %rdx
movq %rbx, %rcx
movq %r13, %r8
callq 0x1cf58
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax,%rbp,8)
jne 0x1cd4b
movq 0x10(%rsp), %rcx
movq %rcx, (%rax,%rbp,8)
incq %rbp
addq %r15, 0x8(%rsp)
cmpq %rbp, %r12
jne 0x1cb71
movq 0x8(%rsp), %rsi
movq %r14, %rdi
movq 0x18(%rsp), %rdx
callq 0x1ce50
testq %r12, %r12
je 0x1cbf8
xorl %ebx, %ebx
movq 0x30(%rsp), %rdi
addq %rbx, %rdi
callq 0x4580
addq $0x8, %rbx
decq %r12
jne 0x1cbe2
leaq 0x30(%rsp), %rdi
callq 0x158d4
jmp 0x1cd3c
orq %r12, %rsi
je 0x1cd19
movq $0x3ff, 0x10(%r14)      # imm = 0x3FF
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d006
movq 0x8(%rsp), %r15
movl $0x5, %edx
movl $0x1, %edi
movq %r15, %rsi
callq 0x2678f
movl %eax, %esi
addq $0x5, %r15
movq (%r14), %rdi
movq 0x10(%r14), %r8
leaq -0x1(%r8), %r9
leaq 0x5f886(%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, %r15
jae 0x1cd3c
movzbl -0x5(%r15), %eax
movzbl (%r15), %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 %r15
jmp 0x1cc65
cmpq $0x0, 0x8(%r14)
je 0x1cd3c
movq $0x0, 0x8(%r14)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1cd3c
callq 0x43e0
movq $0x0, (%r14)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x40b0
jmp 0x1cd54
jmp 0x1cd54
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x158d4
movq %rbx, %rdi
callq 0x45e0