// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/merge_stream.c
// Function: merge_stream_next
static int merge_stream_next(GtNodeStream *ns, GtGenomeNode **gn, GtError *err)
{
  GtMergeStream *ms;
  int had_err = 0;
  gt_error_check(err);
  ms = gt_merge_stream_cast(ns);

  gt_assert(!ms->second_node); /* the second buffer is always empty when this
                                  function is called */
  if (!ms->first_node) {
    /* both buffers are empty */
    had_err = merge_stream_next_in_order(ns, &ms->first_node, err);
    if (had_err)
      return had_err;
    if (!ms->first_node) {
      *gn = NULL;
      return 0;
    }
  }

  while (!had_err) {
    gt_assert(ms->first_node && !ms->second_node);
    had_err = merge_stream_next_in_order(ns, &ms->second_node, err);
    if (!had_err && ms->second_node) {
      if (!merge_stream_consolidate(&ms->first_node, &ms->second_node))
        break;
    }
    else
      break;
  }

  if (!had_err) {
    gt_assert(ms->first_node);
    *gn = ms->first_node;
    ms->first_node = ms->second_node;
    ms->second_node = NULL;
  }

  return had_err;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movl $0x0, 0xc(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x1ae95b
movq 0x18(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1ae923
jmp 0x1ae95b
movq 0x48d676(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3676df(%rip), %rsi    # 0x516013
leaq 0x367884(%rip), %rdx    # 0x5161bf
leaq 0x3b0869(%rip), %rcx    # 0x55f1ab
leaq 0x3b07fc(%rip), %r8     # 0x55f145
movl $0x8c, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1ae95d
callq 0x1ae7c0
movq %rax, %rdi
movq 0x28(%rsp), %rsi
callq 0x1b20f0
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1ae9b8
movq 0x48d619(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x367682(%rip), %rsi    # 0x516013
leaq 0x3b0837(%rip), %rdx    # 0x55f1cf
leaq 0x3b080c(%rip), %rcx    # 0x55f1ab
leaq 0x3b079f(%rip), %r8     # 0x55f145
movl $0x8f, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1ae9ba
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1aea1d
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
addq $0x18, %rsi
movq 0x18(%rsp), %rdx
callq 0x1aee60
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0x1ae9f6
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x1aeb62
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1aea1b
movq 0x20(%rsp), %rax
movq $0x0, (%rax)
movl $0x0, 0x34(%rsp)
jmp 0x1aeb62
jmp 0x1aea1d
jmp 0x1aea1f
cmpl $0x0, 0xc(%rsp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1aea32
jmp 0x1aeadb
jmp 0x1aea34
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1aea4c
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1aea84
movq 0x48d54d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3675b6(%rip), %rsi    # 0x516013
leaq 0x3b0759(%rip), %rdx    # 0x55f1bd
leaq 0x3b0740(%rip), %rcx    # 0x55f1ab
leaq 0x3b06d3(%rip), %r8     # 0x55f145
movl $0x9d, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1aea86
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
addq $0x20, %rsi
movq 0x18(%rsp), %rdx
callq 0x1aee60
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jne 0x1aead4
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1aead4
movq 0x10(%rsp), %rdi
addq $0x18, %rdi
movq 0x10(%rsp), %rsi
addq $0x20, %rsi
callq 0x1af180
testb $0x1, %al
jne 0x1aead2
jmp 0x1aeadb
jmp 0x1aead6
jmp 0x1aeadb
jmp 0x1aea1f
cmpl $0x0, 0xc(%rsp)
jne 0x1aeb5a
jmp 0x1aeae4
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1aeb28
movq 0x48d4a9(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x367512(%rip), %rsi    # 0x516013
leaq 0x3b06d8(%rip), %rdx    # 0x55f1e0
leaq 0x3b069c(%rip), %rcx    # 0x55f1ab
leaq 0x3b062f(%rip), %r8     # 0x55f145
movl $0xa8, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1aeb2a
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x20(%rax)
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)