// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/merge_feature_visitor.c
// Function: mergefeat_in_children
static int mergefeat_in_children(GtFeatureNode *current_feature, void *data,
                                 GT_UNUSED GtError *err)
{
  GtMergeFeatureVisitor *v = (GtMergeFeatureVisitor*) data;
  GtFeatureNode *previous_feature;
  GtRange previous_range, current_range;
  gt_error_check(err);
  gt_assert(current_feature);
  if ((previous_feature =
        gt_hashmap_get(v->hm, gt_feature_node_get_type(current_feature)))) {
    /* previous feature found -> check if merging is necessary */
    gt_assert(gt_feature_node_get_type(previous_feature) ==
              gt_feature_node_get_type(current_feature));
    previous_range = gt_genome_node_get_range((GtGenomeNode*)
                                              previous_feature);
    current_range = gt_genome_node_get_range((GtGenomeNode*) current_feature);
    /* sorted */
    gt_assert(gt_range_compare(&previous_range, &current_range) <= 0);
    /* merge only adjacent features without children */
    if (previous_range.end + 1 == current_range.start &&
        !gt_feature_node_number_of_children(previous_feature) &&
        !gt_feature_node_number_of_children(current_feature)) {
      /* merge nodes */
      gt_feature_node_set_end(previous_feature, current_range.end);
      /* XXX: compute average score ? */
      gt_feature_node_unset_score(previous_feature);
      gt_array_add(v->nodes_to_remove, current_feature);
    }
    /* remove previous feature */
    gt_hashmap_remove(v->hm, gt_feature_node_get_type(previous_feature));
  }
  /* add current feature */
  gt_hashmap_add(v->hm, (char*) gt_feature_node_get_type(current_feature),
                 current_feature);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
testq %rdx, %rdx
je 0x169193
movq %rdx, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1692b2
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1692ad
movq 0x18(%rbx), %r14
callq 0x149bb2
movq %r14, %rdi
movq %rax, %rsi
callq 0x105a11
testq %rax, %rax
je 0x169283
movq %rax, %r14
movq %rax, %rdi
callq 0x149bb2
movq %rax, %r15
movq 0x8(%rsp), %rdi
callq 0x149bb2
cmpq %rax, %r15
jne 0x1692b7
movq %r14, %rdi
callq 0x14b8df
leaq 0x20(%rsp), %r15
movq %rax, (%r15)
movq %rdx, 0x8(%r15)
movq 0x8(%rsp), %rdi
callq 0x14b8df
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r15, %rdi
callq 0x117710
testl %eax, %eax
jg 0x1692bc
movq 0x28(%rsp), %rax
incq %rax
cmpq 0x10(%rsp), %rax
jne 0x16926c
movq %r14, %rdi
callq 0x14ab80
testq %rax, %rax
jne 0x16926c
movq 0x8(%rsp), %rdi
callq 0x14ab80
testq %rax, %rax
jne 0x16926c
movq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x14a42a
movq %r14, %rdi
callq 0x14a499
movq 0x20(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
callq 0xd49ce
movq 0x18(%rbx), %r15
movq %r14, %rdi
callq 0x149bb2
movq %r15, %rdi
movq %rax, %rsi
callq 0x105a8a
movq 0x18(%rbx), %rbx
movq 0x8(%rsp), %rdi
callq 0x149bb2
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x105a4c
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x4e177
callq 0x4e0d2
callq 0x4e109
callq 0x4e140
nopl (%rax)