// File: /workspace/github_c_makefile_star2_O2/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, 0x60(%rsp)
movl %ecx, 0x34(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdi, 0x70(%rsp)
testq %rdi, %rdi
je 0x19f11
movq %rdi, %r15
movq %rdx, 0x68(%rsp)
callq 0x1bec8
movq %rax, %rbx
pushq $0x8
popq %rdi
callq 0x4b380
movq %rax, %r14
movq %r15, %rdi
callq 0x19959
testb %al, %al
je 0x19f19
movq 0x70(%r15), %rdi
callq 0x50621
movq %rax, %r13
leaq 0x40(%rsp), %r15
pushq $0x8
popq %r12
testq %r13, %r13
je 0x19f29
movq %r13, %rdi
callq 0x506e7
movq %rax, 0x40(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4b801
movq %r13, %rdi
callq 0x5165e
movq %rax, %r13
jmp 0x19ee4
xorl %r12d, %r12d
jmp 0x1a113
leaq 0x70(%rsp), %rsi
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x4b801
movq %r14, %rdi
callq 0x4b988
testq %rax, %rax
je 0x1a125
pushq $0x8
popq %rdi
callq 0x4b380
movq %rax, %r15
cmpb $0x0, 0x34(%rsp)
movq %rbx, 0x50(%rsp)
je 0x19f80
movups 0x111988(%rip), %xmm0   # 0x12b8e0
movups %xmm0, 0x20(%rsp)
movups 0x11196c(%rip), %xmm0   # 0x12b8d0
movups %xmm0, 0x10(%rsp)
movups 0x111950(%rip), %xmm0   # 0x12b8c0
movups %xmm0, (%rsp)
callq 0x5653b
movq %rax, 0x38(%rsp)
jmp 0x19f89
movq $0x0, 0x38(%rsp)
movq $0x0, 0x48(%rsp)
leaq 0x40(%rsp), %rbp
pushq $0x8
popq %r13
movq %r14, %rdi
callq 0x4b988
testq %rax, %rax
je 0x1a0c1
movq %r14, %rbx
movq %r14, %rdi
callq 0x4b52b
movq (%rax), %r14
movq %r15, %rdi
callq 0x4ba50
movq %r14, %r12
movq 0x70(%r14), %rdi
testq %rdi, %rdi
je 0x1a000
callq 0x505e0
movq %rax, %r14
testq %rax, %rax
je 0x1a000
movq %r14, %rdi
callq 0x506e7
movq %rax, 0x40(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4b801
movq %r14, %rdi
callq 0x5072a
jmp 0x19fd3
movl 0x68(%r12), %eax
andl $0x6, %eax
cmpl $0x4, %eax
sete %r14b
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x1a030
movq %r12, %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq *%rax
testl %eax, %eax
jne 0x1a0e2
movq 0x48(%rsp), %rax
orb %r14b, %al
movq %rax, 0x48(%rsp)
pushq $-0x1
popq %r14
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x4b988
cmpq %rax, %r12
jae 0x1a0b9
movq %r15, %rdi
callq 0x4b988
leaq (%rax,%r14), %rsi
movq %r15, %rdi
callq 0x4b48e
movq (%rax), %rax
movq %rax, 0x40(%rsp)
cmpb $0x0, 0x34(%rsp)
je 0x1a0a3
movq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x565c1
testq %rax, %rax
jne 0x1a0b1
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4b801
movq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x56680
jmp 0x1a0b1
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4b801
incq %r12
decq %r14
jmp 0x1a044
movq %rbx, %r14
jmp 0x19f9b
movq 0x50(%rsp), %rdi
movl 0x68(%rdi), %eax
andl $-0x19, %eax
movzbl 0x48(%rsp), %ecx
andl $0x1, %ecx
leal (%rax,%rcx,8), %eax
addl $0x8, %eax
movl %eax, 0x68(%rdi)
xorl %r12d, %r12d
jmp 0x1a0ed
movl %eax, %r12d
movq %rbx, %r14
movq 0x50(%rsp), %rdi
callq 0x1d1e3
cmpb $0x0, 0x34(%rsp)
je 0x1a103
movq 0x38(%rsp), %rdi
callq 0x572a1
movq %r15, %rdi
callq 0x4c19d
movq %r14, %rdi
callq 0x4c19d
movl %r12d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x113e8c(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xaff30(%rip), %rsi     # 0xca066
leaq 0xb419e(%rip), %rdx     # 0xce2db
leaq 0xb41b1(%rip), %rcx     # 0xce2f5
leaq 0xb39ed(%rip), %r8      # 0xcdb38
movl $0x385, %r9d            # imm = 0x385
xorl %eax, %eax
callq 0xb8c0
callq 0xb300