// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq %rsi, %r14
movq %rdi, %rbx
testq %rdx, %rdx
je 0x1750c4
movq %r13, %rdi
callq 0xfcc32
testb %al, %al
jne 0x17573f
callq 0x175000
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1630b1
xorl %ebp, %ebp
testq %r14, %r14
je 0x1756fe
movq %rax, %r12
movq %r14, %rdi
callq 0x142988
cmpq 0x48(%r12), %rax
je 0x175104
movq %r14, %rdi
callq 0x142988
cmpq 0x50(%r12), %rax
jne 0x1756fe
movq 0x10(%r12), %rdi
callq 0x144041
movq %rax, %rbx
movq %r14, %rdi
callq 0x144679
leaq 0x98(%rsp), %rcx
movq %rax, (%rcx)
movq %rdx, 0x8(%rcx)
movq %r13, 0x50(%rsp)
movq %r14, 0x28(%rsp)
movq %r12, 0x38(%rsp)
movq %rbx, 0x80(%rsp)
movq %rbx, %rdi
callq 0x1440ea
testq %rax, %rax
je 0x1756f4
movq %rax, %r15
movq %rax, %rdi
callq 0x142988
xorl %ebp, %ebp
cmpq 0x38(%r12), %rax
jne 0x1756ea
movq %r15, %rdi
callq 0x1424d6
movl %eax, 0x34(%rsp)
movq %r15, 0x18(%rsp)
movq %r15, %rdi
callq 0x143f54
movq %rax, 0x68(%rsp)
xorl %r15d, %r15d
leaq 0x70(%rsp), %r14
movq 0x68(%rsp), %rdi
callq 0x1440ea
testq %rax, %rax
je 0x1756d6
movq %rax, %rbx
movq %rax, %rdi
callq 0x142988
xorl %ebp, %ebp
cmpq 0x40(%r12), %rax
jne 0x1756cc
movq %rbx, %rdi
callq 0x144679
movq %rax, 0x70(%rsp)
movq %rdx, 0x78(%rsp)
leaq 0x98(%rsp), %rdi
movq %r14, %rsi
callq 0x112246
testb %al, %al
je 0x17567e
movq 0x20(%r12), %rdi
movq 0x18(%rsp), %rsi
callq 0x100add
testq %rax, %rax
je 0x17572b
movq 0x98(%rsp), %rbx
subq 0x70(%rsp), %rbx
jb 0x175726
movq %rax, %r14
addq %r15, %rbx
cmpl $0x1, 0x34(%rsp)
jne 0x175229
movq %r14, %rdi
callq 0x172f0
notq %rbx
addq %rax, %rbx
movq 0x18(%rsp), %r15
movq %r14, %rdi
callq 0x172f0
cmpq %rax, %rbx
jae 0x175730
movb (%r14,%rbx), %al
movb %al, 0x9(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x20ba7a(%rip), %rsi    # 0x380ccd
callq 0x141f50
movq %rax, %rdi
callq 0xe4290
movq %rax, %rbp
testq %rax, %rax
leaq 0x70(%rsp), %r14
je 0x1752b3
movq %r15, %rdi
callq 0x1424d6
cmpl $0x1, %eax
jne 0x175294
movsbl 0x9(%rsp), %esi
leaq 0x9(%rsp), %rdi
movq %r13, %rdx
callq 0x2f7ce8
testl %eax, %eax
jne 0x17573a
callq 0x170d0
movq (%rax), %rax
movsbq 0x9(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movsbq (%rbp), %rdx
cmpl (%rax,%rdx,4), %ecx
jne 0x175735
movq 0x28(%rsp), %rdi
leaq 0x20ba1c(%rip), %rsi    # 0x380cdb
callq 0x141f50
movq %rax, %rdi
callq 0xe4290
testq %rax, %rax
movq %rbx, 0x58(%rsp)
je 0x1756c2
movq %rax, %rsi
movq %rbp, 0x60(%rsp)
movq %rbx, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
movq %rax, 0x90(%rsp)
subq %rax, %rbx
movq %rbx, 0x88(%rsp)
xorl %edx, %edx
movq %rsi, %r12
movq %rsi, %rbx
movq %rsi, 0x40(%rsp)
movzbl (%r12), %r14d
cmpl $0x2c, %r14d
je 0x175357
xorl %ebp, %ebp
testl %r14d, %r14d
je 0x17568d
cmpl $0x3b, %r14d
je 0x17568d
movl %r14d, %eax
cmpb 0x9(%rsp), %r14b
je 0x17535b
movb %r14b, 0xa(%rsp)
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x175374
movb (%rax), %bpl
jmp 0x175377
movb 0x9(%rsp), %al
xorl %ecx, %ecx
cmpb %al, %r14b
sete %cl
addq %rcx, %rdx
xorl %ebp, %ebp
incq %r12
testl %ebp, %ebp
je 0x175319
jmp 0x17568d
movb $0x2d, %bpl
movb %bpl, 0xb(%rsp)
cmpl $0x1, 0x34(%rsp)
movq %rdx, 0x20(%rsp)
jne 0x1753c6
movsbl %bpl, %esi
leaq 0xb(%rsp), %rdi
movq %r13, %rdx
callq 0x2f7ce8
testl %eax, %eax
jne 0x1753b3
movsbl 0xa(%rsp), %esi
leaq 0xa(%rsp), %rdi
movq %r13, %rdx
callq 0x2f7ce8
testl %eax, %eax
je 0x1753bc
movl %eax, %ebp
movq 0x20(%rsp), %rdx
jmp 0x175368
movb 0xa(%rsp), %r14b
movb 0xb(%rsp), %bpl
movsbl %r14b, %ebx
movq 0x28(%rsp), %rdi
leaq 0x20b82a(%rip), %rsi    # 0x380c00
callq 0x141f50
leaq 0x21e04e(%rip), %rdi    # 0x393430
movl %ebx, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x103d72
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
movq %r15, %rsi
callq 0x100add
testq %rax, %rax
je 0x17571c
movq %rax, %rbx
movb %bpl, 0x14(%rsp)
movq %rax, %rdi
callq 0x172f0
cmpq 0x58(%rsp), %rax
jbe 0x175712
movq 0x90(%rsp), %rax
movb (%rbx,%rax), %r15b
movb %r15b, 0x11(%rsp)
movb %r15b, 0xc(%rsp)
movb 0x1(%rbx,%rax), %r13b
movb %r13b, 0x12(%rsp)
movb %r13b, 0xd(%rsp)
movb 0x2(%rbx,%rax), %bl
movb %bl, 0x13(%rsp)
movb %bl, 0xe(%rsp)
movq 0x88(%rsp), %rbp
movb %r14b, 0xc(%rsp,%rbp)
callq 0x170d0
movq (%rax), %rax
movsbq 0x11(%rsp,%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movsbq 0x14(%rsp), %rdx
cmpl (%rax,%rdx,4), %ecx
jne 0x175717
movq 0x38(%rsp), %r14
movq 0x28(%r14), %rdi
movsbl %r15b, %ebp
movsbl %r13b, %r13d
movsbl %bl, %ebx
movl %ebp, %esi
movl %r13d, %edx
movl %ebx, %ecx
callq 0x11e2ea
movl %eax, %r15d
movq 0x28(%r14), %rdi
movsbl 0xc(%rsp), %r14d
movsbl 0xd(%rsp), %edx
movsbl 0xe(%rsp), %ecx
movl %r14d, %esi
movl %edx, 0x14(%rsp)
movl %ecx, 0x4c(%rsp)
callq 0x11e2ea
testb %r15b, %r15b
je 0x1754e1
leaq 0x21dfda(%rip), %rdi    # 0x3934ae
testb %al, %al
jne 0x1754f0
leaq 0x21dfe5(%rip), %rdi    # 0x3934c4
jmp 0x1754f0
leaq 0x21dfe6(%rip), %rdi    # 0x3934ce
testb %al, %al
je 0x1755f0
callq 0x11c5ff
testq %rax, %rax
je 0x175721
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x20b7e7(%rip), %rsi    # 0x380cf4
callq 0x141f50
testq %rax, %rax
movq 0x50(%rsp), %r13
movq 0x18(%rsp), %r15
je 0x175548
movq %rax, %rdi
callq 0x11acc9
movq %rax, %rbp
movq %rax, %rdi
leaq 0x22bc06(%rip), %rsi    # 0x3a113c
callq 0x11acf3
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x11acf3
jmp 0x175553
movq %rbx, %rdi
callq 0x11acc9
movq %rax, %rbp
movq %rbp, %rdi
leaq 0x24cbc3(%rip), %rbx    # 0x3c2120
movq %rbx, %rsi
callq 0x11acf3
movq %rbp, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0x11ae72
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x11acf3
movq %r15, %rdi
callq 0x142988
movq %rbp, %rdi
movq %rax, %rsi
callq 0x11acf3
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x11acf3
movq %r15, %rdi
leaq 0x26506f(%rip), %rsi    # 0x3da617
callq 0x141f50
movq %rbp, %rdi
movq %rax, %rsi
callq 0x11acf3
movq %rbp, %rdi
callq 0x11b0a1
movq 0x28(%rsp), %rdi
leaq 0x20b728(%rip), %rsi    # 0x380cf4
movq %rax, %rdx
callq 0x142a0f
movq %rbp, %rdi
callq 0x11b132
movq %rbp, %rdi
callq 0x11bdbf
movq %r14, %rdx
xorl %ebp, %ebp
movq 0x40(%rsp), %rbx
jmp 0x175655
movq 0x38(%rsp), %r15
movq 0x28(%r15), %rdi
movl %ebp, %esi
movl %r13d, %edx
movl %ebx, %ecx
leaq 0x10(%rsp), %r8
movq 0x50(%rsp), %r13
movq %r13, %r9
callq 0x11e072
testl %eax, %eax
je 0x175624
movl %eax, %ebp
movq 0x18(%rsp), %r15
movq 0x40(%rsp), %rbx
jmp 0x175650
movq 0x28(%r15), %rdi
movl %r14d, %esi
movl 0x14(%rsp), %edx
movl 0x4c(%rsp), %ecx
leaq 0xf(%rsp), %r8
movq %r13, %r9
callq 0x11e072
testl %eax, %eax
movq 0x40(%rsp), %rbx
je 0x17565d
movl %eax, %ebp
movq 0x18(%rsp), %r15
movq 0x20(%rsp), %rdx
incq %rdx
jmp 0x175368
movb 0xf(%rsp), %al
leaq 0x21de72(%rip), %rdi    # 0x3934da
cmpb 0x10(%rsp), %al
je 0x1754f0
leaq 0x21de74(%rip), %rdi    # 0x3934ed
jmp 0x1754f0
movq %r14, %rdi
callq 0x112233
addq %r15, %rax
xorl %ebp, %ebp
jmp 0x1756c9
movq %rbx, %rdi
leaq 0x21dcd5(%rip), %rbx    # 0x39336c
movq %rbx, %rsi
movl $0x105, %edx            # imm = 0x105
callq 0x1045eb
movq 0x60(%rsp), %rdi
movq %rbx, %rsi
movl $0x106, %edx            # imm = 0x106
callq 0x1045eb
movq 0x38(%rsp), %r12
leaq 0x70(%rsp), %r14
jmp 0x1756c4
xorl %ebp, %ebp
movq 0x58(%rsp), %rax
movq %rax, %r15
testl %ebp, %ebp
je 0x17518e
jmp 0x1756d8
xorl %ebp, %ebp
movq 0x68(%rsp), %rdi
callq 0x14417c
movq 0x80(%rsp), %rbx
testl %ebp, %ebp
je 0x17513f
jmp 0x1756f6
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x14417c
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x54c59
callq 0x54c90
callq 0x54d00
callq 0x54cc7
callq 0x54d37
callq 0x54d70
callq 0x54bae
callq 0x54c20
callq 0x54be7
callq 0x54b75