// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/snp_annotator_stream.c
// Function: snp_annotator_stream_process_current_gene
static int snp_annotator_stream_process_current_gene(GtSNPAnnotatorStream *sas,
                                                     GtError *err)
{
  int had_err = 0;
  GtUword i;
  GtUword nof_genes = gt_array_size(sas->cur_gene_set);
  gt_error_check(err);

  if (gt_queue_size(sas->snps) > 0) {
    /* we need to process SNPs for a gene cluster*/
    gt_assert(gt_queue_size(sas->outqueue) == 0);

    for (i = 0; !had_err && i < nof_genes; i++) {
      GtNodeVisitor *sav;
      GtFeatureNode *gene;
      gene = *(GtFeatureNode**) gt_array_get(sas->cur_gene_set, i);
      sav = gt_snp_annotator_visitor_new(gene, sas->tt, sas->rmap, err);
      if (!sav)
        had_err = -1;
      if (!had_err) {
        if (i < nof_genes-1) {
          had_err = gt_queue_iterate(sas->snps,
                                     snp_annotator_stream_process_snp,
                                     sav, err);
        } else {
          while (!had_err && gt_queue_size(sas->snps) > 0) {
            GtFeatureNode *snp = (GtFeatureNode*) gt_queue_get(sas->snps);
            had_err = gt_genome_node_accept((GtGenomeNode*) snp, sav, err);
            gt_queue_add(sas->outqueue, snp);
            gt_genome_node_delete((GtGenomeNode*) snp);
          }
        }
        gt_node_visitor_delete(sav);
      }
      gt_genome_node_delete((GtGenomeNode*) gene);
    }
  } else {
    /* no SNPs for this gene cluster, delete it */
    for (i = 0; !had_err && i < nof_genes; i++) {
      gt_genome_node_delete(*(GtGenomeNode**) gt_array_get(sas->cur_gene_set,
                                                           i));
    }
  }
  gt_assert(gt_queue_size(sas->snps) == 0);
  gt_array_reset(sas->cur_gene_set);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
callq 0xd4a9a
movq %rax, %r15
testq %r14, %r14
je 0x17d264
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x17d3d4
movq 0x48(%rbx), %rdi
callq 0x112a74
testq %rax, %rax
je 0x17d37a
movq 0x50(%rbx), %rdi
callq 0x112a74
testq %rax, %rax
jne 0x17d3d9
testq %r15, %r15
je 0x17d3a3
leaq -0x1(%r15), %rax
movq %rax, (%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r15, 0x10(%rsp)
movq 0x20(%rbx), %rdi
movq %rbp, %rsi
callq 0xd47ba
movq (%rax), %r15
movq 0x18(%rbx), %rsi
movq 0x40(%rbx), %rdx
movq %r15, %rdi
movq %r14, %r13
movq %r14, %rcx
callq 0x17db59
movq %rax, %r14
cmpq $0x1, %rax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %r12d
jne 0x17d357
movq %r15, 0x8(%rsp)
cmpq (%rsp), %rbp
jae 0x17d301
movq 0x48(%rbx), %rdi
leaq 0xed(%rip), %rsi        # 0x17d3de
movq %r14, %rdx
movq %r13, %rcx
callq 0x112cb1
movl %eax, %r12d
jmp 0x17d34a
movq 0x48(%rbx), %rdi
callq 0x112a74
testq %rax, %rax
je 0x17d347
movq 0x48(%rbx), %rdi
callq 0x112a12
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x14b992
movl %eax, %r12d
movq 0x50(%rbx), %rdi
movq %r15, %rsi
callq 0x112923
movq %r15, %rdi
callq 0x14c43a
testl %r12d, %r12d
je 0x17d301
jmp 0x17d34a
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x16b162
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x14c43a
testl %r12d, %r12d
jne 0x17d3a6
incq %rbp
movq 0x10(%rsp), %r15
cmpq %r15, %rbp
movq %r13, %r14
jb 0x17d2a3
jmp 0x17d3a6
testq %r15, %r15
je 0x17d3a3
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0xd47ba
movq (%rax), %rdi
callq 0x14c43a
incq %r14
cmpq %r14, %r15
jne 0x17d385
jmp 0x17d3a6
xorl %r12d, %r12d
movq 0x48(%rbx), %rdi
callq 0x112a74
testq %rax, %rax
jne 0x17d3cf
movq 0x20(%rbx), %rdi
callq 0xd4ad3
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x55c65
callq 0x55bf7
callq 0x55c2e