// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/string_matching.c
// Function: gt_string_matching_kmp
GtUword gt_string_matching_kmp(const char *s, GtUword n,
                                     const char *p, GtUword m,
                                     GtProcessMatch process_match, void *data)
{
  GtUword *prefixtab,
                j = 0,   /* position in s corresponding to the first character
                            in p */
                cpl = 0; /* length of common prefix of s[j]..s[n-1] and p */
  char b, c;
  gt_assert(s && p);
  if (!m || !n) /* no match possible */
    return 0;
  prefixtab = compute_prefixtab(p, m);
  while (j + cpl < n) {
    if (cpl == m) {                     /* case (1)  */
      if (process_match) {
        if (process_match(j, data))
            break;
      }
      j = j + cpl - prefixtab[cpl];
      cpl = prefixtab[cpl];
    }
    else {                              /* case (2)  */
      b = s[j+cpl];
      c = p[cpl];
      if (b != c) {
        if (cpl > 0) {
          j = j + cpl - prefixtab[cpl]; /* case (2a) */
          cpl = prefixtab[cpl];
        }
        else
          j++;                          /* case (2b) */

      }
      else
        cpl++;                          /* case (2c) */
    }
  }
  /* do not miss match at the last possible position */
  if (cpl == m && process_match)
    process_match(j, data);
  gt_free(prefixtab);
  return cpl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
testq %rdi, %rdi
je 0x186956
movq %rdx, %r12
testq %rdx, %rdx
je 0x186956
movq %rcx, %r15
testq %rcx, %rcx
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x186917
movq %rsi, 0x10(%rsp)
leaq 0x8(,%r15,8), %rdi
leaq 0x218462(%rip), %rsi    # 0x39ec9e
movl $0x40, %edx
movq %r8, 0x8(%rsp)
callq 0x1092b2
movq 0x8(%rsp), %r8
movq %rax, %r14
movq $-0x1, (%rax)
movq $0x0, 0x8(%rax)
cmpq $0x2, %r15
jb 0x1868af
leaq 0x1(%r15), %rcx
cmpq $0x4, %rcx
movl $0x3, %eax
cmovaeq %rcx, %rax
movl $0x2, %ecx
xorl %edx, %edx
movb -0x1(%r12,%rcx), %sil
testq %rdx, %rdx
je 0x186896
cmpb %sil, (%r12,%rdx)
je 0x186896
movq (%r14,%rdx,8), %rdx
jmp 0x186885
xorl %edi, %edi
cmpb %sil, (%r12,%rdx)
sete %dil
addq %rdi, %rdx
movq %rdx, (%r14,%rcx,8)
incq %rcx
cmpq %rax, %rcx
jne 0x186880
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x10(%rsp), %rcx
cmpq %r15, %rbp
jne 0x1868e1
testq %r8, %r8
je 0x1868f9
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq *0x8(%rsp)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r8
testb %al, %al
je 0x1868f9
jmp 0x18691b
movq 0x20(%rsp), %rax
movb (%rax,%rbx), %al
cmpb (%r12,%rbp), %al
jne 0x1868f4
incq %rbp
jmp 0x186903
testq %rbp, %rbp
je 0x186910
movq (%r14,%rbp,8), %rbp
subq %rbp, %rbx
movq %rbx, %r13
movq %r13, %rbx
addq %rbp, %rbx
cmpq %rcx, %rbx
jb 0x1868bb
jmp 0x18691b
incq %r13
xorl %ebp, %ebp
jmp 0x186903
xorl %ebp, %ebp
jmp 0x186944
testq %r8, %r8
je 0x186930
cmpq %r15, %rbp
jne 0x186930
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq *%r8
leaq 0x218367(%rip), %rsi    # 0x39ec9e
movq %r14, %rdi
movl $0x78, %edx
callq 0x109670
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x58295