// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/sequence_node_add_stream.c
// Function: sequence_node_add_stream_next
static int sequence_node_add_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                                         GtError *err)
{
  GtSequenceNodeAddStream *s;
  int had_err;
  gt_error_check(err);
  s = gt_sequence_node_add_stream_cast(ns);

  /* stream nodes as long as we have some, record seen seqids */
  if (!(had_err = gt_node_stream_next(s->in_stream, gn, err)) && *gn) {
    had_err = gt_genome_node_accept(*gn, s->collect_vis, err);
  }

  /* if there are no more  */
  if (!had_err && !*gn) {
    if (!s->seqids) {
      s->seqids = gt_cstr_table_get_all(s->seqid_table);
    }
    gt_assert(s->seqids);
    if (s->cur_seqid >= gt_str_array_size(s->seqids)) {
      *gn = NULL;
      return 0;
    } else {
      GtGenomeNode *new_sn;
      GtUword len;
      char *seq = NULL;
      GtStr *seqid = gt_str_new(),
            *seqstr = gt_str_new();
      gt_str_append_cstr(seqid, gt_str_array_get(s->seqids, s->cur_seqid));
      had_err = gt_region_mapping_get_sequence_length(s->rm, &len, seqid, err);
      if (!had_err) {
        had_err = gt_region_mapping_get_sequence(s->rm, &seq, seqid, 1, len,
                                                 err);
      }
      if (!had_err) {
        gt_str_append_cstr_nt(seqstr, seq, len);
        new_sn = gt_sequence_node_new(gt_str_get(seqid), seqstr);
        *gn = new_sn;
      }
      s->cur_seqid++;
      gt_free(seq);
      gt_str_delete(seqid);
      gt_str_delete(seqstr);
    }
  }

  return had_err;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x1d6833
movq 0x48(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1d67fb
jmp 0x1d6833
movq 0x46579e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x33f807(%rip), %rsi    # 0x516013
leaq 0x33f9ac(%rip), %rdx    # 0x5161bf
leaq 0x38efbc(%rip), %rcx    # 0x5657d6
leaq 0x38ef8d(%rip), %r8     # 0x5657ae
movl $0x35, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1d6835
callq 0x1d6730
movq %rax, %rdi
movq 0x58(%rsp), %rsi
callq 0x1b20f0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x1b1d90
movl %eax, 0x3c(%rsp)
cmpl $0x0, %eax
jne 0x1d6897
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
je 0x1d6897
movq 0x50(%rsp), %rax
movq (%rax), %rdi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x48(%rsp), %rdx
callq 0x171f90
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x3c(%rsp)
jne 0x1d6a7e
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x1d6a7e
movq 0x40(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x1d68d7
movq 0x40(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xa3c20
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x28(%rax)
jmp 0x1d68d9
movq 0x40(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x1d691d
movq 0x4656b4(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x33f71d(%rip), %rsi    # 0x516013
leaq 0x38eef7(%rip), %rdx    # 0x5657f4
leaq 0x38eed2(%rip), %rcx    # 0x5657d6
leaq 0x38eea3(%rip), %r8     # 0x5657ae
movl $0x42, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1d691f
movq 0x40(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x11fcc0
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jb 0x1d6961
movq 0x50(%rsp), %rax
movq $0x0, (%rax)
movl $0x0, 0x64(%rsp)
jmp 0x1d6a86
movq $0x0, 0x20(%rsp)
callq 0x11d4a0
movq %rax, 0x18(%rsp)
callq 0x11d4a0
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x40(%rsp), %rax
movq 0x38(%rax), %rsi
callq 0x11f8c0
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x11d550
movq 0x40(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x18(%rsp), %rdx
movq 0x48(%rsp), %rcx
leaq 0x28(%rsp), %rsi
callq 0x1c9090
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x3c(%rsp)
jne 0x1d69fd
movq 0x40(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x18(%rsp), %rdx
movq 0x28(%rsp), %r8
movq 0x48(%rsp), %r9
leaq 0x20(%rsp), %rsi
movl $0x1, %ecx
callq 0x1c8040
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x3c(%rsp)
jne 0x1d6a41
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x11d830
movq 0x18(%rsp), %rdi
callq 0x11dee0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x1d6520
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
movq 0x20(%rsp), %rdi
leaq 0x38ed50(%rip), %rsi    # 0x5657ae
movl $0x58, %edx
callq 0xe88c0
movq 0x18(%rsp), %rdi
callq 0x11f560
movq 0x10(%rsp), %rdi
callq 0x11f560
jmp 0x1d6a7e
movl 0x3c(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nop