// File: /workspace/github_c_makefile_star2_O3/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 0x17e323
movq %rdx, %r12
testq %rdx, %rdx
je 0x17e323
movq %rcx, %rbp
testq %rcx, %rcx
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x17e2e0
movq %rsi, 0x10(%rsp)
leaq 0x8(,%rbp,8), %rdi
leaq 0x2175ef(%rip), %rsi    # 0x3957ee
movl $0x40, %edx
movq %r8, 0x8(%rsp)
callq 0x104226
movq 0x8(%rsp), %r8
movq %rax, %r14
movq $-0x1, (%rax)
movq $0x0, 0x8(%rax)
cmpq $0x2, %rbp
jb 0x17e274
leaq 0x1(%rbp), %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 0x17e259
cmpb %sil, (%r12,%rdx)
je 0x17e25b
movq (%r14,%rdx,8), %rdx
jmp 0x17e248
xorl %edx, %edx
xorl %edi, %edi
cmpb %sil, (%r12,%rdx)
sete %dil
addq %rdi, %rdx
movq %rdx, (%r14,%rcx,8)
incq %rcx
cmpq %rax, %rcx
jne 0x17e243
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x10(%rsp), %rcx
cmpq %rbp, %r15
jne 0x17e2ab
testq %r8, %r8
je 0x17e2a5
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq *0x8(%rsp)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r8
testb %al, %al
jne 0x17e2e5
movq (%r14,%rbp,8), %r15
jmp 0x17e2c7
movq 0x20(%rsp), %rax
movb (%rax,%rbx), %al
cmpb (%r12,%r15), %al
jne 0x17e2be
incq %r15
jmp 0x17e2cd
testq %r15, %r15
je 0x17e2d8
movq (%r14,%r15,8), %r15
subq %r15, %rbx
movq %rbx, %r13
leaq (%r15,%r13), %rbx
cmpq %rcx, %rbx
jb 0x17e281
jmp 0x17e2e8
incq %r13
xorl %r15d, %r15d
jmp 0x17e2cd
xorl %r15d, %r15d
jmp 0x17e311
movq %rbp, %r15
testq %r8, %r8
je 0x17e2fd
cmpq %rbp, %r15
jne 0x17e2fd
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq *%r8
leaq 0x2174ea(%rip), %rsi    # 0x3957ee
movq %r14, %rdi
movl $0x78, %edx
callq 0x1045eb
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x57016