// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/snp_annotator_visitor.c
// Function: snp_annotator_visitor_feature_node
static int snp_annotator_visitor_feature_node(GtNodeVisitor *nv,
                                              GtFeatureNode *fn,
                                              GtError *err)
{
  int had_err = 0;
  GtSNPAnnotatorVisitor *sav;
  GtFeatureNodeIterator *fni,
                        *mrnafni;
  GtFeatureNode *curnode,
                *curnode2;
  GtRange snp_rng;
  gt_error_check(err);
  sav = snp_annotator_visitor_cast(nv);

  /* ignore non-nodes */
  if (!fn) return 0;

  /* only process SNPs */
  if (!(gt_feature_node_get_type(fn) == sav->SNV_type ||
        gt_feature_node_get_type(fn) == sav->SNP_type)) {
    return 0;
  }

  fni = gt_feature_node_iterator_new_direct(sav->gene);
  snp_rng = gt_genome_node_get_range((GtGenomeNode*) fn);
  while (!had_err && (curnode = gt_feature_node_iterator_next(fni))) {
    if (gt_feature_node_get_type(curnode) == sav->mRNA_type) {
      GtStrand mrna_strand = gt_feature_node_get_strand(curnode);
#ifndef NDEBUG
      const char *refstr;
#endif
      GtUword mrnasnppos = 0;
      mrnafni = gt_feature_node_iterator_new(curnode);
      while (!had_err && (curnode2 = gt_feature_node_iterator_next(mrnafni))) {
        if (gt_feature_node_get_type(curnode2) == sav->CDS_type) {
          GtRange cds_rng = gt_genome_node_get_range((GtGenomeNode*) curnode2);
          if (gt_range_overlap(&snp_rng, &cds_rng)) {
            char *mRNA,
                 origchar;
            char *variantchars, *variantptr = NULL;
            GT_UNUSED char *refchars, *refptr = NULL;
            mRNA = (char*) gt_hashmap_get(sav->rnaseqs, curnode);
            gt_assert(mRNA);
            gt_assert(snp_rng.start >= cds_rng.start);
            mrnasnppos += (snp_rng.start - cds_rng.start);
            if (mrna_strand == GT_STRAND_REVERSE)
              mrnasnppos = strlen(mRNA) - mrnasnppos - 1;
            gt_assert(mrnasnppos < strlen(mRNA));
            origchar = mRNA[mrnasnppos];
#ifndef NDEBUG
            refstr = refptr = gt_cstr_dup(gt_feature_node_get_attribute(fn,
                                                         GT_GVF_REFERENCE_SEQ));
            if (!had_err && refstr) {
              if (gt_feature_node_get_strand(curnode) == GT_STRAND_REVERSE) {
                int rval = gt_complement(&origchar, origchar, err);
                gt_assert(rval == 0);
              }
              gt_assert(toupper(origchar) == toupper(refstr[0]));
            }
#endif
            variantchars = variantptr = gt_cstr_dup(
                         gt_feature_node_get_attribute(fn, GT_GVF_VARIANT_SEQ));
            if (!had_err && variantchars) {
              GtUword i = 0;

              while (!had_err &&
                              (*variantchars != ';' && *variantchars != '\0')) {
                if (*variantchars != ',' && *variantchars != origchar) {
                  char variantchar = *variantchars;
#ifndef NDEBUG
                  char refchar = refstr ? refstr[0] : '-';  /* XXX */
                  if (!had_err && mrna_strand == GT_STRAND_REVERSE)
                    had_err = gt_complement(&refchar, refchar, err);
#endif
                  if (!had_err && mrna_strand == GT_STRAND_REVERSE)
                    had_err = gt_complement(&variantchar, variantchar, err);
                  if (!had_err) {
                    had_err = snp_annotator_classify_snp(sav, curnode, fn,
                                                         mrnasnppos,
                                                         i++,
                                                         variantchar,
#ifndef NDEBUG
                                                         refchar,
#endif
                                                         err);
                  }
                } else if (*variantchars == origchar) {
                  i++;
                }
                variantchars++;
              }
              gt_free(variantptr);
              gt_free(refptr);
            }
          } else {
            mrnasnppos += gt_range_length(&cds_rng);
          }
        }
      }
      gt_feature_node_iterator_delete(mrnafni);
    }
  }
  gt_feature_node_iterator_delete(fni);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
testq %rdx, %rdx
je 0x17d4ac
movq %r12, %rdi
callq 0x101a9a
testb %al, %al
jne 0x17db54
callq 0x17d3e8
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16af21
xorl %ebp, %ebp
testq %r13, %r13
je 0x17db0e
movq %rax, %r14
movq %r13, %rdi
callq 0x149bb2
cmpq 0x48(%r14), %rax
je 0x17d4ea
movq %r13, %rdi
callq 0x149bb2
cmpq 0x50(%r14), %rax
jne 0x17db0e
movq 0x10(%r14), %rdi
callq 0x14b295
movq %rax, %rbx
movq %r13, %rdi
callq 0x14b8df
movq %rax, 0x98(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rbx, %rdi
callq 0x14b33e
testq %rax, %rax
je 0x17db04
movq %rax, %r15
movq %r12, 0x30(%rsp)
movq %r13, 0x28(%rsp)
movq %r14, 0x48(%rsp)
movq %rbx, 0x68(%rsp)
movq %r15, %rdi
callq 0x149bb2
movl $0x0, %ebp
cmpq 0x38(%r14), %rax
jne 0x17daea
movq %r15, %rdi
callq 0x14970e
movl %eax, 0x14(%rsp)
movq %r15, %rdi
callq 0x14b1a8
movq %rax, 0x60(%rsp)
movq %rax, %rdi
callq 0x14b33e
testq %rax, %rax
je 0x17dad9
movq %rax, %rbx
movq %r15, 0x18(%rsp)
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x149bb2
xorl %ebp, %ebp
cmpq 0x40(%r14), %rax
jne 0x17dabd
movq %rbx, %rdi
callq 0x14b8df
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x88(%rsp), %rbx
movq %rbx, %rsi
callq 0x117826
testb %al, %al
je 0x17da71
movq 0x20(%r14), %rdi
movq 0x18(%rsp), %rsi
callq 0x105a11
testq %rax, %rax
je 0x17db22
movq 0x98(%rsp), %rbp
subq 0x88(%rsp), %rbp
jb 0x17db2c
movq %rax, %r14
addq %r15, %rbp
cmpl $0x1, 0x14(%rsp)
jne 0x17d616
movq %r14, %rdi
callq 0x172f0
notq %rbp
addq %rax, %rbp
movq 0x18(%rsp), %rbx
movq %r14, %rdi
callq 0x172f0
cmpq %rax, %rbp
jae 0x17db27
movb (%r14,%rbp), %al
movb %al, 0x9(%rsp)
movq %r13, %rdi
leaq 0x20ca4d(%rip), %rsi    # 0x38a08b
callq 0x14918c
movq %rax, %rdi
callq 0xe8760
movq %rax, 0x20(%rsp)
testq %rax, %rax
movq 0x48(%rsp), %r14
je 0x17d6a4
movq %rbx, %rdi
callq 0x14970e
cmpl $0x1, %eax
jne 0x17d681
movsbl 0x9(%rsp), %esi
leaq 0x9(%rsp), %rdi
movq %r12, %rdx
callq 0x301930
testl %eax, %eax
jne 0x17db4f
callq 0x170d0
movq (%rax), %rax
movsbq 0x9(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movq 0x20(%rsp), %rdx
movsbq (%rdx), %rdx
cmpl (%rax,%rdx,4), %ecx
jne 0x17db45
movq %r13, %rdi
leaq 0x20c9eb(%rip), %rsi    # 0x38a099
callq 0x14918c
movq %rax, %rdi
callq 0xe8760
testq %rax, %rax
movq %rbp, 0x58(%rsp)
je 0x17dab3
movq %rax, %r15
movq %rbp, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
movq %rax, 0x80(%rsp)
subq %rax, %rbp
movq %rbp, 0x78(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r15, 0x70(%rsp)
movq 0x20(%rsp), %rbx
movzbl (%r15), %eax
cmpl $0x2c, %eax
je 0x17d722
testl %eax, %eax
je 0x17da80
cmpl $0x3b, %eax
je 0x17da80
cmpb 0x9(%rsp), %al
jne 0x17d73c
xorl %ecx, %ecx
cmpb 0x9(%rsp), %al
sete %cl
addq %rcx, %r12
xorl %ebp, %ebp
incq %r15
testl %ebp, %ebp
je 0x17d702
jmp 0x17da80
movb (%r15), %al
movb %al, 0xa(%rsp)
testq %rbx, %rbx
je 0x17d74c
movb (%rbx), %al
jmp 0x17d74e
movb $0x2d, %al
xorl %ebp, %ebp
movb %al, 0xb(%rsp)
cmpl $0x1, 0x14(%rsp)
movq %r12, 0x38(%rsp)
jne 0x17d779
movsbl %al, %esi
leaq 0xb(%rsp), %rdi
movq 0x30(%rsp), %rdx
callq 0x301930
movq 0x38(%rsp), %r12
movl %eax, %ebp
cmpl $0x1, 0x14(%rsp)
jne 0x17d79f
testl %ebp, %ebp
jne 0x17d79f
movsbl 0xa(%rsp), %esi
leaq 0xa(%rsp), %rdi
movq 0x30(%rsp), %rdx
callq 0x301930
movq 0x38(%rsp), %r12
movl %eax, %ebp
testl %ebp, %ebp
jne 0x17d730
testq %r14, %r14
je 0x17db3b
movb 0xa(%rsp), %bl
movsbl %bl, %ebp
movsbq 0xb(%rsp), %r13
movq 0x28(%rsp), %rdi
leaq 0x20c7f9(%rip), %rsi    # 0x389fbe
callq 0x14918c
leaq 0x21f0db(%rip), %rdi    # 0x39c8ac
movl %ebp, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x108e02
movq 0x20(%r14), %rdi
movq 0x18(%rsp), %rsi
callq 0x105a11
testq %rax, %rax
je 0x17db36
movq %rax, %r14
movq %r13, 0x40(%rsp)
movq %rax, %rdi
callq 0x172f0
cmpq 0x58(%rsp), %rax
jbe 0x17db40
movq 0x80(%rsp), %rax
movb (%r14,%rax), %bpl
movb %bpl, 0x11(%rsp)
movb %bpl, 0xc(%rsp)
movb 0x1(%r14,%rax), %r12b
movb %r12b, 0x12(%rsp)
movb %r12b, 0xd(%rsp)
movb 0x2(%r14,%rax), %r14b
movb %r14b, 0x13(%rsp)
movb %r14b, 0xe(%rsp)
movq 0x78(%rsp), %r13
movb %bl, 0xc(%rsp,%r13)
callq 0x170d0
movq (%rax), %rax
movsbq 0x11(%rsp,%r13), %rcx
movl (%rax,%rcx,4), %ecx
movq 0x40(%rsp), %rdx
cmpl (%rax,%rdx,4), %ecx
jne 0x17db31
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rdi
movsbl %bpl, %ebp
movsbl %r12b, %ebx
movsbl %r14b, %ecx
movq %rax, %r14
movl %ebp, %esi
movl %ebx, %edx
movl %ecx, 0x40(%rsp)
callq 0x123fd2
movl %eax, %r13d
movq 0x28(%r14), %rdi
movsbl 0xc(%rsp), %r12d
movsbl 0xd(%rsp), %edx
movsbl 0xe(%rsp), %ecx
movl %r12d, %esi
movl %edx, 0x54(%rsp)
movl %ecx, 0x50(%rsp)
callq 0x123fd2
testb %r13b, %r13b
je 0x17d8d1
leaq 0x21f066(%rip), %rdi    # 0x39c92a
testb %al, %al
jne 0x17d8e4
leaq 0x21f071(%rip), %rdi    # 0x39c940
jmp 0x17d8e4
movl %r12d, %r13d
leaq 0x21f06f(%rip), %rdi    # 0x39c94a
testb %al, %al
movq 0x30(%rsp), %r12
je 0x17d946
callq 0x12234f
movq %rax, %r13
xorl %ebp, %ebp
movq 0x20(%rsp), %rbx
testl %ebp, %ebp
movq 0x38(%rsp), %r12
jne 0x17da43
testq %r13, %r13
je 0x17db4a
movq 0x28(%rsp), %rdi
leaq 0x20c79d(%rip), %rsi    # 0x38a0b2
callq 0x14918c
testq %rax, %rax
je 0x17d998
movq %rax, %rdi
callq 0x120955
movq %rax, %r14
movq %rax, %rdi
leaq 0x22cd65(%rip), %rsi    # 0x3aa699
callq 0x12097f
movq %r14, %rdi
movq %r13, %rsi
callq 0x12097f
jmp 0x17d9a3
movq 0x28(%r14), %rdi
movl %ebp, %esi
movl %ebx, %edx
movl 0x40(%rsp), %ecx
leaq 0x10(%rsp), %r8
movq %r12, %r9
callq 0x123d7c
movl %eax, %ebp
testl %eax, %eax
jne 0x17d983
movq 0x28(%r14), %rdi
movl %r13d, %esi
movl 0x54(%rsp), %edx
movl 0x50(%rsp), %ecx
leaq 0xf(%rsp), %r8
movq %r12, %r9
callq 0x123d7c
movl %eax, %ebp
testl %ebp, %ebp
movq 0x20(%rsp), %rbx
je 0x17da50
xorl %r13d, %r13d
jmp 0x17d8f3
movq %r13, %rdi
callq 0x120955
movq %rax, %r14
movq %r14, %rdi
leaq 0x24de9b(%rip), %rbx    # 0x3cb848
movq %rbx, %rsi
callq 0x12097f
movq %r14, %rdi
movq 0x38(%rsp), %r12
movq %r12, %rsi
callq 0x120af4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12097f
movq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x149bb2
movq %r14, %rdi
movq %rax, %rsi
callq 0x12097f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12097f
movq %r13, %rdi
leaq 0x26636f(%rip), %rsi    # 0x3e3d6c
callq 0x14918c
movq %r14, %rdi
movq %rax, %rsi
callq 0x12097f
movq %r14, %rdi
callq 0x120d23
movq 0x28(%rsp), %rdi
leaq 0x20c691(%rip), %rsi    # 0x38a0b2
movq %rax, %rdx
callq 0x149c3c
movq %r14, %rdi
callq 0x120db4
movq %r14, %rdi
callq 0x121b03
movq 0x48(%rsp), %r14
movq 0x20(%rsp), %rbx
incq %r12
movq 0x28(%rsp), %r13
jmp 0x17d730
movb 0xf(%rsp), %al
leaq 0x21eefb(%rip), %rdi    # 0x39c956
cmpb 0x10(%rsp), %al
je 0x17d8e4
leaq 0x21eefd(%rip), %rdi    # 0x39c969
jmp 0x17d8e4
movq %rbx, %rdi
callq 0x117813
addq %r15, %rax
xorl %ebp, %ebp
jmp 0x17daba
movq 0x70(%rsp), %rdi
movq %rbx, %r15
leaq 0x21ed46(%rip), %rbx    # 0x39c7d5
movq %rbx, %rsi
movl $0x105, %edx            # imm = 0x105
callq 0x109670
movq %r15, %rdi
movq %rbx, %rsi
movl $0x106, %edx            # imm = 0x106
callq 0x109670
movq 0x30(%rsp), %r12
jmp 0x17dab5
xorl %ebp, %ebp
movq 0x58(%rsp), %rax
movq %rax, %r15
testl %ebp, %ebp
jne 0x17dadb
movq 0x60(%rsp), %rdi
callq 0x14b33e
movq %rax, %rbx
testq %rax, %rax
jne 0x17d582
jmp 0x17dadb
xorl %ebp, %ebp
movq 0x60(%rsp), %rdi
callq 0x14b3d0
movq 0x68(%rsp), %rbx
testl %ebp, %ebp
jne 0x17db06
movq %rbx, %rdi
callq 0x14b33e
movq %rax, %r15
testq %rax, %rax
jne 0x17d536
jmp 0x17db06
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x14b3d0
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x55ece
callq 0x55cd5
callq 0x55e95
callq 0x55db7
callq 0x55e27
callq 0x55e5e
callq 0x55d80
callq 0x55d47
callq 0x55dee
callq 0x55d0e
callq 0x55c9c