// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/load_stream.c
// Function: gt_load_stream_next
static int gt_load_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                               GtError *err)
{
  GtLoadStream *load_stream;
  GtEOFNode *eofn;
  GtGenomeNode *node;
  int had_err = 0;
  gt_error_check(err);
  load_stream = gt_load_stream_cast(ns);

  if (!load_stream->full) {
    while (!(had_err = gt_node_stream_next(load_stream->in_stream, &node,
                                           err)) && node) {
      if ((eofn = gt_eof_node_try_cast(node)))
        gt_genome_node_delete(node); /* get rid of EOF nodes */
      else
        gt_array_add(load_stream->nodes, node);
    }
    if (!had_err) {
      load_stream->full = true;
    }
  }

  if (!had_err) {
    gt_assert(load_stream->full);
    if (load_stream->idx < gt_array_size(load_stream->nodes)) {
      *gn = *(GtGenomeNode**) gt_array_get(load_stream->nodes,
                                           load_stream->idx);
      load_stream->idx++;
      return 0;
    }
  }

  if (!had_err) {
    gt_array_reset(load_stream->nodes);
    *gn = NULL;
  }

  return had_err;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movl $0x0, 0xc(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x1a3b1b
movq 0x28(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1a3ae3
jmp 0x1a3b1b
movq 0x4984b6(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x37251f(%rip), %rsi    # 0x516013
leaq 0x3726c4(%rip), %rdx    # 0x5161bf
leaq 0x3b4f46(%rip), %rcx    # 0x558a48
leaq 0x3b4f24(%rip), %r8     # 0x558a2d
movl $0x2e, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1a3b1d
callq 0x1a39d0
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x1b20f0
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
testb $0x1, 0x28(%rax)
jne 0x1a3bd2
jmp 0x1a3b45
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rsp), %rdx
leaq 0x10(%rsp), %rsi
callq 0x1b1d90
movl %eax, %ecx
movl %ecx, 0xc(%rsp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xb(%rsp)
jne 0x1a3b7b
cmpq $0x0, 0x10(%rsp)
setne %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x1a3b85
jmp 0x1a3bc0
movq 0x10(%rsp), %rdi
callq 0x48f4c0
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x1a3ba6
movq 0x10(%rsp), %rdi
callq 0x173180
jmp 0x1a3bbe
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
leaq 0x10(%rsp), %rsi
movl $0x8, %edx
callq 0x81100
jmp 0x1a3b45
cmpl $0x0, 0xc(%rsp)
jne 0x1a3bd0
movq 0x20(%rsp), %rax
movb $0x1, 0x28(%rax)
jmp 0x1a3bd2
cmpl $0x0, 0xc(%rsp)
jne 0x1a3c8a
jmp 0x1a3bdf
movq 0x20(%rsp), %rax
testb $0x1, 0x28(%rax)
jne 0x1a3c22
movq 0x4983af(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x372418(%rip), %rsi    # 0x516013
leaq 0x3b4e5a(%rip), %rdx    # 0x558a5c
leaq 0x3b4e3f(%rip), %rcx    # 0x558a48
leaq 0x3b4e1d(%rip), %r8     # 0x558a2d
movl $0x3f, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1a3c24
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, (%rsp)
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x81370
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x1a3c88
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x80b60
movq (%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movl $0x0, 0x44(%rsp)
jmp 0x1a3cb3
jmp 0x1a3c8a
cmpl $0x0, 0xc(%rsp)
jne 0x1a3cab
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x814a0
movq 0x30(%rsp), %rax
movq $0x0, (%rax)
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)