// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rdi, %rbx
callq 0x217812
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16af21
testq %rax, %rax
je 0x217f6e
movq %rax, %rbx
testq %r15, %r15
je 0x2178a3
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0x217f73
movq %rbx, 0x38(%rsp)
movq %r14, %rdi
callq 0x14b1a8
movq %rax, %r12
movq %rax, %rdi
callq 0x14b33e
testq %rax, %rax
movq %r15, 0x28(%rsp)
je 0x217997
movq %rax, %r13
movq $0x0, 0x10(%rsp)
leaq 0x186782(%rip), %rbp    # 0x39e05e
leaq 0x18909b(%rip), %r15    # 0x3a097e
movq $0x0, 0x20(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movq %r13, %rdi
callq 0x149bb2
movq %rax, %rdi
movq %rbp, %rsi
callq 0x17a40
testl %eax, %eax
cmoveq %r13, %r14
movq %r13, %rdi
callq 0x149bb2
movq %rax, %rdi
movq %r15, %rsi
callq 0x17a40
testl %eax, %eax
jne 0x217981
movq %r13, %rdi
callq 0x14b8df
testb $0x1, %bl
movq 0x18(%rsp), %rcx
cmoveq %rax, %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rsp), %rcx
cmoveq %rdx, %rcx
movq %rcx, 0x8(%rsp)
movzbl %bl, %ebx
movl $0x1, %ecx
cmovel %ecx, %ebx
movq 0x20(%rsp), %rcx
cmovneq %rdx, %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x10(%rsp)
movq %r12, %rdi
callq 0x14b33e
movq %rax, %r13
testq %rax, %rax
jne 0x217903
jmp 0x2179be
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq %r12, %rdi
callq 0x14b3d0
testq %r14, %r14
movl $0x0, %r15d
je 0x217f59
movq %r14, %rdi
callq 0x14970e
movl %eax, %ebp
movq %r14, %rdi
callq 0x14b8df
leaq 0x58(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
callq 0x117813
cmpq $0x9, %rax
jbe 0x217d93
callq 0x1208f8
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x117813
movq %rax, %r12
leaq 0x186640(%rip), %rdi    # 0x39e05e
callq 0x12234f
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq 0x28(%rsp)
movq 0x40(%rsp), %r13
pushq 0x10(%r13)
callq 0x307764
addq $0x10, %rsp
movl %eax, %r15d
testl %eax, %eax
jne 0x217f51
movl %ebp, 0x28(%rsp)
movq %r15, 0x50(%rsp)
leaq 0x1b2701(%rip), %rsi    # 0x3ca166
movq %r12, %rdi
movl $0x23f, %edx            # imm = 0x23F
callq 0x1092b2
movq %rax, %rbp
movq %rbx, %rdi
callq 0x120d23
movq %rbp, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x17370
movq %rbp, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x177290
movq %rbx, 0x48(%rsp)
movq %rbx, %rdi
callq 0x120d23
movq %rax, %r15
movq 0x18(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %rbp, 0x30(%rsp)
testq %rbp, %rbp
je 0x217f78
testq %r15, %r15
je 0x217f78
leaq 0x1b2675(%rip), %rbp    # 0x3ca166
movl $0x1, %edi
movl $0x28, %esi
movq %rbp, %rdx
movl $0x5f, %ecx
callq 0x1093ef
movq %rax, %rbx
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rbx)
movl $0x8, %edi
callq 0xd46fc
movq %rbx, 0x10(%rsp)
movq %rax, (%rbx)
leaq 0x78(%rsp), %rdi
callq 0x117813
movl 0x88(%r13), %ecx
movq %rax, 0x20(%rsp)
decq %rax
cmpq %rcx, %rax
cmovbq %rax, %rcx
movq %rcx, 0x8(%rsp)
leaq (,%r12,4), %rdi
movq %rbp, %rsi
movl $0x195, %edx            # imm = 0x195
callq 0x1092b2
movq %rax, %rbp
testq %r12, %r12
je 0x217ba2
xorl %ebx, %ebx
movq 0x28(%r13), %rdi
movsbl (%r15,%rbx), %esi
callq 0xd3d89
movzbl %al, %eax
movl %eax, (%rbp,%rbx,4)
incq %rbx
cmpq %rbx, %r12
jne 0x217b85
movq 0x8(%rsp), %rbx
leaq (%rbx,%rbx), %rax
leaq 0x1(,%rbx,2), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x4(,%rax,4), %rdi
leaq 0x1b259f(%rip), %rsi    # 0x3ca166
movl $0x19a, %edx            # imm = 0x19A
callq 0x1092b2
movq %rax, %r15
movq 0x20(%r13), %rdi
leaq (,%r12,4), %rax
addq %rbp, %rax
movl $0x1, %ecx
subq 0x20(%rsp), %rcx
movq %rax, 0x20(%rsp)
leaq (%rax,%rcx,4), %rdx
addq $-0x4, %rdx
leaq (,%rbx,4), %rax
subq %rax, %rdx
addq $-0x4, %rdx
movq %r15, %rsi
movq 0x18(%rsp), %rcx
callq 0x158abe
movq %r13, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x2184db
movq %r15, %rdi
leaq 0x1b2530(%rip), %rsi    # 0x3ca166
movl $0x1a2, %edx            # imm = 0x1A2
callq 0x109670
leaq 0x68(%rsp), %rdi
callq 0x117813
movq %rax, 0x18(%rsp)
movl 0x88(%r13), %eax
movq %rax, 0x8(%rsp)
testq %r12, %r12
movq 0x30(%rsp), %r15
je 0x217c84
xorl %ebx, %ebx
movq 0x28(%r13), %rdi
movsbl (%r15,%rbx), %esi
callq 0xd3d89
movzbl %al, %eax
movl %eax, (%rbp,%rbx,4)
incq %rbx
cmpq %rbx, %r12
jne 0x217c67
movq 0x18(%rsp), %rbx
leaq -0x1(%rbx), %rax
movq 0x8(%rsp), %r12
cmpq %r12, %rax
cmovbq %rax, %r12
leaq (%r12,%r12), %rax
leaq 0x1(%r12,%r12), %rcx
movq %rcx, 0x8(%rsp)
leaq 0x4(,%rax,4), %rdi
leaq 0x1b24b0(%rip), %rsi    # 0x3ca166
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x1092b2
movq %rax, %rsi
movq 0x20(%r13), %rdi
movl $0x1, %eax
subq %rbx, %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %rdx
addq $-0x4, %rdx
leaq (,%r12,4), %rax
subq %rax, %rdx
addq $-0x4, %rdx
movq %rsi, %rbx
movq %rsi, 0x40(%rsp)
movq 0x8(%rsp), %rcx
callq 0x158abe
movq %r13, %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
movq %r12, %rcx
movl $0x1, %r8d
callq 0x2184db
movq (%rbx), %rdi
leaq 0xa5d(%rip), %rsi       # 0x218780
callq 0xd4ae7
movq %rbp, %rdi
leaq 0x1b2434(%rip), %rbp    # 0x3ca166
movq %rbp, %rsi
movl $0x1b9, %edx            # imm = 0x1B9
callq 0x109670
movq 0x40(%rsp), %rdi
movq %rbx, %r12
movq %rbp, %rsi
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x109670
movq %rbx, %rdi
callq 0x2184c8
testq %rax, %rax
movq %r15, %rbp
je 0x217f2b
movq %r13, %rbx
movq %r12, %rdi
xorl %esi, %esi
callq 0x2187d8
movq %rax, %r15
movl 0x28(%rsp), %eax
cmpl $0x3, %eax
je 0x217e5b
cmpl %eax, 0x28(%r15)
jne 0x217dd0
movq %r12, %r13
jmp 0x217e40
movq %r14, %rdi
callq 0x14b86c
movq %rax, %rbx
movq %r14, %rdi
callq 0x14b88c
movl %eax, %ebp
leaq 0x58(%rsp), %rdi
callq 0x117813
leaq 0x1b2464(%rip), %rdi    # 0x3ca21d
xorl %r15d, %r15d
movq %rbx, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x125448
jmp 0x217f59
movq %r12, %rdi
callq 0x2184c8
cmpq $0x2, %rax
movq %r12, %r13
jb 0x217e40
movl $0x1, %r12d
leaq 0x14e61f(%rip), %rbx    # 0x36640d
leaq 0x1b2536(%rip), %rbp    # 0x3ca32b
movq %r14, %rdi
leaq 0x1cbf6d(%rip), %rsi    # 0x3e3d6c
callq 0x14918c
testq %rax, %rax
cmoveq %rbx, %rax
movq %rbp, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x108e02
movq %r13, %rdi
movq %r12, %rsi
callq 0x2187d8
movq %rax, %r15
movl 0x28(%rsp), %eax
cmpl %eax, 0x28(%r15)
je 0x217e40
incq %r12
movq %r13, %rdi
callq 0x2184c8
cmpq %rax, %r12
jb 0x217df5
movl 0x28(%rsp), %eax
cmpl %eax, 0x28(%r15)
movq 0x38(%rsp), %rbx
movq 0x30(%rsp), %rbp
movq %r13, %r12
jne 0x217f2b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21768c
leaq 0x1(%rax), %r12
leaq 0x1(%rdx), %r13
movq %r14, %rdi
callq 0x14b89b
movl 0x28(%r15), %r8d
leaq 0x1b11bd(%rip), %rsi    # 0x3c903e
movq %rax, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x14952c
movq %rax, %r12
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x1491f1
movl 0x28(%r15), %esi
movq %r14, %rdi
callq 0x149f2e
movq %r14, %rdi
movq %r12, %rsi
callq 0x149997
testq %r15, %r15
je 0x217f7d
movq 0x20(%r15), %r15
testq %r15, %r15
movq 0x10(%rsp), %r12
je 0x217f2b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21768c
leaq 0x1(%rax), %r12
leaq 0x1(%rdx), %r13
movq %r14, %rdi
callq 0x14b89b
movl 0x28(%r15), %r8d
leaq 0x1b246b(%rip), %rsi    # 0x3ca35d
movq %rax, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x14952c
movq %rax, %r12
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x1491f1
movl 0x28(%r15), %esi
movq %r14, %rdi
callq 0x149f2e
movq %r14, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %r12
callq 0x149997
movq %r12, %rdi
callq 0x21773b
leaq 0x1b222c(%rip), %rsi    # 0x3ca166
movq %rbp, %rdi
movl $0x249, %edx            # imm = 0x249
callq 0x109670
movq 0x50(%rsp), %r15
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x121b03
movl %r15d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8355e
callq 0x834b3
callq 0x834ec
callq 0x83525