// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movl $0x0, 0x4(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x1ee19b
movq 0x18(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1ee163
jmp 0x1ee19b
movq 0x44de36(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x327e9f(%rip), %rsi    # 0x516013
leaq 0x328044(%rip), %rdx    # 0x5161bf
leaq 0x37adfe(%rip), %rcx    # 0x568f80
leaq 0x37adcf(%rip), %r8     # 0x568f58
movl $0x80, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1ee19d
callq 0x1ee060
movq %rax, %rdi
movq 0x28(%rsp), %rsi
callq 0x1b20f0
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
testb $0x1, 0x30(%rax)
jne 0x1ee285
jmp 0x1ee1c5
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rsp), %rdx
leaq 0x8(%rsp), %rsi
callq 0x1b1d90
movl %eax, %ecx
movl %ecx, 0x4(%rsp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0x3(%rsp)
jne 0x1ee1fb
cmpq $0x0, 0x8(%rsp)
setne %al
movb %al, 0x3(%rsp)
movb 0x3(%rsp), %al
testb $0x1, %al
jne 0x1ee205
jmp 0x1ee262
movq 0x8(%rsp), %rdi
callq 0x170450
cmpq $0x0, %rax
je 0x1ee24a
movq 0x8(%rsp), %rdi
leaq 0x32f77f(%rip), %rsi    # 0x51d9a0
callq 0x16c040
cmpq $0x0, %rax
je 0x1ee24a
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rdx
callq 0x1ee430
jmp 0x1ee25d
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0xa61a0
jmp 0x1ee1c5
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0xa5f40
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x10(%rsp), %rax
movb $0x1, 0x30(%rax)
cmpl $0x0, 0x4(%rsp)
jne 0x1ee32e
jmp 0x1ee292
movq 0x10(%rsp), %rax
testb $0x1, 0x30(%rax)
jne 0x1ee2d5
movq 0x44dcfc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x327d65(%rip), %rsi    # 0x516013
leaq 0x37ace9(%rip), %rdx    # 0x568f9e
leaq 0x37acc4(%rip), %rcx    # 0x568f80
leaq 0x37ac95(%rip), %r8     # 0x568f58
movl $0x93, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1ee2d7
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1ee318
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xa60d0
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xa6120
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0x1ee324
movq 0x20(%rsp), %rax
movq $0x0, (%rax)
movl $0x0, 0x34(%rsp)
jmp 0x1ee336
movl 0x4(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nop