// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/gff3_linesorted_out_stream.c
// Function: gff3_linesorted_out_stream_next
static int gff3_linesorted_out_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                                           GtError *err)
{
  GtGFF3LinesortedOutStream *lsos;
  int had_err = 0;
  GtGenomeNode *node;
  GtFeatureNode *fn = NULL;
  gt_error_check(err);
  lsos = gt_gff3_linesorted_out_stream_cast(ns);

  /* we do not need to pass on any nodes, this is an output stream */
  *gn = NULL;

  while (!(had_err = gt_node_stream_next(lsos->in_stream, &node,
                                          err))) {
     if (node == NULL) {
       /* do not forget to finish last cluster */
       if (!had_err) {
         had_err = gff3_linesorted_out_stream_process_current_cluster(lsos, err);
       }
       break;
     }
     if ((fn = gt_feature_node_try_cast(node))) {
       if (lsos->last_seqid == NULL) {
         lsos->last_seqid = gt_str_clone(gt_genome_node_get_seqid(node));
       }
       if (gt_str_cmp(lsos->last_seqid, gt_genome_node_get_seqid(node)) != 0) {
         /* new sequence reached, finish old cluster and update current seqid;
            we can do this as GenomeTools enforces all features within a CC to
            share the same seqid */
         had_err = gff3_linesorted_out_stream_process_current_cluster(lsos, err);
         if (had_err) {
           return had_err;
         }
         gt_str_reset(lsos->last_seqid);
         gt_str_append_str(lsos->last_seqid, gt_genome_node_get_seqid(node));
       }
       gt_array_add(lsos->cur_node_set, fn);
     } else {
       if (!had_err) {
        gt_str_reset(lsos->buf);
        had_err = gt_genome_node_accept(node, lsos->gff3vis, err);
      }
      if (!had_err) {
        gt_file_xprintf(lsos->outfp, "%s", gt_str_get(lsos->buf));
        gt_genome_node_delete(node);
      } else {
        return had_err;
      }
    }
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq $0x0, 0x10(%rsp)
testq %rdx, %rdx
je 0x14669d
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x146805
callq 0x146594
movq %rax, %rdi
movq %r14, %rsi
callq 0x162ff7
movq %rax, %r14
movq $0x0, (%r15)
movq 0x10(%rax), %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x162e68
testl %eax, %eax
je 0x1466db
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2823c7(%rip), %r15    # 0x3c8aa9
leaq 0x8(%rsp), %r12
leaq 0x10(%rsp), %r13
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1467f5
callq 0x143cab
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x146790
movq 0x40(%r14), %rbp
testq %rbp, %rbp
jne 0x14672f
movq 0x8(%rsp), %rdi
callq 0x144635
movq %rax, %rdi
callq 0x11b191
movq %rax, %rbp
movq %rax, 0x40(%r14)
movq 0x8(%rsp), %rdi
callq 0x144635
movq %rbp, %rdi
movq %rax, %rsi
callq 0x11b146
testl %eax, %eax
je 0x14677d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1468d9
testl %eax, %eax
jne 0x1466cc
movq 0x40(%r14), %rdi
callq 0x11b132
movq 0x40(%r14), %rbp
movq 0x8(%rsp), %rdi
callq 0x144635
movq %rbp, %rdi
movq %rax, %rsi
callq 0x11adc1
movq 0x18(%r14), %rdi
movl $0x8, %edx
movq %r13, %rsi
callq 0xd2410
jmp 0x1467d9
movq 0x28(%r14), %rdi
callq 0x11b132
movq 0x8(%rsp), %rdi
movq 0x38(%r14), %rsi
movq %rbx, %rdx
callq 0x14472c
testl %eax, %eax
jne 0x1466cc
movq 0x20(%r14), %rbp
movq 0x28(%r14), %rdi
callq 0x11b0a1
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0xfee51
movq 0x8(%rsp), %rdi
callq 0x1451a0
movq 0x10(%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x162e68
testl %eax, %eax
je 0x1466ec
jmp 0x1466cc
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1468d9
jmp 0x1466cc
callq 0x447e4