// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/string_matching.c
// Function: gt_string_matching_unit_test
int gt_string_matching_unit_test(GtError *err)
{
  char s[STRING_MATCHING_MAX_STRING_LENGTH+1],
       p[STRING_MATCHING_MAX_PATTERN_LENGTH+1], *text = "foo";
  GtArray *brute_force_matches,
        *bmh_matches,
        *kmp_matches,
        *shift_and_matches;
  GtUword i, brute_force_match, bmh_match, kmp_match, shift_and_match;
  int had_err = 0;

  gt_error_check(err);

  brute_force_matches = gt_array_new(sizeof (GtUword));
  bmh_matches = gt_array_new(sizeof (GtUword));
  kmp_matches = gt_array_new(sizeof (GtUword));
  shift_and_matches = gt_array_new(sizeof (GtUword));

  /* match the empty pattern */
  gt_string_matching_brute_force(text, strlen(text), "", 0, store_match,
                              brute_force_matches);
  gt_string_matching_bmh(text, strlen(text), "", 0, store_match, bmh_matches);
  gt_string_matching_kmp(text, strlen(text), "", 0, store_match, kmp_matches);
  gt_string_matching_shift_and(text, strlen(text), "", 0, store_match,
                            shift_and_matches);

  gt_ensure(!gt_array_size(brute_force_matches));
  gt_ensure(!gt_array_size(bmh_matches));
  gt_ensure(!gt_array_size(kmp_matches));
  gt_ensure(!gt_array_size(shift_and_matches));

  for (i = 0; !had_err && i < STRING_MATCHING_NUM_OF_TESTS; i++) {
    GtUword j, n, m;
    /* generate random string and pattern */
    n = gt_rand_max(STRING_MATCHING_MAX_STRING_LENGTH);
    m = gt_rand_max(STRING_MATCHING_MAX_PATTERN_LENGTH);
    for (j = 0; j < n; j++)
      s[j] = gt_rand_char();
    s[n] = '\0';
    for (j = 0; j < m; j++)
      p[j] = gt_rand_char();
    p[m] = '\0';
    /* matching (first match) */
    brute_force_match = GT_UNDEF_UWORD;
    bmh_match = GT_UNDEF_UWORD;
    kmp_match = GT_UNDEF_UWORD;
    shift_and_match = GT_UNDEF_UWORD;
    gt_string_matching_brute_force(s, n, p, m, store_first_match,
                                &brute_force_match);
    gt_string_matching_bmh(s, n, p, m, store_first_match, &bmh_match);
    gt_string_matching_kmp(s, n, p, m, store_first_match, &kmp_match);
    gt_string_matching_shift_and(s, n, p, m, store_first_match,
                                 &shift_and_match);
    /* comparing (first match) */
    gt_ensure(brute_force_match == bmh_match);
    gt_ensure(brute_force_match == kmp_match);
    gt_ensure(brute_force_match == shift_and_match);
    /* matching (all matches) */
    gt_string_matching_brute_force(s, n, p, m, store_match,
                                   brute_force_matches);
    gt_string_matching_bmh(s, n, p, m, store_match, bmh_matches);
    gt_string_matching_kmp(s, n, p, m, store_match, kmp_matches);
    gt_string_matching_shift_and(s, n, p, m, store_match, shift_and_matches);
    /* comparing (all matches) */
    gt_ensure(gt_array_size(brute_force_matches) ==
                    gt_array_size(bmh_matches));
    gt_ensure(gt_array_size(brute_force_matches) ==
                    gt_array_size(kmp_matches));
    gt_ensure(gt_array_size(brute_force_matches) ==
                    gt_array_size(shift_and_matches));
    gt_ensure(!gt_array_cmp(brute_force_matches, bmh_matches));
    gt_ensure(!gt_array_cmp(brute_force_matches, kmp_matches));
    gt_ensure(!gt_array_cmp(brute_force_matches, shift_and_matches));
    /* reset */
    gt_array_reset(brute_force_matches);
    gt_array_reset(bmh_matches);
    gt_array_reset(kmp_matches);
    gt_array_reset(shift_and_matches);
  }

  gt_array_delete(shift_and_matches);
  gt_array_delete(bmh_matches);
  gt_array_delete(kmp_matches);
  gt_array_delete(brute_force_matches);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18748, %rsp          # imm = 0x18748
movq %rdi, %r13
testq %rdi, %rdi
je 0x186b71
movq %r13, %rdi
callq 0x101a9a
testb %al, %al
jne 0x18722f
movl $0x8, %edi
callq 0xd46fc
movq %rax, %rbx
movq %rax, 0x20(%rsp)
movl $0x8, %edi
callq 0xd46fc
movq %rax, %r14
movl $0x8, %edi
callq 0xd46fc
movq %rax, %r15
movl $0x8, %edi
callq 0xd46fc
movq %rax, %r12
movq %rbx, %rdi
callq 0xd4a9a
testq %rax, %rax
movq %r14, 0x10(%rsp)
je 0x186be8
leaq 0x1e0977(%rip), %rsi    # 0x36753a
leaq 0x218163(%rip), %rdx    # 0x39ed2d
leaq 0x21813f(%rip), %rcx    # 0x39ed10
leaq 0x2180c6(%rip), %r8     # 0x39ec9e
xorl %ebx, %ebx
movq %r13, %rdi
movl $0xdc, %r9d
jmp 0x186c8c
movq %r14, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0x186c1e
leaq 0x1e093e(%rip), %rsi    # 0x36753a
leaq 0x21814e(%rip), %rdx    # 0x39ed51
leaq 0x218106(%rip), %rcx    # 0x39ed10
leaq 0x21808d(%rip), %r8     # 0x39ec9e
xorl %ebx, %ebx
movq %r13, %rdi
movl $0xdd, %r9d
jmp 0x186c8c
movq %r15, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0x186c54
leaq 0x1e0908(%rip), %rsi    # 0x36753a
leaq 0x218134(%rip), %rdx    # 0x39ed6d
leaq 0x2180d0(%rip), %rcx    # 0x39ed10
leaq 0x218057(%rip), %r8     # 0x39ec9e
xorl %ebx, %ebx
movq %r13, %rdi
movl $0xde, %r9d
jmp 0x186c8c
movq %r12, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0x187225
leaq 0x1e08ce(%rip), %rsi    # 0x36753a
leaq 0x218116(%rip), %rdx    # 0x39ed89
leaq 0x218096(%rip), %rcx    # 0x39ed10
leaq 0x21801d(%rip), %r8     # 0x39ec9e
xorl %ebx, %ebx
movq %r13, %rdi
movl $0xdf, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %bl, %bl
je 0x1871ec
xorl %eax, %eax
movq %r15, 0x8(%rsp)
movq %r12, (%rsp)
movq %r13, 0x18(%rsp)
movq %rax, 0x48(%rsp)
movq %r13, %rbx
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x10ae3c
movq %rax, %r15
movl $0x42, %edi
callq 0x10ae3c
movq %rax, %r14
testq %r15, %r15
je 0x186cf0
xorl %r13d, %r13d
callq 0x10af30
movb %al, 0xa0(%rsp,%r13)
incq %r13
cmpq %r13, %r15
jne 0x186cdb
movb $0x0, 0xa0(%rsp,%r15)
testq %r14, %r14
je 0x186d13
xorl %r13d, %r13d
callq 0x10af30
movb %al, 0x50(%rsp,%r13)
incq %r13
cmpq %r13, %r14
jne 0x186d01
movb $0x0, 0x50(%rsp,%r14)
movq $-0x1, %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movq %rax, 0x28(%rsp)
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rbp
movq %rbp, %rdx
movq %r14, %rcx
leaq 0x506(%rip), %r12       # 0x18725a
movq %r12, %r8
leaq 0x40(%rsp), %r9
callq 0x186ab5
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %r12, %r8
leaq 0x38(%rsp), %r9
callq 0x186654
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %r12, %r8
leaq 0x30(%rsp), %r9
callq 0x1867e4
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %r12, %r8
leaq 0x28(%rsp), %r9
callq 0x18695b
movq 0x40(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x186efc
cmpq 0x30(%rsp), %rax
jne 0x186f23
cmpq 0x28(%rsp), %rax
movq 0x20(%rsp), %r13
jne 0x187032
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rbp
movq %rbp, %rdx
movq %r14, %rcx
leaq 0x43d(%rip), %rbx       # 0x187234
movq %rbx, %r8
movq %r13, %r9
callq 0x186ab5
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq %r13, %rbp
movq 0x10(%rsp), %r13
movq %r13, %r9
callq 0x186654
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rcx
movq %rbx, %r8
movq 0x8(%rsp), %r9
callq 0x1867e4
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rcx
movq %rbx, %r8
movq (%rsp), %r9
callq 0x18695b
movq %rbp, %rdi
callq 0xd4a9a
movq %rax, %r14
movq %r13, %rdi
callq 0xd4a9a
cmpq %rax, %r14
jne 0x187063
movq %rbp, %rdi
callq 0xd4a9a
movq %rax, %r14
movq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xd4a9a
cmpq %rax, %r14
movq 0x18(%rsp), %rbx
jne 0x1870ad
movq %rbp, %rdi
callq 0xd4a9a
movq %rax, %r14
movq (%rsp), %rdi
callq 0xd4a9a
cmpq %rax, %r14
jne 0x1870ef
movq %rbp, %rdi
movq 0x10(%rsp), %r13
movq %r13, %rsi
callq 0xd4b85
testl %eax, %eax
je 0x18712b
xorl %r15d, %r15d
movq 0x18(%rsp), %rdi
leaq 0x1e065e(%rip), %rsi    # 0x36753a
leaq 0x217ff4(%rip), %rdx    # 0x39eed7
leaq 0x217e26(%rip), %rcx    # 0x39ed10
leaq 0x217dad(%rip), %r8     # 0x39ec9e
movl $0x108, %r9d            # imm = 0x108
jmp 0x187166
movq %rbx, %rdi
leaq 0x1e0634(%rip), %rsi    # 0x36753a
leaq 0x217e9e(%rip), %rdx    # 0x39edab
leaq 0x217dfc(%rip), %rcx    # 0x39ed10
leaq 0x217d83(%rip), %r8     # 0x39ec9e
movl $0xf8, %r9d
jmp 0x186f48
movq %rbx, %rdi
leaq 0x1e060d(%rip), %rsi    # 0x36753a
leaq 0x217e96(%rip), %rdx    # 0x39edca
leaq 0x217dd5(%rip), %rcx    # 0x39ed10
leaq 0x217d5c(%rip), %r8     # 0x39ec9e
movl $0xf9, %r9d
xorl %eax, %eax
callq 0x1019cf
movq 0x20(%rsp), %r13
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rbp
movq %rbp, %rdx
movq %r14, %rcx
leaq 0x2c0(%rip), %rbx       # 0x187234
movq %rbx, %r8
movq %r13, %r9
callq 0x186ab5
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq %r13, %rbp
movq 0x10(%rsp), %r13
movq %r13, %r9
callq 0x186654
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rcx
movq %rbx, %r8
movq 0x8(%rsp), %rbx
movq %rbx, %r9
callq 0x1867e4
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rcx
leaq 0x263(%rip), %r8        # 0x187234
movq (%rsp), %r12
movq %r12, %r9
callq 0x18695b
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq %rbp, %rdi
callq 0xd4ad3
movq %r13, %rdi
callq 0xd4ad3
movq %rbx, %rdi
callq 0xd4ad3
movq %r12, %rdi
callq 0xd4ad3
testb %r15b, %r15b
movq %rbx, %r15
je 0x1871ec
movq 0x48(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0xff, %rcx
movq 0x18(%rsp), %r13
jb 0x186cb1
jmp 0x1871ec
movq %rbx, %rdi
leaq 0x1e04fe(%rip), %rsi    # 0x36753a
leaq 0x217da6(%rip), %rdx    # 0x39ede9
leaq 0x217cc6(%rip), %rcx    # 0x39ed10
leaq 0x217c4d(%rip), %r8     # 0x39ec9e
movl $0xfa, %r9d
xorl %eax, %eax
callq 0x1019cf
jmp 0x186f54
xorl %r15d, %r15d
movq 0x18(%rsp), %rdi
leaq 0x1e04c8(%rip), %rsi    # 0x36753a
leaq 0x217d95(%rip), %rdx    # 0x39ee0e
leaq 0x217c90(%rip), %rcx    # 0x39ed10
leaq 0x217c17(%rip), %r8     # 0x39ec9e
movl $0x103, %r9d            # imm = 0x103
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq 0x10(%rsp), %r13
movq (%rsp), %r12
movq 0x8(%rsp), %rbx
jmp 0x186fe6
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0x1e0480(%rip), %rsi    # 0x36753a
leaq 0x217d8e(%rip), %rdx    # 0x39ee4f
leaq 0x217c48(%rip), %rcx    # 0x39ed10
leaq 0x217bcf(%rip), %r8     # 0x39ec9e
movl $0x105, %r9d            # imm = 0x105
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r12, %rbx
movq 0x10(%rsp), %r13
jmp 0x187178
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0x1e043e(%rip), %rsi    # 0x36753a
leaq 0x217d8d(%rip), %rdx    # 0x39ee90
leaq 0x217c06(%rip), %rcx    # 0x39ed10
leaq 0x217b8d(%rip), %r8     # 0x39ec9e
movl $0x107, %r9d            # imm = 0x107
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq 0x10(%rsp), %r13
jmp 0x187173
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0xd4b85
testl %eax, %eax
je 0x187181
xorl %r15d, %r15d
movq 0x18(%rsp), %rdi
leaq 0x1e03ef(%rip), %rsi    # 0x36753a
leaq 0x217db5(%rip), %rdx    # 0x39ef07
leaq 0x217bb7(%rip), %rcx    # 0x39ed10
leaq 0x217b3e(%rip), %r8     # 0x39ec9e
movl $0x109, %r9d            # imm = 0x109
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rbx
movq (%rsp), %r12
jmp 0x186fe6
movq %rbp, %rbx
movq %rbp, %rdi
movq (%rsp), %rsi
callq 0xd4b85
testl %eax, %eax
je 0x1871cd
xorl %r15d, %r15d
movq 0x18(%rsp), %rdi
leaq 0x1e0397(%rip), %rsi    # 0x36753a
leaq 0x217d8d(%rip), %rdx    # 0x39ef37
leaq 0x217b5f(%rip), %rcx    # 0x39ed10
leaq 0x217ae6(%rip), %r8     # 0x39ec9e
movl $0x10a, %r9d            # imm = 0x10A
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x1871d3
xorl %r14d, %r14d
movb $0x1, %r15b
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rax
movq (%rsp), %r12
movq %rbx, %rbp
movq %rax, %rbx
jmp 0x186fe6
movq %r12, %rdi
callq 0xd4ef4
movq 0x10(%rsp), %rdi
callq 0xd4ef4
movq %r15, %rdi
callq 0xd4ef4
movq 0x20(%rsp), %rdi
callq 0xd4ef4
movl %r14d, %eax
addq $0x18748, %rsp          # imm = 0x18748
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
movb $0x1, %bl
jmp 0x186c99
callq 0x5833e