// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
callq 0xd88a0
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x169dc0
movq %rax, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x60(%rsp), %rdi
callq 0x11fcc0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x1686fc
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x11f8c0
movq %rax, 0x30(%rsp)
movq 0x70(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x168687
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x30(%rsp), %rdx
movq 0x68(%rsp), %rcx
leaq 0x48(%rsp), %rsi
callq 0x169f40
jmp 0x1686a4
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x30(%rsp), %rdx
movq 0x68(%rsp), %rcx
leaq 0x48(%rsp), %rsi
callq 0x169e70
movq 0x30(%rsp), %rdi
callq 0x11d510
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
callq 0x1ca610
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x40(%rsp), %rsi
callq 0xfd170
movq 0x38(%rsp), %rdi
callq 0x11f560
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x168624
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x60(%rsp), %rdi
callq 0x11fcc0
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0x1687dc
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x11f8c0
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq 0x169a30
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0x81370
cmpq $0x0, %rax
jbe 0x1687bf
movq 0x28(%rsp), %rdi
leaq 0x9909(%rip), %rsi      # 0x172080
callq 0x81500
movq 0x28(%rsp), %rdi
callq 0x80f40
movq 0x28(%rsp), %rdi
callq 0x81370
cmpq $0x0, %rax
jbe 0x1687bd
movq 0x28(%rsp), %rdi
callq 0x80c70
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x18(%rsp), %rax
movq (%rax), %rsi
callq 0xfd170
jmp 0x168786
jmp 0x1687bf
movq 0x28(%rsp), %rdi
callq 0x81f80
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x168705
movq 0x68(%rsp), %rdi
callq 0xd8c80
movq 0x60(%rsp), %rdi
callq 0x11fd20
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)