// File: /workspace/github_c_makefile_star2_O2/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 0x124673
movq %r13, %rdi
callq 0x89eb7
testb %al, %al
jne 0x124cf2
pushq $0x8
popq %rbx
movq %rbx, %rdi
callq 0x5809c
movq %rax, %r12
movq %rbx, %rdi
callq 0x5809c
movq %rax, %r14
movq %rbx, %rdi
callq 0x5809c
movq %rax, (%rsp)
movq %rbx, %rdi
callq 0x5809c
movq %rax, %r15
leaq 0x1e7e83(%rip), %rbx    # 0x30c52d
leaq 0x245ebf(%rip), %rdx    # 0x36a570
leaq 0x672(%rip), %r8        # 0x124d2a
pushq $0x3
popq %rbp
movq %rbx, %rdi
movq %rbp, %rsi
xorl %ecx, %ecx
movq %r14, 0x8(%rsp)
movq %r14, %r9
callq 0x124154
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x245e93(%rip), %rdx    # 0x36a570
xorl %ecx, %ecx
leaq 0x644(%rip), %r8        # 0x124d2a
movq %r15, %r9
callq 0x124400
movq %r12, %rdi
callq 0x586a4
pushq $-0x1
popq %r14
testq %rax, %rax
je 0x124732
leaq 0x1d9cec(%rip), %rsi    # 0x2fe3f2
leaq 0x2114c9(%rip), %rdx    # 0x335bd6
leaq 0x2114a5(%rip), %rcx    # 0x335bb9
leaq 0x21142c(%rip), %r8     # 0x335b47
movq %r13, %rdi
movl $0xdc, %r9d
xorl %eax, %eax
callq 0x89dbb
movq 0x8(%rsp), %rbx
jmp 0x124774
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x586a4
testq %rax, %rax
je 0x124c74
leaq 0x1d9ca3(%rip), %rsi    # 0x2fe3f2
leaq 0x2114a4(%rip), %rdx    # 0x335bfa
leaq 0x21145c(%rip), %rcx    # 0x335bb9
leaq 0x2113e3(%rip), %r8     # 0x335b47
movq %r13, %rdi
movl $0xdd, %r9d
xorl %eax, %eax
callq 0x89dbb
movq (%rsp), %rbp
xorl %eax, %eax
movq %r15, 0x20(%rsp)
movq %r12, 0x18(%rsp)
movq %r13, 0x10(%rsp)
testl %r14d, %r14d
jne 0x124c3f
cmpq $0xff, %rax
ja 0x124c3f
movq %rax, 0x48(%rsp)
movq %r13, %rbp
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x955fa
movq %rax, %r15
pushq $0x42
popq %rdi
callq 0x955fa
movq %rax, %r14
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x1247d8
callq 0x957c8
movb %al, 0xa0(%rsp,%r13)
incq %r13
jmp 0x1247c1
movb $0x0, 0xa0(%rsp,%r15)
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x1247f8
callq 0x957c8
movb %al, 0x50(%rsp,%r13)
incq %r13
jmp 0x1247e4
orq $-0x1, 0x40(%rsp)
orq $-0x1, 0x38(%rsp)
orq $-0x1, 0x30(%rsp)
movb $0x0, 0x50(%rsp,%r14)
orq $-0x1, 0x28(%rsp)
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rbx
movq %rbx, %rdx
movq %r14, %rcx
leaq 0x54b(%rip), %r13       # 0x124d81
movq %r13, %r8
leaq 0x40(%rsp), %r9
callq 0x124589
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
leaq 0x38(%rsp), %r9
callq 0x124154
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
leaq 0x30(%rsp), %r9
callq 0x12426f
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
leaq 0x28(%rsp), %r9
callq 0x124400
movq 0x40(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x1249e0
cmpq 0x30(%rsp), %rax
movq %rbp, %rdi
jne 0x124a07
cmpq 0x28(%rsp), %rax
movq 0x18(%rsp), %rbp
jne 0x124af6
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %r12
movq %r12, %rdx
movq %r14, %rcx
leaq 0x44e(%rip), %rbx       # 0x124d2a
movq %rbx, %r8
movq %rbp, %r9
callq 0x124589
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq 0x8(%rsp), %rbx
movq %rbx, %r9
callq 0x124154
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
leaq 0x414(%rip), %r8        # 0x124d2a
movq (%rsp), %r9
callq 0x12426f
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
leaq 0x3f8(%rip), %r8        # 0x124d2a
movq %rbp, %r12
movq 0x20(%rsp), %r15
movq %r15, %r9
callq 0x124400
movq %rbp, %rdi
callq 0x586a4
movq %rax, %r14
movq %rbx, %rdi
callq 0x586a4
cmpq %rax, %r14
jne 0x124b27
movq %r12, %rdi
callq 0x586a4
movq %rax, %r14
movq (%rsp), %rbp
movq %rbp, %rdi
callq 0x586a4
cmpq %rax, %r14
movq 0x10(%rsp), %r13
jne 0x124b65
movq %r12, %rdi
callq 0x586a4
movq %rax, %r14
movq %r15, %rdi
callq 0x586a4
cmpq %rax, %r14
jne 0x124b8c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5891a
testl %eax, %eax
pushq $-0x1
popq %r14
je 0x124bc1
movq %r13, %rdi
leaq 0x1d9a32(%rip), %rsi    # 0x2fe3f2
leaq 0x2113b9(%rip), %rdx    # 0x335d80
leaq 0x2111eb(%rip), %rcx    # 0x335bb9
leaq 0x211172(%rip), %r8     # 0x335b47
movl $0x108, %r9d            # imm = 0x108
jmp 0x124c2b
movq %rbp, %rdi
leaq 0x1d9a08(%rip), %rsi    # 0x2fe3f2
leaq 0x211263(%rip), %rdx    # 0x335c54
leaq 0x2111c1(%rip), %rcx    # 0x335bb9
leaq 0x211148(%rip), %r8     # 0x335b47
movl $0xf8, %r9d
jmp 0x124a29
leaq 0x1d99e4(%rip), %rsi    # 0x2fe3f2
leaq 0x21125e(%rip), %rdx    # 0x335c73
leaq 0x21119d(%rip), %rcx    # 0x335bb9
leaq 0x211124(%rip), %r8     # 0x335b47
movl $0xf9, %r9d
xorl %eax, %eax
callq 0x89dbb
movq 0x18(%rsp), %rax
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rbp
movq %rbp, %rdx
movq %r14, %rcx
leaq 0x2d5(%rip), %rbx       # 0x124d2a
movq %rbx, %r8
movq %rax, %r12
movq %rax, %r9
callq 0x124589
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq 0x8(%rsp), %rbx
movq %rbx, %r9
callq 0x124154
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
leaq 0x298(%rip), %r8        # 0x124d2a
movq (%rsp), %rbp
movq %rbp, %r9
callq 0x12426f
movq %r13, %rdi
movq %r15, %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rcx
leaq 0x277(%rip), %r8        # 0x124d2a
movq 0x20(%rsp), %r15
movq %r15, %r9
callq 0x124400
pushq $-0x1
popq %r14
movq 0x10(%rsp), %r13
movq %r12, %rdi
callq 0x5876c
movq %rbx, %rdi
callq 0x5876c
movq %rbp, %rdi
callq 0x5876c
movq %r15, %rdi
callq 0x5876c
movq 0x48(%rsp), %rax
incq %rax
jmp 0x124789
leaq 0x1d98f5(%rip), %rsi    # 0x2fe3f2
leaq 0x21118e(%rip), %rdx    # 0x335c92
leaq 0x2110ae(%rip), %rcx    # 0x335bb9
leaq 0x211035(%rip), %r8     # 0x335b47
movl $0xfa, %r9d
xorl %eax, %eax
callq 0x89dbb
movq %rbp, %rax
jmp 0x124a35
movq 0x10(%rsp), %r13
movq %r13, %rdi
leaq 0x1d98bc(%rip), %rsi    # 0x2fe3f2
leaq 0x21117a(%rip), %rdx    # 0x335cb7
leaq 0x211075(%rip), %rcx    # 0x335bb9
leaq 0x210ffc(%rip), %r8     # 0x335b47
movl $0x103, %r9d            # imm = 0x103
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r14
movq (%rsp), %rbp
jmp 0x124ac9
movq %r13, %rdi
leaq 0x1d9883(%rip), %rsi    # 0x2fe3f2
leaq 0x211182(%rip), %rdx    # 0x335cf8
leaq 0x21103c(%rip), %rcx    # 0x335bb9
leaq 0x210fc3(%rip), %r8     # 0x335b47
movl $0x105, %r9d            # imm = 0x105
jmp 0x124bb1
movq %r13, %rdi
leaq 0x1d985c(%rip), %rsi    # 0x2fe3f2
leaq 0x21119c(%rip), %rdx    # 0x335d39
leaq 0x211015(%rip), %rcx    # 0x335bb9
leaq 0x210f9c(%rip), %r8     # 0x335b47
movl $0x107, %r9d            # imm = 0x107
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r14
jmp 0x124ac9
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5891a
testl %eax, %eax
je 0x124bf7
movq %r13, %rdi
leaq 0x1d9818(%rip), %rsi    # 0x2fe3f2
leaq 0x2111cf(%rip), %rdx    # 0x335db0
leaq 0x210fd1(%rip), %rcx    # 0x335bb9
leaq 0x210f58(%rip), %r8     # 0x335b47
movl $0x109, %r9d            # imm = 0x109
jmp 0x124c2b
movq %r12, %rdi
movq %r15, %rsi
callq 0x5891a
testl %eax, %eax
je 0x124c37
movq %r13, %rdi
leaq 0x1d97e2(%rip), %rsi    # 0x2fe3f2
leaq 0x2111c9(%rip), %rdx    # 0x335de0
leaq 0x210f9b(%rip), %rcx    # 0x335bb9
leaq 0x210f22(%rip), %r8     # 0x335b47
movl $0x10a, %r9d            # imm = 0x10A
xorl %eax, %eax
callq 0x89dbb
jmp 0x124ac9
xorl %r14d, %r14d
jmp 0x124ac9
movq %r15, %rdi
callq 0x58eb9
movq %rbx, %rdi
callq 0x58eb9
movq %rbp, %rdi
callq 0x58eb9
movq %r12, %rdi
callq 0x58eb9
movl %r14d, %eax
addq $0x18748, %rsp          # imm = 0x18748
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rbp
movq %rbp, %rdi
callq 0x586a4
testq %rax, %rax
je 0x124cac
leaq 0x1d9766(%rip), %rsi    # 0x2fe3f2
leaq 0x210f83(%rip), %rdx    # 0x335c16
leaq 0x210f1f(%rip), %rcx    # 0x335bb9
leaq 0x210ea6(%rip), %r8     # 0x335b47
movq %r13, %rdi
movl $0xde, %r9d
jmp 0x124cde
movq %r15, %rdi
callq 0x586a4
testq %rax, %rax
je 0x124cea
leaq 0x1d9732(%rip), %rsi    # 0x2fe3f2
leaq 0x210f6b(%rip), %rdx    # 0x335c32
leaq 0x210eeb(%rip), %rcx    # 0x335bb9
leaq 0x210e72(%rip), %r8     # 0x335b47
movq %r13, %rdi
movl $0xdf, %r9d
xorl %eax, %eax
callq 0x89dbb
jmp 0x124778
xorl %r14d, %r14d
jmp 0x124778
movq 0x31326f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1c0310(%rip), %rsi    # 0x2e5013
leaq 0x1c04b5(%rip), %rdx    # 0x2e51bf
leaq 0x210ea8(%rip), %rcx    # 0x335bb9
leaq 0x210e2f(%rip), %r8     # 0x335b47
movl $0xcd, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390