// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
movq %r8, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdi, 0x80(%rsp)
testq %rdi, %rdi
je 0x3fdc1
movl %ecx, %ebx
movq %rdi, %r15
movq %rdx, 0x50(%rsp)
callq 0x4130c
movq %rax, %rbp
movl $0x8, %edi
callq 0x6ef7c
movq %rax, %r14
movq %r15, %rdi
callq 0x3faf4
testb %al, %al
je 0x3fdc9
movq 0x70(%r15), %rdi
callq 0x73318
testq %rax, %rax
je 0x3fdde
movq %rax, %r15
leaq 0x48(%rsp), %r12
movq %r15, %rdi
callq 0x73384
movq %rax, 0x48(%rsp)
movl $0x8, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x6f240
movq %r15, %rdi
callq 0x74122
movq %rax, %r15
testq %rax, %rax
jne 0x3fd92
jmp 0x3fdde
xorl %r13d, %r13d
jmp 0x3fff5
leaq 0x80(%rsp), %rsi
movl $0x8, %edx
movq %r14, %rdi
callq 0x6f240
movq %r14, %rdi
callq 0x6f310
testq %rax, %rax
je 0x4000a
movl $0x8, %edi
callq 0x6ef7c
movq %rax, %r15
testb %bl, %bl
je 0x3fe2f
movups 0x10eaf9(%rip), %xmm0   # 0x14e900
movups %xmm0, 0x20(%rsp)
movups 0x10eadd(%rip), %xmm0   # 0x14e8f0
movups %xmm0, 0x10(%rsp)
movups 0x10eac1(%rip), %xmm0   # 0x14e8e0
movups %xmm0, (%rsp)
callq 0x77ca4
movq %rax, 0x40(%rsp)
jmp 0x3fe38
movq $0x0, 0x40(%rsp)
movq 0x50(%rsp), %r12
movq %r14, %rdi
callq 0x6f310
testq %rax, %rax
je 0x3ffad
movq %rbp, 0x58(%rsp)
xorl %r13d, %r13d
leaq 0x48(%rsp), %rbp
movq %r14, 0x60(%rsp)
movq %r13, 0x78(%rsp)
movq %r14, %rdi
callq 0x6f072
movq (%rax), %r13
movq %r15, %rdi
callq 0x6f349
movq %r13, %r14
movq 0x70(%r13), %rdi
testq %rdi, %rdi
je 0x3febe
callq 0x73308
testq %rax, %rax
je 0x3febe
movq %rax, %r13
movq %r13, %rdi
callq 0x73384
movq %rax, 0x48(%rsp)
movl $0x8, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x6f240
movq %r13, %rdi
callq 0x73394
movq %rax, %r13
testq %rax, %rax
jne 0x3fe91
movl 0x68(%r14), %eax
andl $0x6, %eax
cmpl $0x4, %eax
sete 0x3f(%rsp)
testq %r12, %r12
je 0x3feea
movq %r14, %rdi
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq *%r12
testl %eax, %eax
jne 0x3ffc2
movq 0x60(%rsp), %r12
movq %r15, %rdi
callq 0x6f310
testq %rax, %rax
je 0x3ff7a
movq $-0x1, %r13
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x6f310
leaq (%rax,%r13), %rsi
movq %r15, %rdi
callq 0x6f037
movq (%rax), %rax
movq %rax, 0x48(%rsp)
testb %bl, %bl
je 0x3ff57
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x77dfe
testq %rax, %rax
jne 0x3ff67
movl $0x8, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6f240
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x77e8a
jmp 0x3ff67
movl $0x8, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6f240
incq %r14
movq %r15, %rdi
callq 0x6f310
decq %r13
cmpq %rax, %r14
jb 0x3ff06
movq 0x78(%rsp), %r13
orb 0x3f(%rsp), %r13b
movq %r12, %r14
movq %r12, %rdi
callq 0x6f310
testq %rax, %rax
movq 0x50(%rsp), %r12
jne 0x3fe60
movl $0x10, %eax
testb $0x1, %r13b
movq 0x58(%rsp), %rbp
jne 0x3ffb2
movl $0x8, %eax
movl 0x68(%rbp), %ecx
andl $-0x19, %ecx
orl %eax, %ecx
movl %ecx, 0x68(%rbp)
xorl %r13d, %r13d
jmp 0x3ffcf
movl %eax, %r13d
movq 0x58(%rsp), %rbp
movq 0x60(%rsp), %r14
movq %rbp, %rdi
callq 0x4210c
testb %bl, %bl
je 0x3ffe5
movq 0x40(%rsp), %rdi
callq 0x788a0
movq %r15, %rdi
callq 0x6f768
movq %r14, %rdi
callq 0x6f768
movl %r13d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x10060