// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0x10(%rsp)
testq %rdx, %rdx
je 0xdfc00
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0xdfd48
callq 0xdfb08
movq %rax, %rdi
movq %r14, %rsi
callq 0x102c81
movq %rax, %r14
andq $0x0, (%r15)
leaq 0x8(%rsp), %r15
leaq 0x10(%rsp), %r13
pushq $0x8
popq %rbp
movq 0x10(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x102a22
testl %eax, %eax
jne 0xdfd39
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xdfd2e
callq 0xdc2f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xdfce0
movq 0x40(%r14), %r12
testq %r12, %r12
jne 0xdfc7e
movq 0x8(%rsp), %rdi
callq 0xdd14a
movq %rax, %rdi
callq 0xad442
movq %rax, %r12
movq %rax, 0x40(%r14)
movq 0x8(%rsp), %rdi
callq 0xdd14a
movq %r12, %rdi
movq %rax, %rsi
callq 0xad39b
testl %eax, %eax
je 0xdfccc
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdfee1
testl %eax, %eax
jne 0xdfd39
movq 0x40(%r14), %rdi
callq 0xad357
movq 0x40(%r14), %r12
movq 0x8(%rsp), %rdi
callq 0xdd14a
movq %r12, %rdi
movq %rax, %rsi
callq 0xacd13
movq 0x18(%r14), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x5851d
jmp 0xdfc24
movq 0x28(%r14), %rdi
callq 0xad357
movq 0x8(%rsp), %rdi
movq 0x38(%r14), %rsi
movq %rbx, %rdx
callq 0xdd39c
testl %eax, %eax
jne 0xdfd39
movq 0x20(%r14), %r12
movq 0x28(%r14), %rdi
callq 0xad1fa
movq %r12, %rdi
leaq 0x289194(%rip), %rsi    # 0x368ea9
movq %rax, %rdx
xorl %eax, %eax
callq 0x8d432
movq 0x8(%rsp), %rdi
callq 0xde013
jmp 0xdfc24
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdfee1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x358219(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2052ba(%rip), %rsi    # 0x2e5013
leaq 0x20545f(%rip), %rdx    # 0x2e51bf
leaq 0x23fdf4(%rip), %rcx    # 0x31fb5b
leaq 0x23fd62(%rip), %r8     # 0x31fad0
movl $0xcb, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390