// File: /workspace/github_c_makefile_star2_O3/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, %r12
testq %rdi, %rdi
je 0x17e529
movq %r12, %rdi
callq 0xfcc32
testb %al, %al
jne 0x17eb63
movl $0x8, %edi
callq 0xd214c
movq %rax, %r13
movl $0x8, %edi
callq 0xd214c
movq %rax, %r14
movl $0x8, %edi
callq 0xd214c
movq %rax, %r15
movl $0x8, %edi
callq 0xd214c
movq %rax, %rbx
movq %r13, %rdi
callq 0xd24e0
testq %rax, %rax
je 0x17e594
leaq 0x1dfecd(%rip), %rsi    # 0x35e43e
leaq 0x217305(%rip), %rdx    # 0x39587d
leaq 0x2172e1(%rip), %rcx    # 0x395860
leaq 0x217268(%rip), %r8     # 0x3957ee
movq %r12, %rdi
movl $0xdc, %r9d
jmp 0x17e62e
movq %r14, %rdi
callq 0xd24e0
testq %rax, %rax
je 0x17e5c8
leaq 0x1dfe96(%rip), %rsi    # 0x35e43e
leaq 0x2172f2(%rip), %rdx    # 0x3958a1
leaq 0x2172aa(%rip), %rcx    # 0x395860
leaq 0x217231(%rip), %r8     # 0x3957ee
movq %r12, %rdi
movl $0xdd, %r9d
jmp 0x17e62e
movq %r15, %rdi
callq 0xd24e0
testq %rax, %rax
je 0x17e5fc
leaq 0x1dfe62(%rip), %rsi    # 0x35e43e
leaq 0x2172da(%rip), %rdx    # 0x3958bd
leaq 0x217276(%rip), %rcx    # 0x395860
leaq 0x2171fd(%rip), %r8     # 0x3957ee
movq %r12, %rdi
movl $0xde, %r9d
jmp 0x17e62e
movq %rbx, %rdi
callq 0xd24e0
testq %rax, %rax
je 0x17e66e
leaq 0x1dfe2e(%rip), %rsi    # 0x35e43e
leaq 0x2172c2(%rip), %rdx    # 0x3958d9
leaq 0x217242(%rip), %rcx    # 0x395860
leaq 0x2171c9(%rip), %r8     # 0x3957ee
movq %r12, %rdi
movl $0xdf, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0xd2938
movq %r14, %rdi
callq 0xd2938
movq %r15, %rdi
callq 0xd2938
movq %r13, %rdi
callq 0xd2938
movl %ebp, %eax
addq $0x18748, %rsp          # imm = 0x18748
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, (%rsp)
xorl %eax, %eax
movq %rbx, 0x10(%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x40(%rsp)
movq %r13, 0x18(%rsp)
movq %rax, 0x48(%rsp)
movq %r14, %rbx
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x105d85
movq %rax, %rbp
movl $0x42, %edi
callq 0x105d85
movq %rax, %r12
testq %rbp, %rbp
je 0x17e6c7
xorl %r14d, %r14d
callq 0x105e79
movb %al, 0xa0(%rsp,%r14)
incq %r14
cmpq %r14, %rbp
jne 0x17e6b2
movb $0x0, 0xa0(%rsp,%rbp)
testq %r12, %r12
je 0x17e6e9
xorl %r14d, %r14d
callq 0x105e79
movb %al, 0x50(%rsp,%r14)
incq %r14
cmpq %r14, %r12
jne 0x17e6d7
movb $0x0, 0x50(%rsp,%r12)
movq $-0x1, %rax
movq %rax, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, 0x20(%rsp)
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
leaq 0x50(%rsp), %r15
movq %r15, %rdx
movq %r12, %rcx
leaq 0x464(%rip), %r14       # 0x17eb8e
movq %r14, %r8
leaq 0x38(%rsp), %r9
callq 0x17e476
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r14, %r8
leaq 0x30(%rsp), %r9
callq 0x17e068
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r14, %r8
leaq 0x28(%rsp), %r9
callq 0x17e1a7
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r14, %r8
leaq 0x20(%rsp), %r9
callq 0x17e328
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x17e8d8
cmpq 0x28(%rsp), %rax
movq 0x18(%rsp), %r15
jne 0x17e90c
cmpq 0x20(%rsp), %rax
jne 0x17e934
movq %rbx, %r13
leaq 0xa0(%rsp), %rdi
movq %rbp, %rsi
leaq 0x50(%rsp), %r14
movq %r14, %rdx
movq %r12, %rcx
leaq 0x39b(%rip), %r8        # 0x17eb68
movq %r15, %r9
callq 0x17e476
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r12, %rcx
leaq 0x378(%rip), %r14       # 0x17eb68
movq %r14, %r8
movq %r13, %r9
callq 0x17e068
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x50(%rsp), %rdx
movq %r12, %rcx
movq %r14, %r8
movq 0x8(%rsp), %r9
callq 0x17e1a7
movq %rbx, %rdi
movq %r13, %r14
movq %r15, %r13
movq %rbp, %rsi
leaq 0x50(%rsp), %rdx
movq %r12, %rcx
leaq 0x337(%rip), %r8        # 0x17eb68
movq 0x10(%rsp), %rbx
movq %rbx, %r9
callq 0x17e328
movq %r15, %rdi
callq 0xd24e0
movq %rax, %r12
movq %r14, %rdi
callq 0xd24e0
cmpq %rax, %r12
jne 0x17ea41
movq %r13, %rdi
callq 0xd24e0
movq %rax, %r12
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xd24e0
cmpq %rax, %r12
jne 0x17ea7d
movq %r13, %rdi
callq 0xd24e0
movq %rax, %r12
movq %rbx, %rdi
callq 0xd24e0
cmpq %rax, %r12
jne 0x17eaa8
movq %r13, %rdi
movq %r14, %rsi
callq 0xd25cb
testl %eax, %eax
je 0x17eae2
xorl %r12d, %r12d
movq (%rsp), %rdi
leaq 0x1dfb86(%rip), %rsi    # 0x35e43e
leaq 0x217168(%rip), %rdx    # 0x395a27
leaq 0x216f9a(%rip), %rcx    # 0x395860
leaq 0x216f21(%rip), %r8     # 0x3957ee
movl $0x108, %r9d            # imm = 0x108
jmp 0x17ead1
movq (%rsp), %rdi
leaq 0x1dfb5b(%rip), %rsi    # 0x35e43e
leaq 0x217011(%rip), %rdx    # 0x3958fb
leaq 0x216f6f(%rip), %rcx    # 0x395860
leaq 0x216ef6(%rip), %r8     # 0x3957ee
movl $0xf8, %r9d
xorl %eax, %eax
callq 0xfcb67
movq 0x18(%rsp), %r15
jmp 0x17e961
movq (%rsp), %rdi
leaq 0x1dfb27(%rip), %rsi    # 0x35e43e
leaq 0x216ffc(%rip), %rdx    # 0x39591a
leaq 0x216f3b(%rip), %rcx    # 0x395860
leaq 0x216ec2(%rip), %r8     # 0x3957ee
movl $0xf9, %r9d
jmp 0x17e95a
movq (%rsp), %rdi
leaq 0x1dfaff(%rip), %rsi    # 0x35e43e
leaq 0x216ff3(%rip), %rdx    # 0x395939
leaq 0x216f13(%rip), %rcx    # 0x395860
leaq 0x216e9a(%rip), %r8     # 0x3957ee
movl $0xfa, %r9d
xorl %eax, %eax
callq 0xfcb67
leaq 0xa0(%rsp), %rdi
movq %rbp, %rsi
leaq 0x50(%rsp), %rbx
movq %rbx, %rdx
movq %r12, %rcx
leaq 0x1ea(%rip), %r14       # 0x17eb68
movq %r14, %r8
movq %r15, %r13
movq %r15, %r9
callq 0x17e476
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r12, %rcx
movq %r14, %r8
movq 0x40(%rsp), %r14
movq %r14, %r9
callq 0x17e068
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r12, %rcx
leaq 0x1a5(%rip), %r8        # 0x17eb68
movq 0x8(%rsp), %r15
movq %r15, %r9
callq 0x17e1a7
leaq 0xa0(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r12, %rcx
leaq 0x180(%rip), %r8        # 0x17eb68
movq 0x10(%rsp), %rbx
movq %rbx, %r9
callq 0x17e328
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r12d, %r12d
movq %r13, %rdi
callq 0xd2519
movq %r14, %rdi
callq 0xd2519
movq %r15, %rdi
callq 0xd2519
movq %rbx, %rdi
callq 0xd2519
testb %r12b, %r12b
je 0x17e63a
movq 0x48(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0xff, %rcx
jb 0x17e688
jmp 0x17e63a
xorl %r12d, %r12d
movq (%rsp), %rdi
leaq 0x1df9ef(%rip), %rsi    # 0x35e43e
leaq 0x216f08(%rip), %rdx    # 0x39595e
leaq 0x216e03(%rip), %rcx    # 0x395860
leaq 0x216d8a(%rip), %r8     # 0x3957ee
movl $0x103, %r9d            # imm = 0x103
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %r15
jmp 0x17e9fd
xorl %r12d, %r12d
movq (%rsp), %rdi
leaq 0x1df9b3(%rip), %rsi    # 0x35e43e
leaq 0x216f0d(%rip), %rdx    # 0x39599f
leaq 0x216dc7(%rip), %rcx    # 0x395860
leaq 0x216d4e(%rip), %r8     # 0x3957ee
movl $0x105, %r9d            # imm = 0x105
jmp 0x17ead1
xorl %r12d, %r12d
movq (%rsp), %rdi
leaq 0x1df988(%rip), %rsi    # 0x35e43e
leaq 0x216f23(%rip), %rdx    # 0x3959e0
leaq 0x216d9c(%rip), %rcx    # 0x395860
leaq 0x216d23(%rip), %r8     # 0x3957ee
movl $0x107, %r9d            # imm = 0x107
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x17e9fd
movq %r13, %rdi
movq %r15, %rsi
callq 0xd25cb
testl %eax, %eax
je 0x17eb1c
xorl %r12d, %r12d
movq (%rsp), %rdi
leaq 0x1df93f(%rip), %rsi    # 0x35e43e
leaq 0x216f51(%rip), %rdx    # 0x395a57
leaq 0x216d53(%rip), %rcx    # 0x395860
leaq 0x216cda(%rip), %r8     # 0x3957ee
movl $0x109, %r9d            # imm = 0x109
jmp 0x17ead1
movq %r13, %rdi
movq %rbx, %rsi
callq 0xd25cb
testl %eax, %eax
je 0x17eb59
xorl %r12d, %r12d
movq (%rsp), %rdi
leaq 0x1df905(%rip), %rsi    # 0x35e43e
leaq 0x216f47(%rip), %rdx    # 0x395a87
leaq 0x216d19(%rip), %rcx    # 0x395860
leaq 0x216ca0(%rip), %r8     # 0x3957ee
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x17ead1
xorl %ebp, %ebp
movb $0x1, %r12b
jmp 0x17e9fd
callq 0x570bf