// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/ltr/ltrdigest_ppt_visitor.c
// Function: gt_ltrdigest_ppt_visitor_feature_node
static int gt_ltrdigest_ppt_visitor_feature_node(GtNodeVisitor *nv,
                                                 GtFeatureNode *fn,
                                                 GtError *err)
{
  GT_UNUSED GtLTRdigestPPTVisitor *lv;
  GtFeatureNodeIterator *fni;
  GtRange leftltrrng = { 0, 0 }, rightltrrng = { 0, 0 };
  bool seen_left = false;
  GtFeatureNode *curnode = NULL,
                *ltr_retrotrans = NULL;
  int had_err = 0;
  lv = gt_ltrdigest_ppt_visitor_cast(nv);
  gt_assert(lv);
  gt_error_check(err);

  /* traverse annotation subgraph and find LTR element */
  fni = gt_feature_node_iterator_new(fn);
  while (!had_err && (curnode = gt_feature_node_iterator_next(fni))) {
    if (strcmp(gt_feature_node_get_type(curnode),
               gt_ft_LTR_retrotransposon) == 0) {
      ltr_retrotrans = curnode;
    }
    if (strcmp(gt_feature_node_get_type(curnode),
               gt_ft_long_terminal_repeat) == 0) {
      if (seen_left)   /* XXX */
        rightltrrng = gt_genome_node_get_range((GtGenomeNode*) curnode);
      else {
        leftltrrng = gt_genome_node_get_range((GtGenomeNode*) curnode);
        seen_left = true;
      }
    }
  }
  gt_feature_node_iterator_delete(fni);

  if (!had_err && ltr_retrotrans != NULL) {
    char *rev_seq;
    GtRange rng;
    GtStrand canonical_strand = gt_feature_node_get_strand(ltr_retrotrans);
    GtPPTResults *res;
    GtUword seqlen;
    GtStr *seq = NULL;
    rng = gt_genome_node_get_range((GtGenomeNode*) ltr_retrotrans);

    if (gt_range_length(&rng) < (GtUword) 10UL) {
      gt_warning("LTR_retrotransposon (%s, line %u) is too short for "
                 "PPT detection (" GT_WU " nt), skipped this step",
            gt_genome_node_get_filename((GtGenomeNode*) ltr_retrotrans),
            gt_genome_node_get_line_number((GtGenomeNode*) ltr_retrotrans),
            gt_range_length(&rng));
      return had_err;
    }

    seq = gt_str_new();
    seqlen = gt_range_length(&rng);

    had_err = gt_extract_feature_sequence(seq, (GtGenomeNode*) ltr_retrotrans,
                                          gt_symbol(gt_ft_LTR_retrotransposon),
                                          false, NULL, NULL, lv->rmap, err);

    if (!had_err) {
      rev_seq = gt_malloc((size_t) seqlen * sizeof (char));
      strncpy(rev_seq, gt_str_get(seq), (size_t) seqlen * sizeof (char));
      (void) gt_reverse_complement(rev_seq, seqlen, NULL);

      res = gt_ppt_find(lv, gt_str_get(seq), rev_seq, seqlen, rightltrrng,
                        leftltrrng);
      if (gt_ppt_results_get_number_of_hits(res) > 0) {
        ppt_attach_results_to_gff3(lv, res, ltr_retrotrans, &canonical_strand);
      }
      gt_ppt_results_delete(res);
      gt_free(rev_seq);
    }
    gt_str_delete(seq);
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
callq 0x20de3d
movq %rax, %rdi
movq %r14, %rsi
callq 0x1630b1
testq %rax, %rax
je 0x20e558
movq %rax, %r14
testq %r15, %r15
je 0x20deca
movq %r15, %rdi
callq 0xfcc32
testb %al, %al
jne 0x20e55d
movq %rbx, %rdi
callq 0x143f54
movq %rax, %r12
movq %rax, %rdi
callq 0x1440ea
testq %rax, %rax
je 0x20e3e5
movq %rax, %rbx
movq %r15, 0x20(%rsp)
movq %r14, 0x38(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x186cb4(%rip), %r13    # 0x394bb7
leaq 0x1895ae(%rip), %rbp    # 0x3974b8
movq $0x0, (%rsp)
xorl %r15d, %r15d
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x142988
movq %rax, %rdi
movq %r13, %rsi
callq 0x17a40
testl %eax, %eax
movq 0x18(%rsp), %rax
cmoveq %rbx, %rax
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x142988
movq %rax, %rdi
movq %rbp, %rsi
callq 0x17a40
testl %eax, %eax
jne 0x20df9f
movq %rbx, %rdi
callq 0x144679
testb $0x1, %r15b
cmoveq %rax, %r14
movq 0x8(%rsp), %rcx
cmoveq %rdx, %rcx
movq %rcx, 0x8(%rsp)
movq (%rsp), %rcx
cmovneq %rdx, %rcx
movq %rcx, (%rsp)
movq 0x10(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x10(%rsp)
movb $0x1, %r15b
movq %r12, %rdi
callq 0x1440ea
movq %rax, %rbx
testq %rax, %rax
jne 0x20df2a
movq %r12, %rdi
callq 0x14417c
movq 0x18(%rsp), %r15
testq %r15, %r15
je 0x20e3ed
movq %r15, %rdi
callq 0x1424d6
movl %eax, %ebp
movq %r15, %rdi
callq 0x144679
leaq 0x58(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
callq 0x112233
cmpq $0x9, %rax
jbe 0x20e3f5
callq 0x11ac6c
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x112233
movq %rax, %r12
leaq 0x186ba5(%rip), %rdi    # 0x394bb7
callq 0x11c5ff
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq 0x20(%rsp)
movq 0x40(%rsp), %r13
pushq 0x10(%r13)
callq 0x2fda60
addq $0x10, %rsp
movl %eax, %r15d
testl %eax, %eax
jne 0x20e53b
movl %ebp, 0x20(%rsp)
movl %r15d, 0x44(%rsp)
leaq 0x1b2a6d(%rip), %rsi    # 0x3c0ac6
movq %r12, %rdi
movl $0x23f, %edx            # imm = 0x23F
callq 0x104226
movq %rax, %r15
movq %rbx, %rdi
callq 0x11b0a1
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x17370
movq %r15, %rdi
movq %r12, 0x28(%rsp)
movq %r12, %rsi
xorl %edx, %edx
callq 0x16eef8
movq %rbx, 0x50(%rsp)
movq %rbx, %rdi
callq 0x11b0a1
movq %rax, %rbx
movq %r14, %r12
movq %r14, 0x68(%rsp)
movq 0x8(%rsp), %r14
movq %r14, 0x70(%rsp)
movq 0x10(%rsp), %rbp
movq %rbp, 0x78(%rsp)
movq (%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r15, 0x30(%rsp)
testq %r15, %r15
je 0x20e562
testq %rbx, %rbx
je 0x20e562
leaq 0x1b29df(%rip), %rdx    # 0x3c0ac6
movl $0x1, %edi
movl $0x28, %esi
movl $0x5f, %ecx
callq 0x10436a
movq %rax, %r15
movq %r12, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rbp, 0x18(%rax)
movq (%rsp), %rax
movq %rax, 0x20(%r15)
movl $0x8, %edi
callq 0xd214c
movq %r15, (%rsp)
movq %rax, (%r15)
leaq 0x78(%rsp), %rdi
callq 0x112233
movl 0x88(%r13), %ebp
movq %rax, 0x10(%rsp)
decq %rax
cmpq %rbp, %rax
cmovbq %rax, %rbp
movq 0x28(%rsp), %r12
leaq (,%r12,4), %rdi
leaq 0x1b296f(%rip), %rsi    # 0x3c0ac6
movl $0x195, %edx            # imm = 0x195
callq 0x104226
movq %rax, %r15
testq %r12, %r12
je 0x20e18b
movq %rbx, %r14
xorl %ebx, %ebx
movq 0x28(%r13), %rdi
movsbl (%r14,%rbx), %esi
callq 0xd185d
movzbl %al, %eax
movl %eax, (%r15,%rbx,4)
incq %rbx
cmpq %rbx, %r12
jne 0x20e16e
leaq (,%rbp,2), %rax
leaq 0x1(,%rbp,2), %rcx
movq %rcx, 0x8(%rsp)
leaq 0x4(,%rax,4), %rdi
leaq 0x1b2917(%rip), %r14    # 0x3c0ac6
movq %r14, %rsi
movl $0x19a, %edx            # imm = 0x19A
callq 0x104226
movq %rax, %rbx
movq 0x20(%r13), %rdi
leaq (%r15,%r12,4), %rcx
movl $0x1, %eax
subq 0x10(%rsp), %rax
movq %rcx, 0x10(%rsp)
leaq (%rcx,%rax,4), %rdx
addq $-0x4, %rdx
leaq (,%rbp,4), %rax
subq %rax, %rdx
addq $-0x4, %rdx
movq %rbx, %rsi
movq 0x8(%rsp), %rcx
callq 0x151137
movq %r13, %rdi
movq %rbx, %rsi
movq (%rsp), %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq 0x20eac5
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1a2, %edx            # imm = 0x1A2
callq 0x1045eb
leaq 0x68(%rsp), %rdi
callq 0x112233
movq %rax, 0x8(%rsp)
movl 0x88(%r13), %eax
movq %rax, 0x48(%rsp)
testq %r12, %r12
movq 0x30(%rsp), %rbx
je 0x20e262
xorl %ebp, %ebp
movq 0x28(%r13), %rdi
movsbl (%rbx,%rbp), %esi
callq 0xd185d
movzbl %al, %eax
movl %eax, (%r15,%rbp,4)
incq %rbp
cmpq %rbp, %r12
jne 0x20e246
movq 0x8(%rsp), %r14
leaq -0x1(%r14), %rax
movq 0x48(%rsp), %r12
cmpq %r12, %rax
cmovbq %rax, %r12
leaq (%r12,%r12), %rax
leaq 0x1(%r12,%r12), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x4(,%rax,4), %rdi
leaq 0x1b2832(%rip), %rsi    # 0x3c0ac6
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x104226
movq %rax, %rbp
movq 0x20(%r13), %rdi
movl $0x1, %eax
subq %r14, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,4), %rdx
addq $-0x4, %rdx
leaq (,%r12,4), %rax
subq %rax, %rdx
addq $-0x4, %rdx
movq %rbp, %rsi
movq 0x28(%rsp), %rcx
callq 0x151137
movq %r13, %rdi
movq %rbp, %rsi
movq (%rsp), %r13
movq %r13, %rdx
movq %r12, %rcx
movl $0x1, %r8d
callq 0x20eac5
movq (%r13), %rdi
leaq 0xaa4(%rip), %rsi       # 0x20eda0
callq 0xd252d
movq %r15, %rdi
leaq 0x1b27bb(%rip), %r14    # 0x3c0ac6
movq %r14, %rsi
movl $0x1b9, %edx            # imm = 0x1B9
callq 0x1045eb
movq %rbp, %rdi
movq %r14, %rsi
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x1045eb
movq %r13, %rdi
callq 0x20eab2
testq %rax, %rax
movq %rbx, %r14
je 0x20e515
movq %r13, %rdi
xorl %esi, %esi
callq 0x20edf8
movq %rax, %r15
movl 0x20(%rsp), %eax
cmpl $0x3, %eax
je 0x20e437
cmpl %eax, 0x28(%r15)
je 0x20e437
movq %r13, %rdi
callq 0x20eab2
cmpq $0x2, %rax
jb 0x20e3d1
movl $0x1, %ebx
leaq 0x1cc29d(%rip), %r14    # 0x3da617
leaq 0x14efbb(%rip), %rbp    # 0x35d33c
leaq 0x1b28f3(%rip), %r12    # 0x3c0c7b
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x141f50
testq %rax, %rax
cmoveq %rbp, %rax
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x103d72
movq %r13, %rdi
movq %rbx, %rsi
callq 0x20edf8
movq %rax, %r15
movl 0x20(%rsp), %eax
cmpl %eax, 0x28(%r15)
je 0x20e432
incq %rbx
movq %r13, %rdi
callq 0x20eab2
cmpq %rax, %rbx
jb 0x20e388
movl 0x20(%rsp), %eax
cmpl %eax, 0x28(%r15)
movq 0x30(%rsp), %r14
je 0x20e437
jmp 0x20e515
movq %r12, %rdi
callq 0x14417c
xorl %r15d, %r15d
jmp 0x20e543
movq %r15, %rdi
callq 0x144606
movq %rax, %rbx
movq %r15, %rdi
callq 0x144626
movl %eax, %ebp
leaq 0x58(%rsp), %rdi
callq 0x112233
leaq 0x1b2762(%rip), %rdi    # 0x3c0b7d
xorl %r15d, %r15d
movq %rbx, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x11f68c
jmp 0x20e543
movq 0x30(%rsp), %r14
movq %r15, %rdi
movq 0x38(%rsp), %r13
movq %r13, %rsi
callq 0x20dcc4
leaq 0x1(%rax), %rbx
leaq 0x1(%rdx), %r12
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x144635
movl 0x28(%r15), %r8d
leaq 0x1b1557(%rip), %rsi    # 0x3bf9be
movq %rax, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x1422f4
movq %rax, %rbx
movq 0x18(%r13), %rsi
movq (%rsp), %r13
movq %rax, %rdi
callq 0x141fb5
movl 0x28(%r15), %esi
movq %rbp, %rdi
callq 0x142d01
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x14275f
movq 0x20(%r15), %rbx
testq %rbx, %rbx
je 0x20e515
movq %rbx, %rdi
movq 0x38(%rsp), %r13
movq %r13, %rsi
callq 0x20dcc4
leaq 0x1(%rax), %r15
leaq 0x1(%rdx), %r12
movq %r14, %rbp
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x144635
movl 0x28(%rbx), %r8d
leaq 0x1b27d2(%rip), %rsi    # 0x3c0cad
movq %rax, %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x1422f4
movq %rax, %r15
movq 0x18(%r13), %rsi
movq (%rsp), %r13
movq %rax, %rdi
callq 0x141fb5
movl 0x28(%rbx), %esi
movq %r14, %rdi
callq 0x142d01
movq %r14, %rdi
movq %rbp, %r14
movq %r15, %rsi
callq 0x14275f
movq %r13, %rdi
callq 0x20dd67
leaq 0x1b25a2(%rip), %rsi    # 0x3c0ac6
movq %r14, %rdi
movl $0x249, %edx            # imm = 0x249
callq 0x1045eb
movq 0x50(%rsp), %rbx
movl 0x44(%rsp), %r15d
movq %rbx, %rdi
callq 0x11bdbf
movl %r15d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8158e
callq 0x8151c
callq 0x81555