// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/uniq_stream.c
// Function: uniq_stream_next
static int uniq_stream_next(GtNodeStream *ns, GtGenomeNode **gn, GtError *err)
{
  GtUniqStream *us;
  int had_err;
  gt_error_check(err);
  us = uniq_stream_cast(ns);

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

  /* uniq loop */
  for (;;) {
    gt_assert(us->first_node && !us->second_node);
    had_err = gt_node_stream_next(us->in_stream, &us->second_node, err);
    if (!had_err && us->second_node) {
      if (!uniq(&us->first_node, &us->second_node))
        break; /* no uniq possible */
    }
    else
      break;
  }

  /* serve node */
  if (!had_err) {
    gt_assert(us->first_node);
    *gn = us->first_node;
    us->first_node = us->second_node;
    us->second_node = NULL;
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
testq %rdx, %rdx
je 0x18c588
movq %r12, %rdi
callq 0x101a9a
testb %al, %al
jne 0x18c7c6
callq 0x18c4ec
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16ae64
cmpq $0x0, 0x20(%rax)
jne 0x18c7c1
movq %rax, %rbx
leaq 0x18(%rax), %r15
cmpq $0x0, 0x18(%rax)
je 0x18c787
movq %r13, 0x10(%rsp)
movq %rbx, 0x20(%rsp)
movq %rbx, %r13
addq $0x20, %r13
movq %r15, 0x18(%rsp)
cmpq $0x0, (%r15)
je 0x18c7b7
cmpq $0x0, (%r13)
jne 0x18c7b7
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x16ace8
testl %eax, %eax
jne 0x18c79a
movl %eax, 0x8(%rsp)
movq (%r13), %r14
testq %r14, %r14
je 0x18c762
movq (%r15), %rbx
testq %rbx, %rbx
je 0x18c7bc
movq %r12, %r15
movq %rbx, %rdi
callq 0x14aefc
movq %rax, %r12
movq %r14, %rdi
callq 0x14aefc
xorl %ebp, %ebp
testq %r12, %r12
je 0x18c6da
testq %rax, %rax
je 0x18c6da
movq %rbx, %rdi
callq 0x14b1a8
movq %rax, %rbx
movq %r14, %rdi
callq 0x14b1a8
movq %rax, %r14
movq %rbx, %rdi
callq 0x14b33e
movq %rax, %r12
movq %r14, %rdi
callq 0x14b33e
testq %r12, %r12
setne %bpl
testq %rax, %rax
setne %cl
andb %bpl, %cl
cmpb $0x1, %cl
jne 0x18c6b6
movq %r12, %rdi
movq %rax, %rsi
callq 0x14a820
testb %al, %al
je 0x18c6b3
movq %rbx, %rdi
callq 0x14b33e
movq %rax, %r12
movq %r14, %rdi
callq 0x14b33e
testq %r12, %r12
setne %bpl
je 0x18c6b6
testq %rax, %rax
jne 0x18c681
jmp 0x18c6b6
movb $0x1, %bpl
movq %r14, %rdi
callq 0x14b33e
testq %rax, %rax
sete %al
notb %bpl
andb %al, %bpl
movq %rbx, %rdi
callq 0x14b3d0
movq %r14, %rdi
callq 0x14b3d0
testb %bpl, %bpl
movq %r15, %r12
movq 0x18(%rsp), %r15
je 0x18c762
movq (%r15), %rdi
callq 0x149bf5
movl %eax, %ebx
xorps %xmm0, %xmm0
testb %al, %al
je 0x18c700
movq (%r15), %rdi
callq 0x149ef0
movss %xmm0, 0xc(%rsp)
movq (%r13), %rdi
callq 0x149bf5
movl %eax, %r14d
testb %al, %al
xorps %xmm0, %xmm0
je 0x18c722
movq (%r13), %rdi
callq 0x149ef0
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
setae %al
testb %r14b, %r14b
je 0x18c748
andb %al, %bl
jne 0x18c748
movq (%r15), %rdi
callq 0x14c43a
movq (%r13), %rax
movq %rax, (%r15)
jmp 0x18c751
movq (%r13), %rdi
callq 0x14c43a
movq $0x0, (%r13)
testb %bpl, %bpl
jne 0x18c5cb
movq (%r15), %rax
testq %rax, %rax
je 0x18c7cb
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq (%r13), %rax
movq %rax, (%r15)
movl 0x8(%rsp), %eax
movq $0x0, (%r13)
jmp 0x18c79a
movq 0x10(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x16ace8
testl %eax, %eax
je 0x18c7a9
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, (%r15)
jne 0x18c5b5
xorl %eax, %eax
jmp 0x18c77d
callq 0x5a9a9
callq 0x5a939
callq 0x5a902
callq 0x5a8cb
callq 0x5a970