// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp
// Function: hdiff_private::TSuffixString::build_cache(unsigned long)
void TSuffixString::build_cache(size_t threadNum){
    clear_cache();
#if (_SSTRING_FAST_MATCH>0)
    if (m_isUsedFastMatch) m_fastMatch.buildMatchCache(m_src_begin,m_src_end,threadNum);
#endif
    const size_t kUsedCacheMinSASize =2*(1<<20); //当字符串较大时再启用大缓存表.
    if (SASize()>kUsedCacheMinSASize){
        m_cached2char_range=new TChar[(256*256+1)*(isUseLargeSA()?sizeof(size_t):sizeof(TInt32))];
    }
    
    if (isUseLargeSA()){
        m_lower_bound=(t_lower_bound_func)_lower_bound_TInt;
        if (m_SA_large.empty()) return;
        m_cached_SA_begin=&m_SA_large[0];
        m_cached_SA_end=&m_SA_large[0]+m_SA_large.size();
        _build_range256((TInt*)m_cached_SA_begin,(TInt*)m_cached_SA_end,
                        m_src_begin,m_src_end,(const TInt**)&m_cached1char_range[0]);
        if (m_cached2char_range){
            _build_range((TInt*)m_cached_SA_begin,(TInt*)m_cached_SA_end,
                         m_src_begin,m_src_end,(TInt*)m_cached2char_range);
        }
    }else{
        m_lower_bound=(t_lower_bound_func)_lower_bound_TInt32;
        if (m_SA_limit.empty()) return;
        m_cached_SA_begin=&m_SA_limit[0];
        m_cached_SA_end=&m_SA_limit[0]+m_SA_limit.size();
        _build_range256((TInt32*)m_cached_SA_begin,(TInt32*)m_cached_SA_end,
                        m_src_begin,m_src_end,(const TInt32**)&m_cached1char_range[0]);
        if (m_cached2char_range){
            _build_range((TInt32*)m_cached_SA_begin,(TInt32*)m_cached_SA_end,
                         m_src_begin,m_src_end,(TInt32*)m_cached2char_range);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1bd7c
cmpb $0x1, 0x40(%rbx)
jne 0x1c116
leaq 0x48(%rbx), %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rcx
callq 0x1c6d6
movq (%rbx), %r14
movq 0x8(%rbx), %r15
movq %r15, %r12
subq %r14, %r12
cmpq $0x200001, %r12         # imm = 0x200001
jb 0x1c319
cmpq $0x7fffffff, %r12       # imm = 0x7FFFFFFF
movl $0x80008, %eax          # imm = 0x80008
movl $0x40004, %edi          # imm = 0x40004
cmovaq %rax, %rdi
callq 0x4030
movq %rax, 0x878(%rbx)
testq $-0x80000000, %r12      # imm = 0x80000000
je 0x1c319
leaq 0x806(%rip), %rax       # 0x1c96b
movq %rax, 0x880(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
cmpq %rcx, %rax
je 0x1c4cd
movq %rax, 0x60(%rbx)
movq %rcx, %rdx
subq %rax, %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, 0x68(%rbx)
xorl %esi, %esi
movq %rax, %rdi
cmpq %rcx, %rdi
je 0x1c218
movq %rcx, %r9
xorl %r10d, %r10d
xorl %r8d, %r8d
movq %r9, %rdx
subq %rdi, %rdx
sarq %rdx
andq $-0x8, %rdx
leaq (%rdi,%rdx), %r11
cmpq %r8, %r10
movq %r8, %r12
cmovbq %r10, %r12
movq (%rdi,%rdx), %r13
addq %r14, %r13
movq %r15, %rbp
subq %r13, %rbp
cmpq $0x1, %r12
je 0x1c1ed
leaq (%r12,%r13), %rdx
cmpq %r15, %rdx
je 0x1c1f5
cmpb %sil, (%rdx)
jne 0x1c1fa
incq %r12
cmpq $0x2000, %r12           # imm = 0x2000
jb 0x1c1cb
jmp 0x1c215
movl $0x1, %r8d
jmp 0x1c20b
movq %rbp, %r12
jmp 0x1c1fc
jae 0x1c208
addq $0x8, %r11
movq %r11, %rdi
movq %r12, %r10
jmp 0x1c20e
movq %r12, %r8
movq %r11, %r9
cmpq %rdi, %r9
jne 0x1c1a3
jmp 0x1c218
movq %r11, %rdi
movq %rdi, 0x70(%rbx,%rsi,8)
incq %rsi
cmpq $0x100, %rsi            # imm = 0x100
jne 0x1c195
movq %rcx, 0x870(%rbx)
movq 0x878(%rbx), %rsi
testq %rsi, %rsi
je 0x1c4cd
xorl %edi, %edi
movq %rax, 0x10(%rsp)
movq %rax, %r8
movl %edi, %edx
rolw $0x8, %dx
movw %dx, 0x4(%rsp)
cmpq %rcx, %r8
je 0x1c2e4
movq %rcx, %r10
xorl %r11d, %r11d
xorl %r9d, %r9d
movq %r10, %rdx
subq %r8, %rdx
sarq %rdx
andq $-0x8, %rdx
leaq (%r8,%rdx), %rbx
cmpq %r9, %r11
movq %r9, %r12
cmovbq %r11, %r12
movq (%r8,%rdx), %r13
addq %r14, %r13
movq %r15, %rbp
subq %r13, %rbp
cmpq $0x2, %r12
je 0x1c2b9
leaq (%r12,%r13), %rdx
cmpq %r15, %rdx
je 0x1c2c1
movb 0x4(%rsp,%r12), %al
cmpb %al, (%rdx)
jne 0x1c2c6
incq %r12
cmpq $0x2000, %r12           # imm = 0x2000
jb 0x1c293
jmp 0x1c2e1
movl $0x2, %r9d
jmp 0x1c2d7
movq %rbp, %r12
jmp 0x1c2c8
jae 0x1c2d4
addq $0x8, %rbx
movq %rbx, %r8
movq %r12, %r11
jmp 0x1c2da
movq %r12, %r9
movq %rbx, %r10
cmpq %r8, %r10
jne 0x1c26b
jmp 0x1c2e4
movq %rbx, %r8
movq %r8, %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
movq %rax, (%rsi,%rdi,8)
incq %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jne 0x1c24e
movq 0x8(%rsp), %rax
sarq $0x3, %rax
movq %rax, 0x80000(%rsi)
jmp 0x1c4cd
leaq 0x300(%rip), %rax       # 0x1c620
movq %rax, 0x880(%rbx)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
cmpq %rcx, %rax
je 0x1c4cd
movq %rax, 0x60(%rbx)
movq %rcx, %rdx
subq %rax, %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, 0x68(%rbx)
xorl %esi, %esi
movq %rax, %rdi
cmpq %rcx, %rdi
je 0x1c3d3
movq %rcx, %r9
xorl %r10d, %r10d
xorl %r8d, %r8d
movq %r9, %rdx
subq %rdi, %rdx
sarq %rdx
andq $-0x4, %rdx
leaq (%rdi,%rdx), %r11
cmpq %r8, %r10
movq %r8, %r12
cmovbq %r10, %r12
movslq (%rdi,%rdx), %r13
addq %r14, %r13
movq %r15, %rbp
subq %r13, %rbp
cmpq $0x1, %r12
je 0x1c3a8
leaq (%r12,%r13), %rdx
cmpq %r15, %rdx
je 0x1c3b0
cmpb %sil, (%rdx)
jne 0x1c3b5
incq %r12
cmpq $0x2000, %r12           # imm = 0x2000
jb 0x1c386
jmp 0x1c3d0
movl $0x1, %r8d
jmp 0x1c3c6
movq %rbp, %r12
jmp 0x1c3b7
jae 0x1c3c3
addq $0x4, %r11
movq %r11, %rdi
movq %r12, %r10
jmp 0x1c3c9
movq %r12, %r8
movq %r11, %r9
cmpq %rdi, %r9
jne 0x1c35e
jmp 0x1c3d3
movq %r11, %rdi
movq %rdi, 0x70(%rbx,%rsi,8)
incq %rsi
cmpq $0x100, %rsi            # imm = 0x100
jne 0x1c350
movq %rcx, 0x870(%rbx)
movq 0x878(%rbx), %rsi
testq %rsi, %rsi
je 0x1c4cd
xorl %edi, %edi
movq %rax, 0x10(%rsp)
movq %rax, %r8
movl %edi, %edx
rolw $0x8, %dx
movw %dx, 0x6(%rsp)
cmpq %rcx, %r8
je 0x1c49f
movq %rcx, %r10
xorl %r11d, %r11d
xorl %r9d, %r9d
movq %r10, %rdx
subq %r8, %rdx
sarq %rdx
andq $-0x4, %rdx
leaq (%r8,%rdx), %rbx
cmpq %r9, %r11
movq %r9, %r12
cmovbq %r11, %r12
movslq (%r8,%rdx), %r13
addq %r14, %r13
movq %r15, %rbp
subq %r13, %rbp
cmpq $0x2, %r12
je 0x1c474
leaq (%r12,%r13), %rdx
cmpq %r15, %rdx
je 0x1c47c
movb 0x6(%rsp,%r12), %al
cmpb %al, (%rdx)
jne 0x1c481
incq %r12
cmpq $0x2000, %r12           # imm = 0x2000
jb 0x1c44e
jmp 0x1c49c
movl $0x2, %r9d
jmp 0x1c492
movq %rbp, %r12
jmp 0x1c483
jae 0x1c48f
addq $0x4, %rbx
movq %rbx, %r8
movq %r12, %r11
jmp 0x1c495
movq %r12, %r9
movq %rbx, %r10
cmpq %r8, %r10
jne 0x1c426
jmp 0x1c49f
movq %rbx, %r8
movq %r8, %rax
subq 0x10(%rsp), %rax
shrq $0x2, %rax
movl %eax, (%rsi,%rdi,4)
incq %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jne 0x1c409
movq 0x8(%rsp), %rax
shrq $0x2, %rax
movl %eax, 0x40000(%rsi)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq