// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/feature_node.c
// Function: gt_feature_node_traverse_children
int gt_feature_node_traverse_children(GtFeatureNode *feature_node, void *data,
                                      GtFeatureNodeTraverseFunc traverse,
                                      bool traverse_only_once, GtError *err)
{
  GtArray *node_stack = NULL, *list_of_children;
  GtFeatureNode *fn, *fn_ref, *child_feature;
  GtDlistelem *dlistelem;
  GtUword i;
  GtHashtable *traversed_nodes = NULL;
  bool has_node_with_multiple_parents = false;
  int had_err = 0;

  if (!feature_node)
    return 0;

  /* create additional reference to <feature_node> (necessary if feature_node is
     freed by <traverse>) */
  fn_ref = (GtFeatureNode*) gt_genome_node_ref((GtGenomeNode*) feature_node);

  node_stack = gt_array_new(sizeof (GtFeatureNode*));
  if (gt_feature_node_is_pseudo(feature_node)) {
    /* add the children backwards to traverse in order */
    for (dlistelem = gt_dlist_last(feature_node->children);
         dlistelem != NULL;
         dlistelem = gt_dlistelem_previous(dlistelem)) {
      child_feature = (GtFeatureNode*) gt_dlistelem_get_data(dlistelem);
      gt_array_add(node_stack, child_feature);
    }
  }
  else
    gt_array_add(node_stack, feature_node);
  gt_assert(gt_array_size(node_stack));
  list_of_children = gt_array_new(sizeof (GtFeatureNode*));

  if (traverse_only_once) {
    static const HashElemInfo node_hashtype
      = { gt_ht_ptr_elem_hash, { NULL }, sizeof (GtFeatureNode *),
          gt_ht_ptr_elem_cmp, NULL, NULL };
    traversed_nodes = gt_hashtable_new(node_hashtype);
  }

  while (gt_array_size(node_stack)) {
    fn = *(GtFeatureNode**) gt_array_pop(node_stack);
    gt_array_reset(list_of_children);
    if (fn->children) {
      /* a backup of the children array is necessary if traverse() frees the
         node */
      for (dlistelem = gt_dlist_first(fn->children); dlistelem != NULL;
           dlistelem = gt_dlistelem_next(dlistelem)) {
        child_feature = (GtFeatureNode*) gt_dlistelem_get_data(dlistelem);
        gt_array_add(list_of_children, child_feature);
      }
    }
    /* store the implications of <fn> to the tree status of <feature_node> */
    if (multiple_parents(fn->bit_field))
      has_node_with_multiple_parents = true;
    /* call traverse function */
    if (traverse) {
      if ((had_err = traverse(fn, data, err)))
        break;
    }
    for (i = 0; i < gt_array_size(list_of_children); i++) {
      /* we go backwards to traverse in order */
      child_feature = *(GtFeatureNode**) gt_array_get(list_of_children,
                                       gt_array_size(list_of_children) - i - 1);
      if (!traverse_only_once ||
          !gt_hashtable_get(traversed_nodes, &child_feature)) {
        /* feature has not been traversed or has to be traversed multiple
           times */
        gt_array_add(node_stack, child_feature);
        if (traverse_only_once)
          gt_hashtable_add(traversed_nodes, &child_feature);
      }
    }
  }

  /* save the tree status of the genome node */
  if (!had_err) {
    if (has_node_with_multiple_parents) {
      set_tree_status(&fn_ref->bit_field, IS_NOT_A_TREE);
      gt_assert(get_tree_status(fn_ref->bit_field) == IS_NOT_A_TREE);
    }
    else {
      set_tree_status(&fn_ref->bit_field, IS_TREE);
      gt_assert(get_tree_status(fn_ref->bit_field) ==IS_TREE);
    }
  }

  /* free */
  gt_genome_node_delete((GtGenomeNode*) fn_ref);
  if (traverse_only_once)
    gt_hashtable_delete(traversed_nodes);
  gt_array_delete(list_of_children);
  gt_array_delete(node_stack);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, 0x50(%rsp)
testq %rdi, %rdi
je 0x40724
movl %ecx, %ebx
movq %rdx, 0x40(%rsp)
callq 0x41ca0
movq %rax, %rbp
movl $0x8, %edi
callq 0x6e93c
movq %rax, %r14
movq 0x50(%rsp), %rdi
callq 0x40459
testb %al, %al
je 0x4072c
movq 0x50(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x72d40
testq %rax, %rax
je 0x4073e
movq %rax, %r15
leaq 0x38(%rsp), %r12
movq %r15, %rdi
callq 0x72dac
movq %rax, 0x38(%rsp)
movl $0x8, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x6ec0e
movq %r15, %rdi
callq 0x73b87
movq %rax, %r15
testq %rax, %rax
jne 0x406f5
jmp 0x4073e
xorl %r13d, %r13d
jmp 0x4095e
leaq 0x50(%rsp), %rsi
movl $0x8, %edx
movq %r14, %rdi
callq 0x6ec0e
movq %r14, %rdi
callq 0x6ecda
testq %rax, %rax
je 0x40970
movl $0x8, %edi
callq 0x6e93c
movq %rax, %r15
xorl %r13d, %r13d
testb %bl, %bl
je 0x40792
movups 0x10e196(%rip), %xmm0   # 0x14e900
movups %xmm0, 0x20(%rsp)
movups 0x10e17a(%rip), %xmm0   # 0x14e8f0
movups %xmm0, 0x10(%rsp)
movups 0x10e15e(%rip), %xmm0   # 0x14e8e0
movups %xmm0, (%rsp)
callq 0x777ac
movq %rax, 0x30(%rsp)
jmp 0x4079b
movq $0x0, 0x30(%rsp)
movq 0x40(%rsp), %r12
movq %r14, %rdi
callq 0x6ecda
testq %rax, %rax
je 0x4090a
movq %rbp, 0x58(%rsp)
movq $0x0, 0x48(%rsp)
leaq 0x38(%rsp), %rbp
movq %r14, %rdi
callq 0x6ea35
movq (%rax), %r13
movq %r15, %rdi
callq 0x6ed13
movq %r13, 0x70(%rsp)
movq 0x70(%r13), %rdi
testq %rdi, %rdi
je 0x4081f
callq 0x72d30
testq %rax, %rax
je 0x4081f
movq %rax, %r13
movq %r13, %rdi
callq 0x72dac
movq %rax, 0x38(%rsp)
movl $0x8, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x6ec0e
movq %r13, %rdi
callq 0x72dbc
movq %rax, %r13
testq %rax, %rax
jne 0x407f2
movq 0x70(%rsp), %rdi
movl 0x68(%rdi), %eax
andl $0x6, %eax
cmpl $0x4, %eax
movq 0x48(%rsp), %rax
movzbl %al, %eax
movl $0x1, %ecx
cmovel %ecx, %eax
movq %rax, 0x48(%rsp)
testq %r12, %r12
je 0x4085c
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq *%r12
testl %eax, %eax
jne 0x40911
movq %r15, %rdi
callq 0x6ecda
testq %rax, %rax
je 0x408ef
movq $-0x1, %r13
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x6ecda
leaq (%rax,%r13), %rsi
movq %r15, %rdi
callq 0x6e9fa
movq (%rax), %rax
movq %rax, 0x38(%rsp)
testb %bl, %bl
je 0x408cc
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x77906
testq %rax, %rax
jne 0x408dc
movl $0x8, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x6ec0e
testb %bl, %bl
je 0x408dc
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x7799a
jmp 0x408dc
movl $0x8, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x6ec0e
incq %r12
movq %r15, %rdi
callq 0x6ecda
decq %r13
cmpq %rax, %r12
jb 0x40877
movq %r14, %rdi
callq 0x6ecda
testq %rax, %rax
movq 0x40(%rsp), %r12
jne 0x407c4
xorl %r13d, %r13d
jmp 0x40914
movl $0x8, %eax
jmp 0x40928
movl %eax, %r13d
movzbl 0x48(%rsp), %eax
andl $0x1, %eax
leal 0x8(,%rax,8), %eax
movq 0x58(%rsp), %rbp
testl %r13d, %r13d
jne 0x40938
movl 0x68(%rbp), %ecx
andl $-0x19, %ecx
orl %eax, %ecx
movl %ecx, 0x68(%rbp)
movq %rbp, %rdi
callq 0x42ade
testb %bl, %bl
je 0x4094e
movq 0x30(%rsp), %rdi
callq 0x78408
movq %r15, %rdi
callq 0x6f134
movq %r14, %rdi
callq 0x6f134
movl %r13d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x10099