// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/feature_in_stream.c
// Function: feature_in_stream_init
void feature_in_stream_init(GtFeatureInStream *stream)
{
  GtError *error;
  GtStrArray *seqids;
  GtUword i;

  error = gt_error_new();
  seqids = gt_feature_index_get_seqids(stream->fi, error);

  /* Load all region nodes into the cache */
  for (i = 0; i < gt_str_array_size(seqids); i++)
  {
    GtRange seqrange;
    GtGenomeNode *rn;
    GtStr *seqstr;
    const char *seqid;

    seqid = gt_str_array_get(seqids, i);
    if (stream->useorig)
    {
      gt_feature_index_get_orig_range_for_seqid(stream->fi, &seqrange, seqid,
                                                error);
    }
    else
    {
      gt_feature_index_get_range_for_seqid(stream->fi, &seqrange, seqid, error);
    }

    seqstr = gt_str_new_cstr(seqid);
    rn = gt_region_node_new(seqstr, seqrange.start, seqrange.end);
    gt_queue_add(stream->cache, rn);
    gt_str_delete(seqstr);
  }

  /* Load all feature nodes into the cache */
  for (i = 0; i < gt_str_array_size(seqids); i++)
  {
    GtArray *features;
    const char *seqid;

    seqid = gt_str_array_get(seqids, i);
    features = gt_feature_index_get_features_for_seqid(stream->fi, seqid,error);
    if (gt_array_size(features) > 0)
    {
      gt_array_sort(features, (GtCompare)gt_genome_node_compare);
      gt_array_reverse(features);
      while (gt_array_size(features) > 0)
      {
        GtGenomeNode **fn = gt_array_pop(features);
        gt_queue_add(stream->cache, *fn);
      }
    }
    gt_array_delete(features);
  }

  gt_error_delete(error);
  gt_str_array_delete(seqids);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0xfcb4c
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq %rax, %rsi
callq 0x140bf2
movq %rax, %r15
movq %rax, %rdi
callq 0x11c131
testq %rax, %rax
je 0x13fea4
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x11bfb3
movq %rax, %rbp
movq 0x10(%rbx), %rdi
cmpb $0x1, 0x20(%rbx)
jne 0x13fe55
movq %r13, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x140ca7
jmp 0x13fe63
movq %r13, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x140c40
movq %rbp, %rdi
callq 0x11acc9
movq %rax, %rbp
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rdi
callq 0x16e820
movq 0x18(%rbx), %rdi
movq %rax, %rsi
callq 0x10d65b
movq %rbp, %rdi
callq 0x11bdbf
incq %r12
movq %r15, %rdi
callq 0x11c131
cmpq %rax, %r12
jb 0x13fe2d
movq %r15, %rdi
callq 0x11c131
testq %rax, %rax
je 0x13ff37
xorl %r12d, %r12d
leaq 0x48c1(%rip), %r13      # 0x144780
movq %r15, %rdi
movq %r12, %rsi
callq 0x11bfb3
movq 0x10(%rbx), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x140a3c
movq %rax, %rbp
movq %rax, %rdi
callq 0xd24e0
testq %rax, %rax
je 0x13ff1f
movq %rbp, %rdi
movq %r13, %rsi
callq 0xd252d
movq %rbp, %rdi
callq 0xd2349
movq %rbp, %rdi
callq 0xd24e0
testq %rax, %rax
je 0x13ff1f
movq %rbp, %rdi
callq 0xd2242
movq 0x18(%rbx), %rdi
movq (%rax), %rsi
callq 0x10d65b
jmp 0x13fefc
movq %rbp, %rdi
callq 0xd2938
incq %r12
movq %r15, %rdi
callq 0x11c131
cmpq %rax, %r12
jb 0x13febf
movq %r14, %rdi
callq 0xfcccd
movq %r15, %rdi
callq 0x11c144
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq