// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/gff3_numsorted_out_stream.c
// Function: gff3_numsorted_out_stream_next
static int gff3_numsorted_out_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                                           GtError *err)
{
  GtGFF3NumsortedOutStream *gff3_out_stream;
  int had_err = 0;
  GtUword i = 0;
  gt_error_check(err);
  gff3_out_stream = gff3_numsorted_out_stream_cast(ns);
  if (!gff3_out_stream->outqueue) {
    gff3_out_stream->outqueue = gt_queue_new();
    while (!(had_err =
                    gt_node_stream_next(gff3_out_stream->in_stream, gn, err))) {
      if (!*gn) break;
      gt_array_add(gff3_out_stream->buffer, *gn);
    }
    if (!had_err) {
      gt_genome_nodes_sort_stable_with_func(gff3_out_stream->buffer,
                             (GtCompare) gt_genome_node_compare_numeric_seqids);
      for (i = 0; !had_err && i < gt_array_size(gff3_out_stream->buffer); i++) {
        GtGenomeNode *mygn = *(GtGenomeNode**)
                                       gt_array_get(gff3_out_stream->buffer, i);
        gt_queue_add(gff3_out_stream->outqueue, mygn);
      }
    }
  }
  if (gff3_out_stream->outqueue && !had_err) {
    if (gt_queue_size(gff3_out_stream->outqueue) > 0) {
      GtGenomeNode *mygn = (GtGenomeNode*)
                                        gt_queue_get(gff3_out_stream->outqueue);
      gt_assert(mygn);
      had_err = gt_genome_node_accept(mygn, gff3_out_stream->gff3_visitor, err);
      if (!had_err)
        *gn = mygn;
    }
  }
  return had_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rdx, %rdx
je 0xe048e
movq %r14, %rdi
callq 0x89eb7
testb %al, %al
jne 0xe0581
callq 0xe03f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x102c81
movq %rax, %r15
xorl %r12d, %r12d
cmpq $0x0, 0x20(%rax)
jne 0xe04e5
callq 0x9e2bc
movq %rax, 0x20(%r15)
pushq $0x8
popq %r13
movq 0x10(%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x102a22
testl %eax, %eax
jne 0xe04e2
cmpq $0x0, (%rbx)
movq 0x18(%r15), %rdi
je 0xe0544
movq %rbx, %rsi
movq %r13, %rdx
callq 0x5851d
jmp 0xe04b8
movl %eax, %r12d
movq 0x20(%r15), %rdi
testq %rdi, %rdi
sete %al
testl %r12d, %r12d
setne %cl
orb %al, %cl
jne 0xe0537
callq 0x9e48b
xorl %r12d, %r12d
testq %rax, %rax
je 0xe0537
movq 0x20(%r15), %rdi
callq 0x9e411
testq %rax, %rax
je 0xe05ab
movq %rax, %r13
movq 0x28(%r15), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0xdd39c
movl %eax, %r12d
testl %eax, %eax
jne 0xe0537
movq %r13, (%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq -0x30f4(%rip), %rsi     # 0xdd457
callq 0xdd619
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x18(%r15), %rdi
callq 0x586a4
cmpq %rax, %r13
jae 0xe04e5
movq 0x18(%r15), %rdi
movq %r13, %rsi
callq 0x581aa
movq (%rax), %rsi
movq 0x20(%r15), %rdi
callq 0x9e2d1
incq %r13
jmp 0xe0556
movq 0x3579e0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x204a81(%rip), %rsi    # 0x2e5013
leaq 0x204c26(%rip), %rdx    # 0x2e51bf
leaq 0x23f706(%rip), %rcx    # 0x31fca6
leaq 0x23f6a4(%rip), %r8     # 0x31fc4b
pushq $0x2b
jmp 0xe05d3
movq 0x3579b6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x204a57(%rip), %rsi    # 0x2e5013
leaq 0x23f702(%rip), %rdx    # 0x31fcc5
leaq 0x23f6dc(%rip), %rcx    # 0x31fca6
leaq 0x23f67a(%rip), %r8     # 0x31fc4b
pushq $0x42
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390