// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/consensus_sa.c
// Function: compatible
static bool compatible(const ConsensusSA *csa,
                       GtUword sa_1, GtUword sa_2)
{
  GtArray *exons_sa_1, *exons_sa_2;
  GtRange range_sa_1, range_sa_2;
  GtUword i, j, num_of_exons_1, num_of_exons_2,
                start_1 = GT_UNDEF_UWORD, start_2 = GT_UNDEF_UWORD;
  bool start_values_set = false;
  const GtUword fuzzlength = 0; /* XXX */

  gt_assert(csa);

  /* check strands */
  if (extract_strand(csa, sa_1) != extract_strand(csa, sa_2)) return false;

  /* init */
  exons_sa_1 = gt_array_new(sizeof (GtRange));
  exons_sa_2 = gt_array_new(sizeof (GtRange));

  /* get ranges */
  range_sa_1 = extract_genomic_range(csa, sa_1);
  range_sa_2 = extract_genomic_range(csa, sa_2);

  if (!gt_range_overlap(&range_sa_1, &range_sa_2)) {
    gt_array_delete(exons_sa_1);
    gt_array_delete(exons_sa_2);
    return false;
  }

  /* get exons */
  extract_exons(csa, exons_sa_1, sa_1);
  extract_exons(csa, exons_sa_2, sa_2);

  /* determine the first overlapping exon pair */
  i = 0;
  j = 0;
  num_of_exons_1 = gt_array_size(exons_sa_1);
  num_of_exons_2 = gt_array_size(exons_sa_2);
  while (i < num_of_exons_1 && j < num_of_exons_2) {
    if (gt_range_overlap(gt_array_get(exons_sa_1, i),
                         gt_array_get(exons_sa_2, j))) {
      start_1 = i;
      start_2 = j;
      start_values_set = true;
      break;
    }
    if (((GtRange*) gt_array_get(exons_sa_1, i))->start <
        ((GtRange*) gt_array_get(exons_sa_2, j))->start) {
      i++;
    }
    else
      j++;
  }
  if (!start_values_set) {
    gt_array_delete(exons_sa_1);
    gt_array_delete(exons_sa_2);
    return false;
  }
  /* from now on the start values are set */

  gt_assert(start_1 != GT_UNDEF_UWORD && start_2 != GT_UNDEF_UWORD);
  if (!(start_1 == 0 || start_2 == 0)) {
    /* no first segment could be maped */
    gt_array_delete(exons_sa_1);
    gt_array_delete(exons_sa_2);
    return false;
  }

  while (start_1 < num_of_exons_1 && start_2 < num_of_exons_2) {
    range_sa_1 = *((GtRange*) gt_array_get(exons_sa_1, start_1));
    range_sa_2 = *((GtRange*) gt_array_get(exons_sa_2, start_2));

    if (gt_range_overlap(&range_sa_1, &range_sa_2)) {
      /* analyze acceptor sites */

      /* see if at least one exon has a acceptor site (on the left).
         in this case additional checks have to be performed.
         Otherwise, this exons are compatible (on the left side)
         because they overlap */
      if (has_acceptor_site(exons_sa_1, start_1) ||
          has_acceptor_site(exons_sa_2, start_2)) {
        if (has_acceptor_site(exons_sa_1, start_1) &&
            has_acceptor_site(exons_sa_2, start_2) &&
            range_sa_1.start!= range_sa_2.start) {
          /* the acceptor sites are different */
          gt_array_delete(exons_sa_1);
          gt_array_delete(exons_sa_2);
          return false;
        }
        else if (has_acceptor_site(exons_sa_1, start_1) &&
                 range_sa_2.start + fuzzlength < range_sa_1.start) {
          /* not within fuzzlength */
          gt_array_delete(exons_sa_1);
          gt_array_delete(exons_sa_2);
          return false;
        }
        else if (has_acceptor_site(exons_sa_2, start_2) &&
                 range_sa_1.start + fuzzlength < range_sa_2.start) {
          /* not within fuzzlength */
          gt_array_delete(exons_sa_1);
          gt_array_delete(exons_sa_2);
          return false;
        }
      }
      /* analyze donor sites */

      /* see if at least one exon has a donor site (on the right).
         in this case additional checks have to be performed.
         Otherwise, this exons are compatible (on the right side)
         because they overlap */
      if (has_donor_site(exons_sa_1, start_1) ||
          has_donor_site(exons_sa_2, start_2)) {
        if (has_donor_site(exons_sa_1, start_1) &&
            has_donor_site(exons_sa_2, start_2) &&
            range_sa_1.end != range_sa_2.end) {
          /* the donor sites are different */
          gt_array_delete(exons_sa_1);
          gt_array_delete(exons_sa_2);
          return false;
        }
        else if (has_donor_site(exons_sa_1, start_1) &&
                 range_sa_2.end - fuzzlength > range_sa_1.end) {
          /* not within fuzzlength */
          gt_array_delete(exons_sa_1);
          gt_array_delete(exons_sa_2);
          return false;
        }
        else if (has_donor_site(exons_sa_2, start_2) &&
                 range_sa_1.end - fuzzlength > range_sa_2.end) {
          /* not within fuzzlength */
          gt_array_delete(exons_sa_1);
          gt_array_delete(exons_sa_2);
          return false;
        }
      }
    }
    else {
      /* no overlap: two ordered segments do not overlap each other */
      gt_array_delete(exons_sa_1);
      gt_array_delete(exons_sa_2);
      return false;
    }
    start_1++;
    start_2++;
  }

  /* passed all tests */
  gt_array_delete(exons_sa_1);
  gt_array_delete(exons_sa_2);
  return true;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movq %rsi, 0xc0(%rsp)
movq %rdx, 0xb8(%rsp)
movq $-0x1, 0x60(%rsp)
movq $-0x1, 0x58(%rsp)
movb $0x0, 0x57(%rsp)
movq $0x0, 0x48(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0x15c462
movq 0x57ba7(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1c2b(%rip), %rsi      # 0x15e066
leaq 0x31d3f(%rip), %rdx     # 0x18e181
leaq 0x3329a(%rip), %rcx     # 0x18f6e3
leaq 0x330d5(%rip), %r8      # 0x18f525
movl $0x7b, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x15c464
movq 0xc8(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x15cb50
movl %eax, 0x24(%rsp)
movq 0xc8(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x15cb50
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl %ecx, %eax
je 0x15c4a9
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movl $0x10, %edi
callq 0x75ab0
movq %rax, 0xb0(%rsp)
movl $0x10, %edi
callq 0x75ab0
movq %rax, 0xa8(%rsp)
movq 0xc8(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x15c330
movq %rax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xc8(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x15c330
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x93c40
testb $0x1, %al
jne 0x15c57f
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movq 0xc8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xc0(%rsp), %rdx
callq 0x15cc40
movq 0xc8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0xb8(%rsp), %rdx
callq 0x15cc40
movq $0x0, 0x80(%rsp)
movq $0x0, 0x78(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x76490
movq %rax, 0x70(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x76490
movq %rax, 0x68(%rsp)
movq 0x80(%rsp), %rcx
xorl %eax, %eax
cmpq 0x70(%rsp), %rcx
movb %al, 0x23(%rsp)
jae 0x15c618
movq 0x78(%rsp), %rax
cmpq 0x68(%rsp), %rax
setb %al
movb %al, 0x23(%rsp)
movb 0x23(%rsp), %al
testb $0x1, %al
jne 0x15c625
jmp 0x15c6e7
movq 0xb0(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x75c80
movq %rax, 0x18(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x75c80
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x93c40
testb $0x1, %al
jne 0x15c664
jmp 0x15c682
movq 0x80(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x58(%rsp)
movb $0x1, 0x57(%rsp)
jmp 0x15c6e7
movq 0xb0(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x75c80
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x75c80
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq (%rcx), %rax
jae 0x15c6d4
movq 0x80(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80(%rsp)
jmp 0x15c6e2
movq 0x78(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x78(%rsp)
jmp 0x15c5f2
testb $0x1, 0x57(%rsp)
jne 0x15c715
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
jmp 0x15c717
cmpq $-0x1, 0x60(%rsp)
je 0x15c727
cmpq $-0x1, 0x58(%rsp)
jne 0x15c75f
movq 0x578aa(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x192e(%rip), %rsi      # 0x15e066
leaq 0x32faf(%rip), %rdx     # 0x18f6ee
leaq 0x32f9d(%rip), %rcx     # 0x18f6e3
leaq 0x32dd8(%rip), %r8      # 0x18f525
movl $0xad, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x15c761
cmpq $0x0, 0x60(%rsp)
je 0x15c798
cmpq $0x0, 0x58(%rsp)
je 0x15c798
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
jmp 0x15c79a
movq 0x60(%rsp), %rcx
xorl %eax, %eax
cmpq 0x70(%rsp), %rcx
movb %al, 0xf(%rsp)
jae 0x15c7bd
movq 0x58(%rsp), %rax
cmpq 0x68(%rsp), %rax
setb %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x15c7ca
jmp 0x15cb12
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x75c80
movq (%rax), %rcx
movq %rcx, 0x98(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x75c80
movq (%rax), %rcx
movq %rcx, 0x88(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x93c40
testb $0x1, %al
jne 0x15c83a
jmp 0x15cacd
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x15cd80
testb $0x1, %al
jne 0x15c86b
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x15cd80
testb $0x1, %al
jne 0x15c86b
jmp 0x15c984
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x15cd80
testb $0x1, %al
jne 0x15c883
jmp 0x15c8d4
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x15cd80
testb $0x1, %al
jne 0x15c89b
jmp 0x15c8d4
movq 0x98(%rsp), %rax
cmpq 0x88(%rsp), %rax
je 0x15c8d4
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x15cd80
testb $0x1, %al
jne 0x15c8ec
jmp 0x15c929
movq 0x88(%rsp), %rax
addq $0x0, %rax
cmpq 0x98(%rsp), %rax
jae 0x15c929
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x15cd80
testb $0x1, %al
jne 0x15c941
jmp 0x15c97e
movq 0x98(%rsp), %rax
addq $0x0, %rax
cmpq 0x88(%rsp), %rax
jae 0x15c97e
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
jmp 0x15c980
jmp 0x15c982
jmp 0x15c984
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x15ce10
testb $0x1, %al
jne 0x15c9b5
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x15ce10
testb $0x1, %al
jne 0x15c9b5
jmp 0x15cacb
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x15ce10
testb $0x1, %al
jne 0x15c9cd
jmp 0x15ca1e
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x15ce10
testb $0x1, %al
jne 0x15c9e5
jmp 0x15ca1e
movq 0xa0(%rsp), %rax
cmpq 0x90(%rsp), %rax
je 0x15ca1e
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movq 0xb0(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x15ce10
testb $0x1, %al
jne 0x15ca36
jmp 0x15ca73
movq 0x90(%rsp), %rax
subq $0x0, %rax
cmpq 0xa0(%rsp), %rax
jbe 0x15ca73
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x15ce10
testb $0x1, %al
jne 0x15ca8b
jmp 0x15cac5
movq 0xa0(%rsp), %rax
subq $0x0, %rax
cmpq 0x90(%rsp), %rax
jbe 0x15cac5
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
jmp 0x15cac7
jmp 0x15cac9
jmp 0x15cacb
jmp 0x15caf1
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x0, 0xd7(%rsp)
jmp 0x15cb34
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x15c79a
movq 0xb0(%rsp), %rdi
callq 0x770a0
movq 0xa8(%rsp), %rdi
callq 0x770a0
movb $0x1, 0xd7(%rsp)
movb 0xd7(%rsp), %al
andb $0x1, %al
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)