// File: /workspace/github_c_makefile_star2_O3/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 0x183e5c
movq %r12, %rdi
callq 0xfcc32
testb %al, %al
jne 0x184085
callq 0x183dc0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x162ff7
cmpq $0x0, 0x20(%rax)
jne 0x184080
movq %rax, %rbx
leaq 0x18(%rax), %r15
cmpq $0x0, 0x18(%rax)
je 0x18404d
movq %r13, 0x10(%rsp)
cmpq $0x0, 0x20(%rbx)
jne 0x184025
movq %rbx, %r13
addq $0x20, %r13
movq %r15, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x10(%rbx), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x162e68
testl %eax, %eax
jne 0x184060
movq (%r13), %rbx
testq %rbx, %rbx
je 0x18402a
movq (%r15), %r14
testq %r14, %r14
je 0x18407b
movq %r14, %rdi
callq 0x143cab
movq %rax, %rbp
movq %rbx, %rdi
callq 0x143cab
testq %rbp, %rbp
je 0x18402a
testq %rax, %rax
je 0x18402a
movq %r12, %r15
movq %r14, %rdi
callq 0x143f54
movq %rax, %rbp
movq %rbx, %rdi
callq 0x143f54
movq %rax, %rbx
movq %rbp, %rdi
callq 0x1440ea
movq %rax, %r14
movq %rbx, %rdi
callq 0x1440ea
testq %r14, %r14
setne %r12b
testq %rax, %rax
setne %cl
andb %r12b, %cl
cmpb $0x1, %cl
jne 0x183f75
movq %r14, %rdi
movq %rax, %rsi
callq 0x1435d6
testb %al, %al
je 0x183f72
movq %rbp, %rdi
callq 0x1440ea
movq %rax, %r14
movq %rbx, %rdi
callq 0x1440ea
testq %r14, %r14
setne %r12b
je 0x183f75
testq %rax, %rax
jne 0x183f40
jmp 0x183f75
movb $0x1, %r12b
movq %rbx, %rdi
callq 0x1440ea
movq %rax, %r14
movq %rbp, %rdi
callq 0x14417c
movq %rbx, %rdi
callq 0x14417c
testb %r12b, %r12b
movq %r15, %r12
movq 0x20(%rsp), %r15
jne 0x18402a
testq %r14, %r14
jne 0x18402a
movq (%r15), %rdi
callq 0x1429c8
movl %eax, %ebx
xorps %xmm0, %xmm0
testb %al, %al
je 0x183fc3
movq (%r15), %rdi
callq 0x142cc3
movss %xmm0, 0xc(%rsp)
movq (%r13), %rdi
callq 0x1429c8
testb %al, %al
je 0x183ff2
movq (%r13), %rdi
callq 0x142cc3
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
setae %al
andb %al, %bl
cmpb $0x1, %bl
jne 0x184000
movq (%r13), %rdi
callq 0x1451a0
movq (%r15), %rax
jmp 0x18400f
movq (%r15), %rdi
callq 0x1451a0
movq (%r13), %rax
movq %rax, (%r15)
movq $0x0, (%r13)
testq %rax, %rax
movq 0x18(%rsp), %rbx
jne 0x183eaa
callq 0x596fb
movq (%r15), %rax
testq %rax, %rax
je 0x18408a
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq (%r13), %rax
movq %rax, (%r15)
movq $0x0, (%r13)
xorl %eax, %eax
jmp 0x184060
movq 0x10(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x162e68
testl %eax, %eax
je 0x18406f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, (%r15)
jne 0x183e89
jmp 0x184041
callq 0x59732
callq 0x596c4
callq 0x5968d
callq 0x59769