// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rdx, %r15
movq %rdi, %rbx
movq %rsi, (%rsp)
callq 0x83b00
movq %rax, %rdi
movq %rbx, %rsi
callq 0x49c1d
movq %rax, %rbx
movq (%rsp), %rdi
callq 0x41f3f
movq %rax, %rdi
callq 0x3c40b
movq %rax, %r14
cmpb $0x1, 0x28(%rbx)
jne 0x83c38
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x729dd
testq %rax, %rax
je 0x83d11
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x729dd
testq %rax, %rax
je 0x83c5b
movq 0x10(%rbx), %rdi
movq (%rsp), %rsi
callq 0x7c043
jmp 0x83e4d
movq (%rsp), %rdi
callq 0x41f83
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq (%rsp), %rdi
leaq 0x63b06(%rip), %rsi     # 0xe777f
callq 0x3f850
movq %rax, %r15
testq %rax, %rax
jne 0x83ce5
movq (%rsp), %rdi
callq 0x4186c
movq %rax, %r12
movq %rax, %rdi
callq 0x41a02
testq %rax, %rax
je 0x83cdd
leaq 0x8(%rsp), %r13
leaq 0x18(%rsp), %rbp
movq %rax, %rdi
callq 0x41f83
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x7e16b
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %r12, %rdi
callq 0x41a02
testq %rax, %rax
jne 0x83ca9
movq %r12, %rdi
callq 0x41a94
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x77109
testq %rax, %rax
je 0x83d51
movq %rax, %r12
cmpb $0x1, 0x10(%rax)
jne 0x83df1
testq %r15, %r15
je 0x83e3b
callq 0x1edf2
movq (%rsp), %rdi
callq 0x41f10
movq %rax, %rbx
movq (%rsp), %rdi
callq 0x41f30
leaq 0x7005f(%rip), %rsi     # 0xf3d8c
leaq 0x62ec2(%rip), %r9      # 0xe6bf6
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x3559f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x83e4f
movq (%rsp), %rdi
callq 0x41f30
movl %eax, %ebp
movq (%rsp), %rdi
callq 0x41f10
leaq 0x70086(%rip), %rdi     # 0xf3df2
leaq 0x62e83(%rip), %r8      # 0xe6bf6
movq %r14, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3da84
leaq 0x6ffc7(%rip), %rsi     # 0xf3d50
movl $0x18, %edi
movl $0x35, %edx
callq 0x35ee2
movq %rax, %r12
movl $0x8, %edi
callq 0x6e93c
testq %r15, %r15
movq %rax, 0x8(%r12)
setne 0x10(%r12)
movq (%rsp), %rdi
callq 0x41f3f
movq %rax, %r14
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rdi
callq 0x4a248
movq %rax, (%r12)
movq 0x20(%rbx), %rbx
movq %r14, %rdi
callq 0x3c40b
movq %rbx, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x77144
jmp 0x83e3b
testq %r15, %r15
je 0x83e07
movb $0x1, 0x10(%r12)
movq (%r12), %rdi
leaq 0x8(%rsp), %rsi
jmp 0x83e36
movq (%r12), %rdi
callq 0x41f83
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x8(%rsp), %rdi
callq 0x7e16b
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq (%r12), %rdi
callq 0x41fe4
movq 0x8(%r12), %rdi
movq %rsp, %rsi
movl $0x8, %edx
callq 0x6ec0e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq