// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/annotationsketch/diagram.c
// Function: process_node
static int process_node(GtDiagram *d, GtFeatureNode *node,
                        GtFeatureNode *parent, GtError *err)
{
  GtRange elem_range;
  bool *collapse;
  GtShouldGroupByParent *group;
  const char *feature_type = NULL,
             *parent_gft = NULL;
  double tmp;
  GtStyleQueryStatus rval;
  GtUword max_show_width = GT_UNDEF_UWORD,
                par_max_show_width = GT_UNDEF_UWORD;

  gt_assert(d && node);

  gt_log_log(">> getting '%s'", gt_feature_node_get_type(node));

  /* skip pseudonodes */
  if (gt_feature_node_is_pseudo(node))
    return 0;

  feature_type = gt_feature_node_get_type(node);
  gt_assert(feature_type);

  /* discard elements that do not overlap with visible range */
  elem_range = gt_genome_node_get_range((GtGenomeNode*) node);
  if (!gt_range_overlap(&d->range, &elem_range))
    return 0;

  /* get maximal view widths in nucleotides to show this type */
  rval = gt_style_get_num(d->style, feature_type, "max_show_width", &tmp, NULL,
                          err);
  switch (rval) {
    case GT_STYLE_QUERY_OK:
      max_show_width = tmp;
      break;
    case GT_STYLE_QUERY_ERROR:
      return -1;
      break; /* should never be reached */
    default:
      /* do not change default value */
      break;
  }

  /* for non-root nodes, get maximal view with to show parent */
  if (parent)
  {
    if (!gt_feature_node_is_pseudo(parent))
    {
      parent_gft = gt_feature_node_get_type(parent);
      rval = gt_style_get_num(d->style,
                              parent_gft, "max_show_width",
                              &tmp, NULL, err);
      switch (rval) {
        case GT_STYLE_QUERY_OK:
          par_max_show_width = tmp;
          break;
        case GT_STYLE_QUERY_ERROR:
          return -1;
          break; /* should never be reached */
        default:
          /* do not change default value */
          break;
      }
    } else
      par_max_show_width = GT_UNDEF_UWORD;
  }

  /* check if this type is to be displayed at all */
  if (max_show_width != GT_UNDEF_UWORD &&
      gt_range_length(&d->range) > max_show_width)
  {
    return 0;
  }

  /* disregard parent node if it is configured not to be shown */
  if (parent
        && par_max_show_width != GT_UNDEF_UWORD
        && gt_range_length(&d->range) > par_max_show_width)
  {
    parent = NULL;
  }

  /* check if this is a collapsing type, cache result */
  if ((collapse = (bool*) gt_hashmap_get(d->collapsingtypes,
                                         feature_type)) == NULL)
  {
    collapse = gt_malloc(sizeof (bool));
    *collapse = false;
    if (gt_style_get_bool(d->style, feature_type, "collapse_to_parent",
                           collapse, NULL, err) == GT_STYLE_QUERY_ERROR) {
      gt_free(collapse);
      return -1;
    }
    gt_hashmap_add(d->collapsingtypes, (void*) feature_type, collapse);
  }

  /* check if type should be grouped by parent, cache result */
  if ((group = (GtShouldGroupByParent*) gt_hashmap_get(d->groupedtypes,
                                                       feature_type)) == NULL)
  {
    bool tmp;
    group = gt_malloc(sizeof (GtShouldGroupByParent));
    rval = gt_style_get_bool(d->style, feature_type, "group_by_parent",
                             &tmp, NULL, err);
    switch (rval) {
      case GT_STYLE_QUERY_OK:
        if (tmp)
          *group = GT_GROUP_BY_PARENT;
        else
          *group = GT_DO_NOT_GROUP_BY_PARENT;
        break;
      case GT_STYLE_QUERY_NOT_SET:
        *group = GT_UNDEFINED_GROUPING;
        break;
      case GT_STYLE_QUERY_ERROR:
        gt_free(group);
        return -1;
        break; /* should never be reached */
    }
    gt_hashmap_add(d->groupedtypes, (void*) feature_type, group);
  }

  /* decide where to place this feature: */
  if (*collapse)
  {
    /* user has specified collapsing to parent for this type */
    if (parent && !gt_feature_node_is_pseudo(parent)) {
      /* collapsing child nodes are added to upwards blocks,
         but never collapse into pseudo nodes */
      add_recursive(d, node, parent, node);
    } else {
      /* if no parent or only pseudo-parent, do not collapse */
      if (add_to_current(d, node, parent, err) < 0) {
        return -1;
      }
    }
  }
  else  /* (!*collapse) */
  {
    if (parent) {
      bool do_not_overlap = false;
      do_not_overlap = gt_feature_node_direct_children_do_not_overlap_st(parent,
                                                                         node);
      if (*group == GT_GROUP_BY_PARENT
          || (do_not_overlap && *group == GT_UNDEFINED_GROUPING))
      {
        if (gt_feature_node_is_pseudo(parent)
              && gt_feature_node_is_multi(node))
        {
          if (add_to_rep(d, node, parent, err) < 0) {
            return -1;
          }
        } else if
            (gt_feature_node_number_of_children(parent) > 1)
        {
          if (add_to_parent(d, node, parent, err) < 0) {
            return -1;
          }
        } else {
          if (add_to_current(d, node, parent, err) < 0) {
            return -1;
          }
        }
      } else {
        if (gt_feature_node_is_pseudo(parent)
              && gt_feature_node_is_multi(node))
        {
          if (add_to_rep(d, node, parent, err) < 0) {
            return -1;
          }
        } else {
          if (add_to_current(d, node, parent, err) < 0) {
            return -1;
          }
        }
      }
    } else {
      /* root nodes always get their own block */
      if (add_to_current(d, node, parent, err) < 0) {
        return -1;
      }
    }
  }

  /* we can now assume that this node has been processed into the reverse
     lookup structure */
#ifndef NDEBUG
  if (!gt_feature_node_is_multi(node))
    gt_assert(gt_hashmap_get(d->nodeinfo, node));
#endif

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rdi, %rdi
je 0x4dca7
movq %rsi, %rbx
testq %rsi, %rsi
je 0x4dca7
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %r14
movq %rbx, %rdi
callq 0x40276
leaq 0x9d0be(%rip), %rdi     # 0xea992
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0x35a32
movq %rbx, %rdi
callq 0x40459
testb %al, %al
jne 0x4dc96
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %rbx, %rdi
callq 0x40276
testq %rax, %rax
je 0x4dcac
movq %rax, %r12
movq %rbx, %rdi
callq 0x41f83
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x40(%r14), %r15
movq %r15, %rdi
callq 0x7e06e
testb %al, %al
je 0x4dc96
movq 0x28(%r14), %rdi
leaq 0x9d061(%rip), %rdx     # 0xea9a2
leaq 0x20(%rsp), %rcx
movq %r12, %rsi
xorl %r8d, %r8d
movq 0x18(%rsp), %r9
callq 0x545d2
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %eax
je 0x4dc96
movq %r12, 0x30(%rsp)
movq $-0x1, %r12
testl %eax, %eax
jne 0x4d999
movsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x9ce22(%rip), %xmm0    # 0xea7b0
cvttsd2si %xmm0, %r12
andq %rcx, %r12
orq %rax, %r12
movq $-0x1, 0x28(%rsp)
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x4da17
movq %r13, %rdi
callq 0x40459
testb %al, %al
jne 0x4da17
movq %r13, %rdi
callq 0x40276
movq 0x28(%r14), %rdi
leaq 0x9cfd7(%rip), %rdx     # 0xea9a2
leaq 0x20(%rsp), %rcx
movq %rax, %rsi
xorl %r8d, %r8d
movq 0x18(%rsp), %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x4dc96
testl %eax, %eax
jne 0x4da17
movsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x9cda9(%rip), %xmm0    # 0xea7b0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x28(%rsp)
cmpq $-0x1, %r12
movq 0x30(%rsp), %r13
je 0x4da35
movq %r15, %rdi
callq 0x7e05b
xorl %ebp, %ebp
cmpq %r12, %rax
ja 0x4dc96
movq 0x10(%rsp), %r12
testq %r12, %r12
setne %al
movq 0x28(%rsp), %rbp
cmpq $-0x1, %rbp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x4da69
movq %r15, %rdi
callq 0x7e05b
xorl %ecx, %ecx
cmpq %rbp, %rax
cmovaq %rcx, %r12
movq %r12, 0x10(%rsp)
movq 0x10(%r14), %rdi
movq %r13, %rsi
callq 0x77109
movq %rax, %r15
testq %rax, %rax
movq 0x18(%rsp), %r12
jne 0x4dae2
leaq 0x9cd56(%rip), %rsi     # 0xea7df
movl $0x1, %edi
movl $0x204, %edx            # imm = 0x204
callq 0x35ee2
movq %rax, %r15
movb $0x0, (%rax)
movq 0x28(%r14), %rdi
leaq 0x9cf08(%rip), %rdx     # 0xea9b1
movq %r13, %rsi
movq %rax, %rcx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x5488a
cmpl $0x2, %eax
jne 0x4dad3
leaq 0x9cd19(%rip), %rsi     # 0xea7df
movq %r15, %rdi
movl $0x208, %edx            # imm = 0x208
jmp 0x4dc8c
movq 0x10(%r14), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x77144
movq 0x20(%r14), %rdi
movq %r13, %rsi
callq 0x77109
movq %rax, %rbp
testq %rax, %rax
jne 0x4db5d
leaq 0x9cce2(%rip), %rsi     # 0xea7df
movl $0x4, %edi
movl $0x213, %edx            # imm = 0x213
callq 0x35ee2
movq %rax, %rbp
movq 0x28(%r14), %rdi
leaq 0x9ceaa(%rip), %rdx     # 0xea9c4
leaq 0xf(%rsp), %rcx
movq %r13, %rsi
xorl %r8d, %r8d
movq %r12, %r9
callq 0x5488a
cmpl $0x2, %eax
je 0x4dc7d
cmpl $0x1, %eax
je 0x4db46
testl %eax, %eax
jne 0x4db4e
movzbl 0xf(%rsp), %eax
jmp 0x4db4b
movl $0x2, %eax
movl %eax, (%rbp)
movq 0x20(%r14), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x77144
cmpb $0x1, (%r15)
jne 0x4db88
movq 0x10(%rsp), %r15
testq %r15, %r15
je 0x4db7d
movq %r15, %rdi
callq 0x40459
testb %al, %al
je 0x4dc0b
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
jmp 0x4dbde
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x4dbd6
movq %r13, %rdi
movq %rbx, %rsi
callq 0x415dc
movl %eax, %r15d
movl (%rbp), %r12d
cmpl $0x2, %r12d
sete %bpl
movq %r13, %rdi
callq 0x40459
cmpl $0x1, %r12d
je 0x4dbe3
andb %bpl, %r15b
jne 0x4dbe3
testb %al, %al
movq 0x18(%rsp), %r15
je 0x4dc3f
movq %rbx, %rdi
callq 0x40432
testb %al, %al
jne 0x4dbf8
jmp 0x4dc3f
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r12, %rcx
jmp 0x4dc4b
testb %al, %al
movq 0x18(%rsp), %r15
je 0x4dc1e
movq %rbx, %rdi
callq 0x40432
testb %al, %al
je 0x4dc1e
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4e183
jmp 0x4dc50
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x4dd4c
jmp 0x4dc59
movq %r13, %rdi
callq 0x41244
cmpq $0x2, %rax
jb 0x4dc3f
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4e298
jmp 0x4dc50
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4de72
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x4dc96
movq %rbx, %rdi
callq 0x40432
xorl %ebp, %ebp
testb %al, %al
jne 0x4dc96
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x77109
testq %rax, %rax
jne 0x4dc96
callq 0x15ce6
leaq 0x9cb5b(%rip), %rsi     # 0xea7df
movq %rbp, %rdi
movl $0x221, %edx            # imm = 0x221
callq 0x362a0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x15cad
callq 0x15d1f