// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/add_ids_visitor.c
// Function: add_ids_visitor_feature_node
static int add_ids_visitor_feature_node(GtNodeVisitor *nv, GtFeatureNode *fn,
                                        GtError *err)
{
  AutomaticSequenceRegion *auto_sr;
  GtAddIDsVisitor *aiv;
  const char *seqid;
  bool is_circular;
  aiv = add_ids_visitor_cast(nv);
  seqid = gt_str_get(gt_genome_node_get_seqid((GtGenomeNode*) fn));
  if (aiv->ensure_sorting && !gt_cstr_table_get(aiv->defined_seqids, seqid)) {
    gt_error_set(err, "the file %s is not sorted (seqid \"%s\" on line %u has "
                 "not been previously introduced with a \"%s\" line)",
                 gt_genome_node_get_filename((GtGenomeNode*) fn), seqid,
                 gt_genome_node_get_line_number((GtGenomeNode*) fn),
                 GT_GFF_SEQUENCE_REGION);
    return -1;
  }
  if (!gt_cstr_table_get(aiv->defined_seqids, seqid)) {
    GtFeatureNodeIterator *fni;
    GtFeatureNode *node;
    GtRange range = gt_genome_node_get_range((GtGenomeNode*) fn);
    is_circular = gt_feature_node_get_attribute(fn, GT_GFF_IS_CIRCULAR)
                  ? true : false;
    if (!is_circular) {
      fni = gt_feature_node_iterator_new(fn);
      while ((node = gt_feature_node_iterator_next(fni))) {
        GtRange node_range = gt_genome_node_get_range((GtGenomeNode*) node);
        range = gt_range_join(&range, &node_range);
      }
      gt_feature_node_iterator_delete(fni);
    }
    /* sequence region has not been previously introduced -> check if one has
       already been created automatically */
    auto_sr = gt_hashmap_get(aiv->undefined_sequence_regions, seqid);
    if (!auto_sr) {
      GtStr *seqid_str;
      /* sequence region has not been createad automatically -> do it now */
      gt_warning("seqid \"%s\" on line %u in file \"%s\" has not been "
                 "previously introduced with a \"%s\" line, create such a line "
                 "automatically", seqid,
                 gt_genome_node_get_line_number((GtGenomeNode*) fn),
                 gt_genome_node_get_filename((GtGenomeNode*) fn),
                 GT_GFF_SEQUENCE_REGION);
      auto_sr = automatic_sequence_region_new(is_circular);
      seqid_str = gt_genome_node_get_seqid((GtGenomeNode*) fn);
      auto_sr->sequence_region = gt_region_node_new(seqid_str, range.start,
                                                               range.end);
      gt_hashmap_add(aiv->undefined_sequence_regions, gt_str_get(seqid_str),
                     auto_sr);
    }
    else {
      if (auto_sr->is_circular) {
        gt_assert(!is_circular); /* XXX */
      }
      else if (is_circular) {
        gt_assert(!auto_sr->is_circular); /* XXX */
        auto_sr->is_circular = true;
        gt_genome_node_set_range(auto_sr->sequence_region, &range);
      }
      else {
        GtRange joined_range,
                sr_range = gt_genome_node_get_range(auto_sr->sequence_region);
        /* update the range of the sequence region */
        joined_range = gt_range_join(&range, &sr_range);
        gt_genome_node_set_range(auto_sr->sequence_region, &joined_range);
      }
    }
    gt_array_add(auto_sr->feature_nodes, fn);
  }
  else
    gt_queue_add(aiv->node_buffer, fn);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0x30(%rsp)
callq 0x62bf8
movq %rax, %rdi
movq %r14, %rsi
callq 0x2603e
movq %rax, %r14
movq %rbx, %rdi
callq 0x1c31a
movq %rax, %rdi
callq 0x143d2
movq %rax, %r15
cmpb $0x1, 0x28(%r14)
jne 0x62d66
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x5018a
testq %rax, %rax
je 0x62e05
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x5018a
testq %rax, %rax
je 0x62d88
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x5b055
jmp 0x62f9c
movq %rbx, %rdi
callq 0x1c3c4
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x6d97c(%rip), %rsi     # 0xd071d
movq %rbx, %rdi
callq 0x18818
movq %rax, %r12
testq %rax, %rax
jne 0x62e4e
movq %r12, 0x18(%rsp)
movq %rbx, %rdi
callq 0x1b8e0
movq %rax, %r13
leaq 0x8(%rsp), %rbp
leaq 0x20(%rsp), %r12
movq %r13, %rdi
callq 0x1bb1e
testq %rax, %rax
je 0x62e41
movq %rax, %rdi
callq 0x1c3c4
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x5d269
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
jmp 0x62dcf
movq %rbx, %rdi
callq 0x1c285
movq %rax, %r14
movq %rbx, %rdi
callq 0x1c2d8
leaq 0x7a26d(%rip), %rsi     # 0xdd08c
leaq 0x6cd6e(%rip), %r9      # 0xcfb94
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0xc007
pushq $-0x1
popq %rax
jmp 0x62f9e
movq %r13, %rdi
callq 0x1bbe1
movq 0x18(%rsp), %r12
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0x55ef6
testq %rax, %rax
je 0x62ead
movq %rax, %r13
cmpb $0x1, 0x10(%rax)
jne 0x62f42
testq %r12, %r12
je 0x62f8b
movq 0xcb13c(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x671e0(%rip), %rsi     # 0xca066
leaq 0x7a2de(%rip), %rdx     # 0xdd16b
leaq 0x7a2e4(%rip), %rcx     # 0xdd178
leaq 0x7a1b5(%rip), %r8      # 0xdd050
movl $0x8e, %r9d
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq %rbx, %rdi
callq 0x1c2d8
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1c285
leaq 0x7a22c(%rip), %rdi     # 0xdd0f2
leaq 0x6ccc7(%rip), %r8      # 0xcfb94
movq %r15, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x161b0
leaq 0x7a16d(%rip), %rsi     # 0xdd050
pushq $0x18
popq %rdi
pushq $0x35
popq %rdx
callq 0xccb0
movq %rax, %r13
pushq $0x8
popq %rdi
callq 0x4b380
testq %r12, %r12
movq %rax, 0x8(%r13)
setne 0x10(%r13)
movq %rbx, %rdi
callq 0x1c31a
movq %rax, %rbx
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rdi
callq 0x26a40
movq %rax, (%r13)
movq 0x20(%r14), %r14
movq %rbx, %rdi
callq 0x143d2
movq %r14, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x55f31
jmp 0x62f8b
testq %r12, %r12
je 0x62f57
movb $0x1, 0x10(%r13)
movq (%r13), %rdi
leaq 0x8(%rsp), %rsi
jmp 0x62f86
movq (%r13), %rdi
callq 0x1c3c4
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x8(%rsp), %rdi
callq 0x5d269
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq (%r13), %rdi
callq 0x1c48b
movq 0x8(%r13), %rdi
leaq 0x30(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x4b801
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq