// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/targetbest_select_stream.c
// Function: targetbest_select_stream_next
static int targetbest_select_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                                         GtError *err)
{
  GtTargetbestSelectStream *tfs;
  GtGenomeNode *node;
  int had_err = 0;
  gt_error_check(err);
  tfs = targetbest_select_stream_cast(ns);

  if (!tfs->in_stream_processed) {
    while (!(had_err = gt_node_stream_next(tfs->in_stream, &node, err)) &&
           node) {
      if (gt_feature_node_try_cast(node) &&
          gt_feature_node_get_attribute((GtFeatureNode*) node, "Target")) {
        select_targetbest((GtFeatureNode*) node, tfs->trees,
                          tfs->target_to_elem);
      }
      else
        gt_dlist_add(tfs->trees, node);
    }
    tfs->next = gt_dlist_first(tfs->trees);
    tfs->in_stream_processed = true;
  }

  if (!had_err) {
    gt_assert(tfs->in_stream_processed);
    if (tfs->next) {
      *gn = gt_dlistelem_get_data(tfs->next);
      tfs->next = gt_dlistelem_next(tfs->next);
    }
    else
      *gn = NULL;
    return 0;
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
testq %rdx, %rdx
je 0x1270cc
movq %r14, %rdi
callq 0x89eb7
testb %al, %al
jne 0x12741a
callq 0x127008
movq %rax, %rdi
movq %rbx, %rsi
callq 0x102c81
movq %rax, %r15
cmpb $0x0, 0x30(%rax)
je 0x12711c
jne 0x127325
movq 0x310e76(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1bdf17(%rip), %rsi    # 0x2e5013
leaq 0x20f875(%rip), %rdx    # 0x336978
leaq 0x20f850(%rip), %rcx    # 0x33695a
leaq 0x20f821(%rip), %r8     # 0x336932
movl $0x93, %r9d
jmp 0x12740e
movq %rsp, %r12
movq %r15, 0x20(%rsp)
movq %r14, 0x18(%rsp)
movq 0x10(%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x102a22
movl %eax, %ebx
testl %eax, %eax
jne 0x12730f
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x12730f
callq 0xdc2f0
testq %rax, %rax
je 0x1272c6
movq (%rsp), %rdi
leaq 0x1c57ae(%rip), %rsi    # 0x2ec916
callq 0xd9628
testq %rax, %rax
je 0x1272c6
movq (%rsp), %rbp
testq %rbp, %rbp
je 0x127366
movq 0x18(%r15), %r13
testq %r13, %r13
je 0x127366
movq 0x28(%r15), %r12
movq %rbp, %rdi
leaq 0x1c5778(%rip), %rsi    # 0x2ec916
callq 0xd9628
testq %rax, %rax
je 0x127390
movq %rax, %r14
callq 0xacb84
movq %rax, %rbx
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
leaq 0x2433a2(%rip), %r9     # 0x36a570
pushq $0x0
pushq $0x0
callq 0xe0d28
addq $0x10, %rsp
testl %eax, %eax
jne 0x1273ba
cmpq $0x1, 0x30(%rsp)
jne 0x1272d8
callq 0xacb84
testq %rbx, %rbx
je 0x1273e4
movq %rax, %r15
testq %rax, %rax
je 0x1273e4
movq %r15, %rdi
callq 0xad357
movq %rbp, %rdi
callq 0xdd14a
movq %r15, %rdi
movq %rax, %rsi
callq 0xacd13
movq %r15, %rdi
pushq $0x9
popq %rsi
callq 0xaced9
movq %r15, %rdi
movq %rbx, %rsi
callq 0xacd13
movq %r15, %rdi
callq 0xad1fa
movq %r12, %rdi
movq %rax, %rsi
callq 0x8f482
testq %rax, %rax
je 0x1272b3
movq %rax, %r14
movq %rax, %rdi
callq 0x6e2bb
movq %rax, 0x28(%rsp)
movq %rbp, %rdi
callq 0xdaa3e
movss %xmm0, 0xc(%rsp)
movq 0x28(%rsp), %rdi
callq 0xdaa3e
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1272e5
movq %r14, %rdi
callq 0x6e2bb
movq %rax, %rdi
callq 0xde013
movq %r13, %rdi
movq %r14, %rsi
callq 0x6e631
movq %r15, %rdi
callq 0xad1fa
movq %r12, %rdi
movq %rax, %rsi
callq 0x8f4fb
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x1274f8
jmp 0x1272ed
movq 0x18(%r15), %rdi
movq (%rsp), %rsi
callq 0x6e34e
jmp 0x127129
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6e34e
jmp 0x1272fa
movq %rbp, %rdi
callq 0xde013
movq %r15, %rdi
callq 0xae103
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %r14
movq %rsp, %r12
movq %rbx, %rdi
callq 0xae103
jmp 0x127129
movq 0x18(%r15), %rdi
callq 0x6e1b4
movq %rax, 0x20(%r15)
movb $0x1, 0x30(%r15)
testl %ebx, %ebx
jne 0x127355
movq 0x20(%r15), %rdi
testq %rdi, %rdi
je 0x12734a
callq 0x6e2bb
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq 0x20(%r15), %rdi
callq 0x6e2fe
movq %rax, 0x20(%r15)
jmp 0x127353
movq 0x10(%rsp), %rax
andq $0x0, (%rax)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x310bfb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1bdc9c(%rip), %rsi    # 0x2e5013
leaq 0x20f613(%rip), %rdx    # 0x336991
leaq 0x20f625(%rip), %rcx    # 0x3369aa
leaq 0x20f5a6(%rip), %r8     # 0x336932
pushq $0x58
jmp 0x12740c
movq 0x310bd1(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1bdc72(%rip), %rsi    # 0x2e5013
leaq 0x1e423b(%rip), %rdx    # 0x30b5e3
leaq 0x20f5fb(%rip), %rcx    # 0x3369aa
leaq 0x20f57c(%rip), %r8     # 0x336932
pushq $0x5a
jmp 0x12740c
movq 0x310ba7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1bdc48(%rip), %rsi    # 0x2e5013
leaq 0x1be2ad(%rip), %rdx    # 0x2e567f
leaq 0x20f5d1(%rip), %rcx    # 0x3369aa
leaq 0x20f552(%rip), %r8     # 0x336932
pushq $0x5f
jmp 0x12740c
movq 0x310b7d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1bdc1e(%rip), %rsi    # 0x2e5013
leaq 0x20f5c0(%rip), %rdx    # 0x3369bc
leaq 0x20f5d5(%rip), %rcx    # 0x3369d8
leaq 0x20f528(%rip), %r8     # 0x336932
pushq $0x2f
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x310b47(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1bdbe8(%rip), %rsi    # 0x2e5013
leaq 0x1bdd8d(%rip), %rdx    # 0x2e51bf
leaq 0x20f521(%rip), %rcx    # 0x33695a
leaq 0x20f4f2(%rip), %r8     # 0x336932
movl $0x80, %r9d
jmp 0x12740e