// File: /workspace/github_c_makefile_star2_O2/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 %rsi, %r14
movq %rdi, %rbx
movq %rdx, 0x10(%rsp)
testq %rdx, %rdx
je 0x119743
movq 0x10(%rsp), %rdi
callq 0x89eb7
testb %al, %al
jne 0x119df6
callq 0x119680
movq %rax, %rdi
movq %rbx, %rsi
callq 0x102dfe
xorl %r12d, %r12d
testq %r14, %r14
je 0x119d5e
movq %rax, %r15
movq %r14, %rdi
callq 0xda338
cmpq 0x48(%r15), %rax
je 0x119782
movq %r14, %rdi
callq 0xda338
cmpq 0x50(%r15), %rax
jne 0x119d5e
movq 0x10(%r15), %rdi
callq 0xdc826
movq %rax, %rbx
movq %r14, %rdi
callq 0xdd1f4
leaq 0x98(%rsp), %rcx
movq %rax, (%rcx)
movq %rdx, 0x8(%rcx)
xorl %r12d, %r12d
movq %r14, 0x38(%rsp)
movq %rbx, 0x80(%rsp)
testl %r12d, %r12d
jne 0x119d56
movq %rbx, %rdi
callq 0xdc92e
testq %rax, %rax
je 0x119d56
movq %rax, %r13
movq %rax, %rdi
callq 0xda338
movl $0x0, %r12d
cmpq 0x38(%r15), %rax
jne 0x1197b5
movq %r13, %rdi
callq 0xd9d99
movl %eax, 0x2c(%rsp)
movq %r13, 0x20(%rsp)
movq %r13, %rdi
callq 0xdc6f0
movq %rax, %rbx
xorl %r13d, %r13d
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x119d41
movq %rbx, %rdi
callq 0xdc92e
testq %rax, %rax
je 0x119d41
movq %rax, %r14
movq %rax, %rdi
callq 0xda338
xorl %r12d, %r12d
cmpq 0x40(%r15), %rax
jne 0x119808
movq %r14, %rdi
callq 0xdd1f4
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x88(%rsp), %r14
movq %r14, %rsi
callq 0xa3234
testb %al, %al
je 0x119d31
movq 0x20(%r15), %rdi
movq 0x20(%rsp), %rsi
callq 0x8f482
testq %rax, %rax
je 0x119eba
movq %rax, %r14
movq 0x98(%rsp), %rax
subq 0x88(%rsp), %rax
jb 0x119e89
addq %r13, %rax
cmpl $0x1, 0x2c(%rsp)
movq %rax, %r13
jne 0x1198b9
movq %r14, %rdi
callq 0x172d0
notq %r13
addq %rax, %r13
movq 0x38(%rsp), %r12
movq 0x20(%rsp), %rbp
movq %r14, %rdi
callq 0x172d0
cmpq %rax, %r13
jae 0x119e58
movq %r13, 0x30(%rsp)
movb (%r14,%r13), %al
movb %al, 0x1(%rsp)
movq %r12, %rdi
leaq 0x2077f2(%rip), %rsi    # 0x3210dd
callq 0xd9628
movq %rax, %rdi
callq 0x6c2be
movq %rax, %r14
testq %rax, %rax
je 0x119947
movq %rbp, %rdi
callq 0xd9d99
cmpl $0x1, %eax
jne 0x119929
movsbl 0x1(%rsp), %esi
leaq 0x1(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x292b2c
testl %eax, %eax
jne 0x119f16
callq 0x170c0
movq (%rax), %rax
movsbq 0x1(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movsbq (%r14), %rdx
cmpl (%rax,%rdx,4), %ecx
jne 0x119ee8
movq %r12, %rdi
leaq 0x20779a(%rip), %rsi    # 0x3210eb
callq 0xd9628
movq %rax, %rdi
callq 0x6c2be
testq %rax, %rax
je 0x119d24
movq %rax, %rdi
xorl %r12d, %r12d
movq 0x30(%rsp), %rsi
movq %rsi, %rax
xorl %edx, %edx
pushq $0x3
popq %rcx
divq %rcx
movq %rdx, 0x78(%rsp)
subq %rdx, %rsi
movq %rsi, 0x70(%rsp)
movq %rdi, 0x60(%rsp)
xorl %ebp, %ebp
movq %r14, 0x58(%rsp)
movq %r15, 0x68(%rsp)
testl %r12d, %r12d
jne 0x119cf6
movzbl (%rdi), %r13d
cmpl $0x2c, %r13d
je 0x1199df
testl %r13d, %r13d
je 0x119cf6
cmpl $0x3b, %r13d
je 0x119cf6
movl %r13d, %eax
cmpb 0x1(%rsp), %r13b
je 0x1199e3
movb %r13b, 0x2(%rsp)
testq %r14, %r14
movq %rdi, 0x18(%rsp)
je 0x1199f6
movb (%r14), %r12b
jmp 0x1199f9
movb 0x1(%rsp), %al
xorl %ecx, %ecx
cmpb %al, %r13b
sete %cl
addq %rcx, %rbp
xorl %r12d, %r12d
incq %rdi
jmp 0x11999b
movb $0x2d, %r12b
movb %r12b, 0x3(%rsp)
cmpl $0x1, 0x2c(%rsp)
jne 0x119a48
movsbl %r12b, %esi
leaq 0x3(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x292b2c
testl %eax, %eax
jne 0x119a34
movsbl 0x2(%rsp), %esi
leaq 0x2(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x292b2c
testl %eax, %eax
je 0x119a3e
movl %eax, %r12d
movq 0x18(%rsp), %rdi
jmp 0x1199f1
movb 0x2(%rsp), %r13b
movb 0x3(%rsp), %r12b
movsbl %r13b, %r14d
movq 0x38(%rsp), %rdi
leaq 0x2075b8(%rip), %rsi    # 0x321010
callq 0xd9628
leaq 0x219d25(%rip), %rdi    # 0x333789
movl %r14d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x92a82
movq 0x20(%r15), %rdi
movq 0x20(%rsp), %rsi
callq 0x8f482
testq %rax, %rax
je 0x119dc7
movq %rax, %r14
movb %r12b, 0xc(%rsp)
movq %rbp, 0x40(%rsp)
movq %rax, %rdi
callq 0x172d0
cmpq 0x30(%rsp), %rax
jbe 0x119d73
movq 0x70(%rsp), %rax
movb (%r14,%rax), %r12b
movb %r12b, 0x9(%rsp)
movb %r12b, 0x4(%rsp)
movb 0x1(%r14,%rax), %bpl
movb %bpl, 0xa(%rsp)
movb %bpl, 0x5(%rsp)
movb 0x2(%r14,%rax), %r14b
movb %r14b, 0xb(%rsp)
movb %r14b, 0x6(%rsp)
movq 0x78(%rsp), %r15
movb %r13b, 0x4(%rsp,%r15)
callq 0x170c0
movq (%rax), %rax
movsbq 0x9(%rsp,%r15), %rcx
movl (%rax,%rcx,4), %ecx
movsbq 0xc(%rsp), %rdx
cmpl (%rax,%rdx,4), %ecx
jne 0x119d9d
movq 0x68(%rsp), %r15
movq 0x28(%r15), %rdi
movsbl %r12b, %r12d
movsbl %bpl, %edx
movsbl %r14b, %ecx
movl %r12d, %esi
movl %edx, %r13d
movl %ecx, 0xc(%rsp)
callq 0xb1629
movl %eax, %r14d
movq 0x28(%r15), %rdi
movsbl 0x4(%rsp), %ebp
movsbl 0x5(%rsp), %edx
movsbl 0x6(%rsp), %ecx
movl %ebp, %esi
movl %edx, 0x50(%rsp)
movl %ecx, 0x54(%rsp)
callq 0xb1629
testb %r14b, %r14b
je 0x119b6a
leaq 0x219caf(%rip), %rdi    # 0x333807
testb %al, %al
movq 0x40(%rsp), %rbp
jne 0x119b82
leaq 0x219cb5(%rip), %rdi    # 0x33381d
jmp 0x119b82
movl %ebp, 0x4c(%rsp)
leaq 0x219cb2(%rip), %rdi    # 0x333827
testb %al, %al
movq 0x40(%rsp), %rbp
je 0x119c7c
callq 0xaed4b
testq %rax, %rax
je 0x119e27
movq %rax, %r14
movq 0x38(%rsp), %r13
movq %r13, %rdi
leaq 0x207562(%rip), %rsi    # 0x321104
callq 0xd9628
testq %rax, %rax
je 0x119bd3
movq %rax, %rdi
callq 0xacbd1
movq %rax, %r12
movq %rax, %rdi
leaq 0x22786a(%rip), %rsi    # 0x34142b
callq 0xacbfb
movq %r12, %rdi
movq %r14, %rsi
callq 0xacbfb
jmp 0x119bde
movq %r14, %rdi
callq 0xacbd1
movq %rax, %r12
movq %r12, %rdi
leaq 0x248948(%rip), %r14    # 0x362530
movq %r14, %rsi
callq 0xacbfb
movq %r12, %rdi
movq %rbp, %rsi
callq 0xace26
movq %r12, %rdi
movq %r14, %rsi
callq 0xacbfb
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0xda338
movq %r12, %rdi
movq %rax, %rsi
callq 0xacbfb
movq %r12, %rdi
movq %r14, %rsi
callq 0xacbfb
movq %rbp, %rdi
movq 0x40(%rsp), %rbp
leaq 0x260dff(%rip), %rsi    # 0x37aa37
callq 0xd9628
movq %r12, %rdi
movq %rax, %rsi
callq 0xacbfb
movq %r12, %rdi
callq 0xad1fa
movq %r13, %rdi
leaq 0x2074aa(%rip), %rsi    # 0x321104
movq %rax, %rdx
callq 0xda48b
movq %r12, %rdi
callq 0xad357
movq %r12, %rdi
callq 0xae103
xorl %r12d, %r12d
movq 0x58(%rsp), %r14
jmp 0x119cc8
movq 0x28(%r15), %rdi
movl %r12d, %esi
movl %r13d, %edx
movl 0xc(%rsp), %ecx
leaq 0x8(%rsp), %r8
movq 0x10(%rsp), %r9
callq 0xb1347
testl %eax, %eax
movq 0x58(%rsp), %r14
jne 0x119cc5
movq 0x28(%r15), %rdi
movl 0x4c(%rsp), %esi
movl 0x50(%rsp), %edx
movl 0x54(%rsp), %ecx
leaq 0x7(%rsp), %r8
movq 0x10(%rsp), %r9
callq 0xb1347
testl %eax, %eax
je 0x119cd5
movl %eax, %r12d
movq 0x18(%rsp), %rdi
incq %rbp
jmp 0x1199f1
movb 0x7(%rsp), %al
leaq 0x219b53(%rip), %rdi    # 0x333833
cmpb 0x8(%rsp), %al
je 0x119b82
leaq 0x219b55(%rip), %rdi    # 0x333846
jmp 0x119b82
movq 0x60(%rsp), %rdi
movq %r14, %r13
leaq 0x2199c0(%rip), %r14    # 0x3336c5
movq %r14, %rsi
movl $0x105, %edx            # imm = 0x105
callq 0x936f9
movq %r13, %rdi
movq %r14, %rsi
movl $0x106, %edx            # imm = 0x106
callq 0x936f9
jmp 0x119d27
xorl %r12d, %r12d
movq 0x30(%rsp), %r13
jmp 0x119808
movq %r14, %rdi
callq 0xa31ee
addq %rax, %r13
jmp 0x119805
movq %rbx, %rdi
callq 0xdc9f1
movq 0x80(%rsp), %rbx
jmp 0x1197b5
movq %rbx, %rdi
callq 0xdc9f1
movl %r12d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x31e1ee(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb28f(%rip), %rsi    # 0x2e5013
leaq 0x219a2d(%rip), %rdx    # 0x3337b8
leaq 0x2199dc(%rip), %rcx    # 0x33376e
leaq 0x21992c(%rip), %r8     # 0x3336c5
pushq $0x69
jmp 0x119def
movq 0x31e1c4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb265(%rip), %rsi    # 0x2e5013
leaq 0x219a19(%rip), %rdx    # 0x3337ce
leaq 0x2199b2(%rip), %rcx    # 0x33376e
leaq 0x219902(%rip), %r8     # 0x3336c5
pushq $0x6f
jmp 0x119def
movq 0x31e19a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb23b(%rip), %rsi    # 0x2e5013
leaq 0x2199d1(%rip), %rdx    # 0x3337b0
leaq 0x219988(%rip), %rcx    # 0x33376e
leaq 0x2198d8(%rip), %r8     # 0x3336c5
pushq $0x5e
popq %r9
jmp 0x119f42
movq 0x31e16b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb20c(%rip), %rsi    # 0x2e5013
leaq 0x1cb3b1(%rip), %rdx    # 0x2e51bf
leaq 0x2198d5(%rip), %rcx    # 0x3336ea
leaq 0x2198a9(%rip), %r8     # 0x3336c5
movl $0xb5, %r9d
jmp 0x119f42
movq 0x31e13a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb1db(%rip), %rsi    # 0x2e5013
leaq 0x219a29(%rip), %rdx    # 0x333868
leaq 0x219928(%rip), %rcx    # 0x33376e
leaq 0x219878(%rip), %r8     # 0x3336c5
movl $0x90, %r9d
jmp 0x119f42
movq 0x31e109(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb1aa(%rip), %rsi    # 0x2e5013
leaq 0x2198bc(%rip), %rdx    # 0x33372c
leaq 0x219873(%rip), %rcx    # 0x3336ea
leaq 0x219847(%rip), %r8     # 0x3336c5
movl $0xd9, %r9d
jmp 0x119f42
movq 0x31e0d8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb179(%rip), %rsi    # 0x2e5013
leaq 0x21986c(%rip), %rdx    # 0x33370d
leaq 0x219842(%rip), %rcx    # 0x3336ea
leaq 0x219816(%rip), %r8     # 0x3336c5
movl $0xd5, %r9d
jmp 0x119f42
movq 0x31e0a7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb148(%rip), %rsi    # 0x2e5013
leaq 0x200e1d(%rip), %rdx    # 0x31acef
leaq 0x219811(%rip), %rcx    # 0x3336ea
leaq 0x2197e5(%rip), %r8     # 0x3336c5
movl $0xd4, %r9d
jmp 0x119f42
movq 0x31e079(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb11a(%rip), %rsi    # 0x2e5013
leaq 0x219846(%rip), %rdx    # 0x333746
leaq 0x2197e3(%rip), %rcx    # 0x3336ea
leaq 0x2197b7(%rip), %r8     # 0x3336c5
movl $0xe3, %r9d
jmp 0x119f42
movq 0x31e04b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1cb0ec(%rip), %rsi    # 0x2e5013
leaq 0x203b91(%rip), %rdx    # 0x31dabf
leaq 0x2197b5(%rip), %rcx    # 0x3336ea
leaq 0x219789(%rip), %r8     # 0x3336c5
movl $0xe1, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390