// File: /workspace/github_cpp_makefile_star2_O1/bubiche[P]wu_manber/./wu_manber.hpp
// Function: wu_manber::WuManber<char, std::char_traits<char>>::scan(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long, unsigned long)>)
void scan(const StringType &text, std::function<void(const StringType&, std::size_t, std::size_t)> onMatch) {
      std::size_t textLength = text.size();
      if (!isInitialized_ || textLength == 0) {
        return;
      }

      if (isShortPatternExist_) {
        int firstCharacterMatchIndex = lengthOnePatternLookup_[static_cast<std::size_t>(text[0])];
        if (firstCharacterMatchIndex > -1) {
          onMatch(lengthOnePatterns_[firstCharacterMatchIndex], firstCharacterMatchIndex, 0);
        }
        const int PRE_WU_MANBER_LIMIT = std::min(m_ - 1, textLength);
        for (std::size_t idx = 1; idx < PRE_WU_MANBER_LIMIT; ++idx) {
          CharType preChar = text[idx - 1];
          CharType curChar = text[idx];
          checkShortPattern_(text, idx, onMatch);
        }
      }

      std::size_t idx = m_ - 1;
      while (idx < textLength) {
        if (isShortPatternExist_) {
          checkShortPattern_(text, idx, onMatch);
        }

        // hash value for HASH table
        unsigned int hashValue = getWuManberTableHashFromText_(text, idx);

        std::size_t shiftLength = shiftTable_[hashValue];
        if (shiftLength == 0) {
          // found a potential match, check values in HASH/PREDIX and will shift by 1 character
          shiftLength = 1;

          // hash value to match pattern
          unsigned int prefixHash = getPrefixHashFromText_(text, idx - m_ + 1);
          for (const auto &potentialMatch : hashPrefixTable_[hashValue]) {
            if (prefixHash == potentialMatch.prefixHash) {
              bool isMatched = false;
              const StringType &pattern = patternList_[potentialMatch.idx];
              std::size_t idxInPattern = 0;
              std::size_t idxInText = idx - m_ + 1;
              std::size_t patternLength = pattern.size();

              // prefix hash matched so we try to match character by character
              while(idxInPattern < patternLength && idxInText < textLength && pattern[idxInPattern++] == text[idxInText++]);

              // end of pattern reached => match found
              if (idxInPattern == patternLength) {
                onMatch(pattern, potentialMatch.idx, idx - m_ + 1);
              }
            }
          }
        }
        if (isShortPatternExist_) {
          ++idx;
        } else {
          idx += shiftLength;
        }
      }

    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, (%rsp)
movq 0x8(%rsi), %rbp
testq %rbp, %rbp
je 0x2e03
movq %rdi, %r15
cmpb $0x0, 0xe0(%rdi)
je 0x2e03
cmpb $0x1, 0x70(%r15)
jne 0x2c69
movq (%rsp), %rax
movq (%rax), %rax
movsbq (%rax), %rax
movq 0x80(%r15), %rcx
movq (%rcx,%rax,8), %rax
testl %eax, %eax
js 0x2c09
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0xb0(%r15), %rsi
movq %rax, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rdi
cmpq $0x0, 0x10(%rdi)
je 0x2e12
shlq $0x5, %rax
addq %rax, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq *0x18(%rdi)
movq 0x8(%r15), %rax
decq %rax
cmpq %rax, %rbp
cmovbq %rbp, %rax
movslq %eax, %rbx
cmpq $0x2, %rbx
jb 0x2c69
movl $0x1, %r12d
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x3d00
movq %r15, %rdi
movq (%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x3c2c
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x2c61
movq %r13, %rdi
movq %r13, %rsi
movl $0x3, %edx
callq *%rax
incq %r12
cmpq %r12, %rbx
jne 0x2c2b
movq 0x8(%r15), %r12
decq %r12
cmpq %rbp, %r12
jae 0x2e03
leaq 0x28(%rsp), %rbx
movl $0x1, %r14d
cmpb $0x1, 0x70(%r15)
jne 0x2cc1
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x3d00
movq %r15, %rdi
movq (%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x3c2c
movq 0x38(%rsp), %rax
testq %rax, %rax
je 0x2cc1
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
movq (%rsp), %rax
movq (%rax), %rsi
movsbl (%rsi,%r12), %eax
movzwl 0x18(%r15), %ecx
shll %cl, %eax
movsbl -0x1(%rsi,%r12), %edx
addl %eax, %edx
shll %cl, %edx
movsbl -0x2(%rsi,%r12), %eax
addl %edx, %eax
xorl %edx, %edx
divq 0x20(%r15)
movq 0x28(%r15), %rax
movq (%rax,%rdx,8), %rax
testq %rax, %rax
jne 0x2dee
movq %r12, %rax
subq 0x8(%r15), %rax
movsbl 0x1(%rsi,%rax), %r14d
shll %cl, %r14d
movq 0x40(%r15), %rcx
leaq (%rdx,%rdx,2), %rdx
movq (%rcx,%rdx,8), %rbx
movq 0x8(%rcx,%rdx,8), %r13
cmpq %r13, %rbx
je 0x2dde
movsbl 0x2(%rsi,%rax), %eax
addl %eax, %r14d
leaq 0x1(%r12), %rax
movq %rax, 0x20(%rsp)
cmpl (%rbx), %r14d
jne 0x2dd1
movq 0x8(%rbx), %rax
movq 0x8(%r15), %r9
movq 0x58(%r15), %rdx
movq %rax, %rdi
shlq $0x5, %rdi
leaq (%rdx,%rdi), %rsi
movq %r12, %rcx
subq %r9, %rcx
movq 0x8(%rdx,%rdi), %rdx
movq (%rsp), %rdi
movq (%rdi), %rdi
addq %r12, %rdi
subq %r9, %rdi
incq %rdi
movq 0x20(%rsp), %r8
subq %r9, %r8
xorl %r9d, %r9d
cmpq %rdx, %r9
jae 0x2da3
leaq (%r8,%r9), %r10
cmpq %rbp, %r10
jae 0x2da3
leaq 0x1(%r9), %r10
movq (%rsi), %r11
movb (%r11,%r9), %r11b
cmpb (%rdi,%r9), %r11b
movq %r10, %r9
je 0x2d7f
jmp 0x2da6
movq %r9, %r10
cmpq %rdx, %r10
jne 0x2dd1
incq %rcx
movq %rax, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x8(%rsp), %rdi
cmpq $0x0, 0x10(%rdi)
je 0x2e12
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq *0x18(%rdi)
addq $0x10, %rbx
cmpq %r13, %rbx
jne 0x2d39
leaq 0x28(%rsp), %rbx
movl $0x1, %r14d
movl $0x1, %eax
cmpb $0x0, 0x70(%r15)
cmovneq %r14, %rax
addq %rax, %r12
cmpq %rbp, %r12
jb 0x2c84
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2060
jmp 0x2e5f
jmp 0x2e5f
movq %rax, %rbx
movq 0x38(%rsp), %rax
testq %rax, %rax
je 0x2e57
leaq 0x28(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e57
jmp 0x2e5f
movq %rax, %rbx
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x2e57
leaq 0x48(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x2f3b
nop