// File: /workspace/github_c_makefile_star2_O3/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 0x4d014
movq %rsi, %rbx
testq %rsi, %rsi
je 0x4d014
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %r14
movq %rbx, %rdi
callq 0x3f914
leaq 0x9dcf5(%rip), %rdi     # 0xea942
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0x353ae
movq %rbx, %rdi
callq 0x3faf4
testb %al, %al
jne 0x4d003
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %rbx, %rdi
callq 0x3f914
testq %rax, %rax
je 0x4d019
movq %rax, %r12
movq %rbx, %rdi
callq 0x415e5
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x40(%r14), %r15
movq %r15, %rdi
callq 0x7e1b2
testb %al, %al
je 0x4d003
movq 0x28(%r14), %rdi
leaq 0x9dc98(%rip), %rdx     # 0xea952
leaq 0x20(%rsp), %rcx
movq %r12, %rsi
xorl %r8d, %r8d
movq 0x18(%rsp), %r9
callq 0x5393e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %eax
je 0x4d003
movq %r12, 0x30(%rsp)
movq $-0x1, %r12
testl %eax, %eax
jne 0x4cd12
movsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x9da59(%rip), %xmm0    # 0xea760
cvttsd2si %xmm0, %r12
andq %rcx, %r12
orq %rax, %r12
movq $-0x1, 0x28(%rsp)
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x4cd90
movq %r13, %rdi
callq 0x3faf4
testb %al, %al
jne 0x4cd90
movq %r13, %rdi
callq 0x3f914
movq 0x28(%r14), %rdi
leaq 0x9dc0e(%rip), %rdx     # 0xea952
leaq 0x20(%rsp), %rcx
movq %rax, %rsi
xorl %r8d, %r8d
movq 0x18(%rsp), %r9
callq 0x5393e
cmpl $0x2, %eax
je 0x4d003
testl %eax, %eax
jne 0x4cd90
movsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x9d9e0(%rip), %xmm0    # 0xea760
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x28(%rsp)
cmpq $-0x1, %r12
movq 0x30(%rsp), %r13
je 0x4cdae
movq %r15, %rdi
callq 0x7e19f
xorl %ebp, %ebp
cmpq %r12, %rax
ja 0x4d003
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 0x4cde2
movq %r15, %rdi
callq 0x7e19f
xorl %ecx, %ecx
cmpq %rbp, %rax
cmovaq %rcx, %r12
movq %r12, 0x10(%rsp)
movq 0x10(%r14), %rdi
movq %r13, %rsi
callq 0x775ed
movq %rax, %r15
testq %rax, %rax
movq 0x18(%rsp), %r12
jne 0x4ce5b
leaq 0x9d98d(%rip), %rsi     # 0xea78f
movl $0x1, %edi
movl $0x204, %edx            # imm = 0x204
callq 0x35862
movq %rax, %r15
movb $0x0, (%rax)
movq 0x28(%r14), %rdi
leaq 0x9db3f(%rip), %rdx     # 0xea961
movq %r13, %rsi
movq %rax, %rcx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x53bf6
cmpl $0x2, %eax
jne 0x4ce4c
leaq 0x9d950(%rip), %rsi     # 0xea78f
movq %r15, %rdi
movl $0x208, %edx            # imm = 0x208
jmp 0x4cff9
movq 0x10(%r14), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x77628
movq 0x20(%r14), %rdi
movq %r13, %rsi
callq 0x775ed
movq %rax, %rbp
testq %rax, %rax
jne 0x4ced6
leaq 0x9d919(%rip), %rsi     # 0xea78f
movl $0x4, %edi
movl $0x213, %edx            # imm = 0x213
callq 0x35862
movq %rax, %rbp
movq 0x28(%r14), %rdi
leaq 0x9dae1(%rip), %rdx     # 0xea974
leaq 0xf(%rsp), %rcx
movq %r13, %rsi
xorl %r8d, %r8d
movq %r12, %r9
callq 0x53bf6
cmpl $0x2, %eax
je 0x4cfea
cmpl $0x1, %eax
je 0x4cebf
testl %eax, %eax
jne 0x4cec7
movzbl 0xf(%rsp), %eax
jmp 0x4cec4
movl $0x2, %eax
movl %eax, (%rbp)
movq 0x20(%r14), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x77628
cmpb $0x1, (%r15)
jne 0x4cf08
movq 0x10(%rsp), %r15
testq %r15, %r15
je 0x4cf56
movq %r15, %rdi
callq 0x3faf4
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
testb %al, %al
jne 0x4cf5e
movq %rbx, %rcx
callq 0x4d0bb
jmp 0x4cfc6
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x4cf56
movq %r13, %rdi
movq %rbx, %rsi
callq 0x40c53
movl %eax, %r15d
movl (%rbp), %r12d
cmpl $0x2, %r12d
sete %bpl
movq %r13, %rdi
callq 0x3faf4
cmpl $0x1, %r12d
je 0x4cf63
andb %bpl, %r15b
jne 0x4cf63
testb %al, %al
movq 0x18(%rsp), %r15
je 0x4cfac
movq %rbx, %rdi
callq 0x3facd
testb %al, %al
jne 0x4cf78
jmp 0x4cfac
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r12, %rcx
jmp 0x4cfb8
testb %al, %al
movq 0x18(%rsp), %r15
je 0x4cf8b
movq %rbx, %rdi
callq 0x3facd
testb %al, %al
je 0x4cf8b
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4d4c8
jmp 0x4cfbd
movq %r13, %rdi
callq 0x408bb
cmpq $0x2, %rax
jb 0x4cfac
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4d5dd
jmp 0x4cfbd
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4d1e8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x4d003
movq %rbx, %rdi
callq 0x3facd
xorl %ebp, %ebp
testb %al, %al
jne 0x4d003
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x775ed
testq %rax, %rax
jne 0x4d003
callq 0x15b94
leaq 0x9d79e(%rip), %rsi     # 0xea78f
movq %rbp, %rdi
movl $0x221, %edx            # imm = 0x221
callq 0x35c27
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 0x15b5b
callq 0x15bcd