// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rdi, (%rsp)
testq %rdx, %rdx
je 0x16136b
movq %rdx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x161485
testq %r14, %r14
je 0x161480
movq 0x18(%rbx), %r15
movq %r14, %rdi
callq 0x142988
movq %r15, %rdi
movq %rax, %rsi
callq 0x100add
testq %rax, %rax
je 0x161457
movq %rax, %r15
movq %rax, %rdi
callq 0x142988
movq %rax, %r12
movq %r14, %rdi
callq 0x142988
cmpq %rax, %r12
jne 0x16148a
movq %r15, %rdi
callq 0x144679
leaq 0x18(%rsp), %r12
movq %rax, (%r12)
movq %rdx, 0x8(%r12)
movq %r14, %rdi
callq 0x144679
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r12, %rdi
callq 0x112130
testl %eax, %eax
jg 0x16148f
movq 0x20(%rsp), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jne 0x16143c
movq %r15, %rdi
callq 0x14392f
testq %rax, %rax
jne 0x16143c
movq %r14, %rdi
callq 0x14392f
testq %rax, %rax
jne 0x16143c
movq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x1431f8
movq %r15, %rdi
callq 0x143264
movq 0x20(%rbx), %rdi
movq %rsp, %rsi
movl $0x8, %edx
callq 0xd2410
movq 0x18(%rbx), %r14
movq %r15, %rdi
callq 0x142988
movq %r14, %rdi
movq %rax, %rsi
callq 0x100b56
movq (%rsp), %r14
movq 0x18(%rbx), %rbx
movq %r14, %rdi
callq 0x142988
movq (%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x100b18
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x4d2bb
callq 0x4d216
callq 0x4d24d
callq 0x4d284