// File: /workspace/github_c_makefile_star2_O3/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 0x836e8
movq %rax, %rdi
movq %r14, %rsi
callq 0x48fc5
movq %rax, %r14
movq %rbx, %rdi
callq 0x415a1
movq %rax, %rdi
callq 0x3bb5d
movq %rax, %r15
cmpb $0x1, 0x28(%r14)
jne 0x83827
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x72fc5
testq %rax, %rax
je 0x83906
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x72fc5
testq %rax, %rax
je 0x83849
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x7c47f
jmp 0x83a3b
movq %rbx, %rdi
callq 0x415e5
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x63ecb(%rip), %rsi     # 0xe772d
movq %rbx, %rdi
callq 0x3eedc
movq %rax, %r12
testq %rax, %rax
jne 0x838da
movq %r12, 0x18(%rsp)
movq %rbx, %rdi
callq 0x40ee0
movq %rax, %r13
movq %rax, %rdi
callq 0x41076
testq %rax, %rax
je 0x838cd
leaq 0x8(%rsp), %rbp
leaq 0x20(%rsp), %r12
movq %rax, %rdi
callq 0x415e5
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7e2af
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %r13, %rdi
callq 0x41076
testq %rax, %rax
jne 0x83899
movq %r13, %rdi
callq 0x41108
movq 0x18(%rsp), %r12
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0x775ed
testq %rax, %rax
je 0x83944
movq %rax, %r13
cmpb $0x1, 0x10(%rax)
jne 0x839df
testq %r12, %r12
je 0x83a28
callq 0x1ed8c
movq %rbx, %rdi
callq 0x41572
movq %rax, %r14
movq %rbx, %rdi
callq 0x41592
leaq 0x7040c(%rip), %rsi     # 0xf3d2c
leaq 0x6327d(%rip), %r9      # 0xe6ba4
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x34f1f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x83a3d
movq %rbx, %rdi
callq 0x41592
movl %eax, %ebp
movq %rbx, %rdi
callq 0x41572
leaq 0x70435(%rip), %rdi     # 0xf3d92
leaq 0x63240(%rip), %r8      # 0xe6ba4
movq %r15, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3d110
leaq 0x70376(%rip), %rsi     # 0xf3cf0
movl $0x18, %edi
movl $0x35, %edx
callq 0x35862
movq %rax, %r13
movl $0x8, %edi
callq 0x6ef7c
testq %r12, %r12
movq %rax, 0x8(%r13)
setne 0x10(%r13)
movq %rbx, %rdi
callq 0x415a1
movq %rax, %rbx
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rdi
callq 0x495f0
movq %rax, (%r13)
movq 0x20(%r14), %r14
movq %rbx, %rdi
callq 0x3bb5d
movq %r14, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x77628
jmp 0x83a28
testq %r12, %r12
je 0x839f4
movb $0x1, 0x10(%r13)
movq (%r13), %rdi
leaq 0x8(%rsp), %rsi
jmp 0x83a23
movq (%r13), %rdi
callq 0x415e5
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x8(%rsp), %rdi
callq 0x7e2af
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq (%r13), %rdi
callq 0x41646
movq 0x8(%r13), %rdi
leaq 0x30(%rsp), %rsi
movl $0x8, %edx
callq 0x6f240
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq