// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/stream_evaluator.c
// Function: genes_are_equal
static bool genes_are_equal(GtGenomeNode *gn_1, GtGenomeNode *gn_2,
                            const char *feature_type)
{
  GtArray *exons_1, *exons_2, *mRNAs_1, *mRNAs_2;
  StoreGeneFeatureInfo info;
  GtUword i;
  bool equal;
  GT_UNUSED int had_err;

  gt_assert(gn_1 && gn_2 && feature_type);

  /* init */
  exons_1 = gt_array_new(sizeof (GtRange));
  exons_2 = gt_array_new(sizeof (GtRange));
  mRNAs_1 = gt_array_new(sizeof (GtGenomeNode*));
  mRNAs_2 = gt_array_new(sizeof (GtGenomeNode*));

  /* get (direct) gene features */
  info.exons = exons_1;
  info.mRNAs = mRNAs_1;
  info.feature_type = feature_type;
  had_err = gt_feature_node_traverse_direct_children(gt_feature_node_cast(gn_1),
                                                     &info, store_gene_feature,
                                                     NULL);
  gt_assert(!had_err); /* cannot happen, store_gene_feature() is sane */
  info.exons = exons_2;
  info.mRNAs = mRNAs_2;
  had_err = gt_feature_node_traverse_direct_children(gt_feature_node_cast(gn_2),
                                                     &info, store_gene_feature,
                                                     NULL);
  gt_assert(!had_err); /* cannot happen, store_gene_feature() is sane */

  /* sort exon ranges */
  gt_ranges_sort(exons_1);
  gt_ranges_sort(exons_2);

  /* compare exon ranges */
  equal = gt_ranges_are_equal(exons_1, exons_2);

  /* compare mRNAs, if necessary */
  if (equal && gt_array_size(mRNAs_1) == gt_array_size(mRNAs_2)) {
    /* sort mRNAs */
    gt_genome_nodes_sort(mRNAs_1);
    gt_genome_nodes_sort(mRNAs_2);
    for (i = 0; i < gt_array_size(mRNAs_1); i++) {
      gt_assert(equal);
      equal = mRNAs_are_equal(*(GtGenomeNode**) gt_array_get(mRNAs_1, i),
                              *(GtGenomeNode**) gt_array_get(mRNAs_2, i),
                              feature_type);
      if (!equal)
        break;
    }
  }

  /* free */
  gt_array_delete(exons_1);
  gt_array_delete(exons_2);
  gt_array_delete(mRNAs_1);
  gt_array_delete(mRNAs_2);

  return equal;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
je 0x8db95
testq %rsi, %rsi
je 0x8db95
movq %rdx, %rbx
testq %rdx, %rdx
je 0x8db95
movq %rdi, %r14
movq %rsi, 0x18(%rsp)
pushq $0x10
popq %r15
movq %r15, %rdi
callq 0x4b380
movq %rax, %rbp
movq %r15, %rdi
callq 0x4b380
movq %rax, 0x8(%rsp)
pushq $0x8
popq %r13
movq %r13, %rdi
callq 0x4b380
movq %rax, %r12
movq %r13, %rdi
callq 0x4b380
movq %rax, %r13
leaq 0x20(%rsp), %r15
movq %rbp, (%rsp)
movq %rbp, (%r15)
movq %r12, 0x8(%r15)
movq %rbx, 0x10(%rsp)
movq %rbx, 0x10(%r15)
movq %r14, %rdi
callq 0x18df7
leaq 0x88c(%rip), %rdx       # 0x8e308
movq %rax, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x1ae00
testl %eax, %eax
jne 0x8dbc3
leaq 0x20(%rsp), %r14
movq 0x8(%rsp), %rbx
movq %rbx, (%r14)
movq %r13, 0x8(%r14)
movq 0x18(%rsp), %rdi
callq 0x18df7
leaq 0x855(%rip), %rdx       # 0x8e308
movq %rax, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x1ae00
testl %eax, %eax
jne 0x8dbf1
movq (%rsp), %r14
movq %r14, %rdi
callq 0x5db48
movq %rbx, %rdi
callq 0x5db48
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5dd87
testb %al, %al
je 0x8db5f
movq %r12, %rdi
callq 0x4b988
movq %rax, %r14
movq %r13, %rdi
callq 0x4b988
movb $0x1, %bpl
cmpq %rax, %r14
movq 0x10(%rsp), %rbx
jne 0x8db61
movq %r12, %rdi
callq 0x1c752
movq %r13, %rdi
callq 0x1c752
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x4b988
cmpq %rax, %r14
setae %bpl
jae 0x8db61
movq %r12, %rdi
movq %r14, %rsi
callq 0x4b48e
movq (%rax), %r15
movq %r13, %rdi
movq %r14, %rsi
callq 0x4b48e
movq (%rax), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x8dc29
incq %r14
testb %al, %al
jne 0x8db1e
jmp 0x8db61
xorl %ebp, %ebp
movq (%rsp), %rdi
callq 0x4c19d
movq 0x8(%rsp), %rdi
callq 0x4c19d
movq %r12, %rdi
callq 0x4c19d
movq %r13, %rdi
callq 0x4c19d
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa041c(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x3c4c0(%rip), %rsi     # 0xca066
leaq 0x57ffd(%rip), %rdx     # 0xe5baa
leaq 0x58013(%rip), %rcx     # 0xe5bc7
leaq 0x57855(%rip), %r8      # 0xe5410
movl $0x28f, %r9d            # imm = 0x28F
jmp 0x8dc1d
movq 0xa03ee(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x3c492(%rip), %rsi     # 0xca066
leaq 0x3ca38(%rip), %rdx     # 0xca613
leaq 0x57fe5(%rip), %rcx     # 0xe5bc7
leaq 0x57827(%rip), %r8      # 0xe5410
movl $0x29e, %r9d            # imm = 0x29E
jmp 0x8dc1d
movq 0xa03c0(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x3c464(%rip), %rsi     # 0xca066
leaq 0x3ca0a(%rip), %rdx     # 0xca613
leaq 0x57fb7(%rip), %rcx     # 0xe5bc7
leaq 0x577f9(%rip), %r8      # 0xe5410
movl $0x2a4, %r9d            # imm = 0x2A4
xorl %eax, %eax
callq 0xb8c0
callq 0xb300