// File: /workspace/github_c_makefile_star2_O2/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 0x1c2488
movq %rax, %rdi
movq %rbx, %rsi
callq 0x102dfe
testq %rax, %rax
je 0x1c2b5d
movq %rax, 0x10(%rsp)
testq %r15, %r15
je 0x1c2514
movq %r15, %rdi
callq 0x89eb7
testb %al, %al
jne 0x1c2b8b
movq %r15, 0x38(%rsp)
movq %r14, %rdi
callq 0xdc6f0
movq %rax, %r12
movq $0x0, 0x8(%rsp)
leaq 0x1729f2(%rip), %r13    # 0x334f26
leaq 0x1752d6(%rip), %rbp    # 0x337811
movq $0x0, 0x20(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
movq $0x0, 0x30(%rsp)
movq %r12, %rdi
callq 0xdc92e
testq %rax, %rax
je 0x1c25e5
movq %rax, %r15
movq %rax, %rdi
callq 0xda338
movq %rax, %rdi
movq %r13, %rsi
callq 0x179e0
testl %eax, %eax
cmoveq %r15, %r14
movq %r15, %rdi
callq 0xda338
movq %rax, %rdi
movq %rbp, %rsi
callq 0x179e0
testl %eax, %eax
jne 0x1c255b
movq %r15, %rdi
callq 0xdd1f4
testb $0x1, %bl
movq 0x8(%rsp), %rcx
cmoveq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq 0x20(%rsp), %rcx
cmoveq %rdx, %rcx
movq %rcx, 0x20(%rsp)
movq 0x18(%rsp), %rcx
cmovneq %rdx, %rcx
movq %rcx, 0x18(%rsp)
movq 0x30(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x30(%rsp)
movb $0x1, %bl
jmp 0x1c255b
movq %r12, %rdi
callq 0xdc9f1
testq %r14, %r14
je 0x1c27b4
movq %r14, %rdi
callq 0xd9d99
movl %eax, 0x2c(%rsp)
movq %r14, %rdi
callq 0xdd1f4
leaq 0x58(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
callq 0xa31ee
cmpq $0x9, %rax
jbe 0x1c27bc
callq 0xacb84
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0xa31ee
movq %rax, %rbp
leaq 0x1728e5(%rip), %rdi    # 0x334f26
callq 0xaed4b
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq 0x38(%rsp)
movq 0x18(%rsp), %rbx
pushq 0x10(%rbx)
callq 0x29a8d0
popq %rcx
popq %rdx
movl %eax, %r12d
testl %eax, %eax
jne 0x1c2b40
movl %r12d, 0x44(%rsp)
leaq 0x19e855(%rip), %rsi    # 0x360ed6
movq %rbp, %rdi
movl $0x23f, %edx            # imm = 0x23F
callq 0x93160
movq %rax, %r12
movq %r15, %rdi
callq 0xad1fa
movq %r12, %rdi
movq %rax, %rsi
movq %rbp, %rdx
callq 0x17350
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x111ab8
movq %r15, 0x50(%rsp)
movq %r15, %rdi
callq 0xad1fa
movq %rax, %r13
movq 0x8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r12, 0x38(%rsp)
testq %r12, %r12
je 0x1c2bc3
testq %r13, %r13
je 0x1c2bc3
leaq 0x19e7c9(%rip), %r15    # 0x360ed6
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
pushq $0x5f
popq %rcx
movq %rdi, 0x48(%rsp)
movq %r15, %rdx
callq 0x9334a
movq %rax, %r12
movq 0x8(%rsp), %rax
movq %rax, 0x8(%r12)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%r12)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%r12)
movq 0x18(%rsp), %rax
movq %rax, 0x20(%r12)
pushq $0x8
popq %rdi
callq 0x5809c
movq %r12, 0x8(%rsp)
movq %rax, (%r12)
leaq 0x78(%rsp), %rdi
callq 0xa31ee
movq %rax, 0x20(%rsp)
movl 0x88(%rbx), %r12d
leaq (,%rbp,4), %rdi
movq %r15, %rsi
movl $0x195, %edx            # imm = 0x195
callq 0x93160
movq %rax, %r15
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0x1c27f9
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rdi
movsbl (%r13,%rbx), %esi
callq 0x57552
movzbl %al, %eax
movl %eax, (%r15,%rbx,4)
incq %rbx
jmp 0x1c278f
xorl %r12d, %r12d
jmp 0x1c2b48
movq %r14, %rdi
callq 0xdd0b5
movq %rax, %rbx
movq %r14, %rdi
callq 0xdd108
movl %eax, %ebp
leaq 0x58(%rsp), %rdi
callq 0xa31ee
leaq 0x19e7ab(%rip), %rdi    # 0x360f8d
xorl %r12d, %r12d
movq %rbx, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xb2cd0
jmp 0x1c2b48
movq 0x20(%rsp), %rbx
leaq -0x1(%rbx), %rax
cmpq %r12, %rax
cmovbq %rax, %r12
leaq (%r12,%r12), %rax
leaq 0x1(,%r12,2), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x4(,%rax,4), %rdi
leaq 0x19e6ad(%rip), %rsi    # 0x360ed6
movl $0x19a, %edx            # imm = 0x19A
callq 0x93160
movq %rax, %r13
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rdi
leaq (%r15,%rbp,4), %rcx
pushq $0x1
popq %rax
subq %rbx, %rax
movq %rcx, 0x20(%rsp)
leaq (%rcx,%rax,4), %rdx
addq $-0x4, %rdx
leaq (,%r12,4), %rax
subq %rax, %rdx
addq $-0x4, %rdx
movq %r13, %rsi
movq 0x18(%rsp), %rcx
callq 0xecdcd
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x1c3177
movq %r13, %rdi
leaq 0x19e640(%rip), %rsi    # 0x360ed6
movl $0x1a2, %edx            # imm = 0x1A2
callq 0x936f9
leaq 0x68(%rsp), %rdi
callq 0xa31ee
movq %rax, %r13
movq 0x10(%rsp), %rax
movl 0x88(%rax), %r12d
cmpq %rbx, %rbp
je 0x1c28e1
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x38(%rsp), %rax
movsbl (%rax,%rbx), %esi
callq 0x57552
movzbl %al, %eax
movl %eax, (%r15,%rbx,4)
incq %rbx
jmp 0x1c28b9
leaq -0x1(%r13), %rax
cmpq %r12, %rax
cmovbq %rax, %r12
leaq (%r12,%r12), %rax
leaq 0x1(,%r12,2), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x4(,%rax,4), %rdi
leaq 0x19e5ca(%rip), %rsi    # 0x360ed6
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x93160
movq %rax, %rbp
movq 0x10(%rsp), %rbx
movq 0x20(%rbx), %rdi
pushq $0x1
popq %rax
subq %r13, %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %rdx
addq $-0x4, %rdx
leaq (,%r12,4), %rax
subq %rax, %rdx
addq $-0x4, %rdx
movq %rbp, %rsi
movq 0x18(%rsp), %rcx
callq 0xecdcd
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %r13
movq %r13, %rdx
movq %r12, %rcx
callq 0x1c3177
movq (%r13), %rdi
leaq 0xb18(%rip), %rsi       # 0x1c348e
callq 0x587b0
movq %r15, %rdi
leaq 0x19e551(%rip), %r15    # 0x360ed6
movq %r15, %rsi
movl $0x1b9, %edx            # imm = 0x1B9
callq 0x936f9
movq %rbp, %rdi
movq %r13, %rbp
movq %r15, %rsi
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x936f9
movq %r13, %rdi
callq 0x1c3131
testq %rax, %rax
je 0x1c2b18
movq %rbp, %rdi
xorl %esi, %esi
callq 0x1c350e
movq %rax, %r15
cmpl $0x3, 0x2c(%rsp)
je 0x1c2a5b
leaq 0x1b8062(%rip), %r12    # 0x37aa37
leaq 0x13a8e7(%rip), %rbx    # 0x2fd2c3
leaq 0x19e6a8(%rip), %r13    # 0x36108b
movl 0x2c(%rsp), %eax
cmpl %eax, 0x28(%r15)
je 0x1c2a41
movq %rbp, %rdi
callq 0x1c3131
movq 0x48(%rsp), %rcx
cmpq %rax, %rcx
jae 0x1c2a48
movq %r14, %rdi
movq %rcx, %r15
movq %r12, %rsi
callq 0xd9628
testq %rax, %rax
cmoveq %rbx, %rax
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x92a82
leaq 0x1(%r15), %rbp
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x1c350e
movq %rax, %r15
movq %rbp, 0x48(%rsp)
movq 0x8(%rsp), %rbp
jmp 0x1c29e3
movq 0x10(%rsp), %rbx
jmp 0x1c2a5b
movl 0x2c(%rsp), %eax
cmpl %eax, 0x28(%r15)
movq 0x10(%rsp), %rbx
jne 0x1c2b18
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1c22c0
leaq 0x1(%rax), %r12
leaq 0x1(%rdx), %r13
movq %r14, %rdi
callq 0xdd14a
movl 0x28(%r15), %r8d
leaq 0x19d38d(%rip), %rsi    # 0x35fe0e
movq %rax, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0xd9acb
movq %rax, %r12
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0xd96be
movl 0x28(%r15), %esi
movq %r14, %rdi
callq 0xdab34
movq %r14, %rdi
movq %r12, %rsi
callq 0xda055
movq 0x20(%r15), %r15
testq %r15, %r15
je 0x1c2b18
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1c22c0
leaq 0x1(%rax), %r12
leaq 0x1(%rdx), %r13
movq %r14, %rdi
callq 0xdd14a
movl 0x28(%r15), %r8d
leaq 0x19e5d9(%rip), %rsi    # 0x3610bd
movq %rax, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0xd9acb
movq %rax, %r12
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0xd96be
movl 0x28(%r15), %esi
movq %r14, %rdi
callq 0xdab34
movq %r14, %rdi
movq %r12, %rsi
callq 0xda055
movq %rbp, %rdi
callq 0x1c23bd
leaq 0x19e3af(%rip), %rsi    # 0x360ed6
movq 0x38(%rsp), %rdi
movl $0x249, %edx            # imm = 0x249
callq 0x936f9
movq 0x50(%rsp), %r15
movl 0x44(%rsp), %r12d
movq %r15, %rdi
callq 0xae103
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x275404(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1224a5(%rip), %rsi    # 0x2e5013
leaq 0x19d7cc(%rip), %rdx    # 0x360341
leaq 0x19e3eb(%rip), %rcx    # 0x360f67
leaq 0x19e353(%rip), %r8     # 0x360ed6
movl $0x20f, %r9d            # imm = 0x20F
jmp 0x1c2bb7
movq 0x2753d6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x122477(%rip), %rsi    # 0x2e5013
leaq 0x12261c(%rip), %rdx    # 0x2e51bf
leaq 0x19e3bd(%rip), %rcx    # 0x360f67
leaq 0x19e325(%rip), %r8     # 0x360ed6
movl $0x210, %r9d            # imm = 0x210
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x27539e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12243f(%rip), %rsi    # 0x2e5013
leaq 0x19e40f(%rip), %rdx    # 0x360fea
leaq 0x19e41c(%rip), %rcx    # 0x360ffe
leaq 0x19e2ed(%rip), %r8     # 0x360ed6
movl $0x18b, %r9d            # imm = 0x18B
jmp 0x1c2bb7