// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/ltr/ltrdigest_pbs_visitor.c
// Function: gt_ltrdigest_pbs_visitor_feature_node
static int gt_ltrdigest_pbs_visitor_feature_node(GtNodeVisitor *nv,
                                                 GtFeatureNode *fn,
                                                 GtError *err)
{
  GT_UNUSED GtLTRdigestPBSVisitor *lv;
  GtFeatureNodeIterator *fni;
  GtRange leftltrrng, rightltrrng;
  bool seen_left = false;
  GtFeatureNode *curnode = NULL;
  int had_err = 0;
  lv = gt_ltrdigest_pbs_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) {
      lv->ltr_retrotrans = curnode;
    }
    if (strcmp(gt_feature_node_get_type(curnode),
               gt_ft_long_terminal_repeat) == 0) {
      if (seen_left) {
        rightltrrng = gt_genome_node_get_range((GtGenomeNode*) curnode);
        lv->rightltrlen = gt_range_length(&rightltrrng);
        lv->rightLTR_5 = rightltrrng.start - 1;
      } else {
        leftltrrng = gt_genome_node_get_range((GtGenomeNode*) curnode);
        lv->leftltrlen = gt_range_length(&leftltrrng);
        lv->leftLTR_3 = leftltrrng.end - 1;
        seen_left = true;
      }
    }
  }
  gt_feature_node_iterator_delete(fni);

  if (!had_err && lv->ltr_retrotrans != NULL) {
    char *rev_seq;
    GtRange rng;
    GtStrand canonical_strand = gt_feature_node_get_strand(lv->ltr_retrotrans);
    GtUword seqlen;
    GtStr *seq = gt_str_new();
    rng = gt_genome_node_get_range((GtGenomeNode*) lv->ltr_retrotrans);
    seqlen = gt_range_length(&rng);

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

    if (!had_err) {
      GtPBSResults *pbs_results = NULL;
      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);

      pbs_results = gt_pbs_find(lv, gt_str_get(seq), (const char*) rev_seq,
                                err);
       if (gt_pbs_results_get_number_of_hits(pbs_results) > 0)
       {
        pbs_attach_results_to_gff3(lv, pbs_results, lv->ltr_retrotrans,
                                   &canonical_strand);
       }
       gt_pbs_results_delete(pbs_results);

      gt_free(rev_seq);
    }
    gt_str_delete(seq);
  }

  return had_err;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq %rdx, 0xf0(%rsp)
movb $0x0, 0xbf(%rsp)
movq $0x0, 0xb0(%rsp)
movl $0x0, 0xac(%rsp)
callq 0x305ab0
movq %rax, %rdi
movq 0x100(%rsp), %rsi
callq 0x1b2350
movq %rax, 0xe8(%rsp)
cmpq $0x0, 0xe8(%rsp)
jne 0x305bde
movq 0x3363f3(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x21045c(%rip), %rsi    # 0x516013
leaq 0x28d4c4(%rip), %rdx    # 0x593082
leaq 0x28d718(%rip), %rcx    # 0x5932dd
leaq 0x28d6f1(%rip), %r8     # 0x5932bd
movl $0x1af, %r9d            # imm = 0x1AF
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x305be0
jmp 0x305be2
cmpq $0x0, 0xf0(%rsp)
je 0x305c38
movq 0xf0(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x305c00
jmp 0x305c38
movq 0x336399(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x210402(%rip), %rsi    # 0x516013
leaq 0x2105a7(%rip), %rdx    # 0x5161bf
leaq 0x28d6be(%rip), %rcx    # 0x5932dd
leaq 0x28d697(%rip), %r8     # 0x5932bd
movl $0x1b0, %r9d            # imm = 0x1B0
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x305c3a
movq 0xf8(%rsp), %rdi
callq 0x170b00
movq %rax, 0xe0(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xac(%rsp)
movb %al, 0x3f(%rsp)
jne 0x305c7f
movq 0xe0(%rsp), %rdi
callq 0x170e30
movq %rax, 0xb0(%rsp)
cmpq $0x0, %rax
setne %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x305c8c
jmp 0x305de3
movq 0xb0(%rsp), %rdi
callq 0x16d430
movq %rax, %rdi
leaq 0x261899(%rip), %rsi    # 0x56753c
callq 0x19980
cmpl $0x0, %eax
jne 0x305cc1
movq 0xb0(%rsp), %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0xb0(%rsp), %rdi
callq 0x16d430
movq %rax, %rdi
leaq 0x2641de(%rip), %rsi    # 0x569eb6
callq 0x19980
cmpl $0x0, %eax
jne 0x305dde
testb $0x1, 0xbf(%rsp)
je 0x305d63
movq 0xb0(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x98(%rsp)
movq %rdx, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x107320
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0x40(%rax)
movq 0xc0(%rsp), %rcx
subq $0x1, %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x305ddc
movq 0xb0(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x107320
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0xd8(%rsp), %rcx
subq $0x1, %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0x28(%rax)
movb $0x1, 0xbf(%rsp)
jmp 0x305dde
jmp 0x305c4f
movq 0xe0(%rsp), %rdi
callq 0x170f50
cmpl $0x0, 0xac(%rsp)
jne 0x305feb
movq 0xe8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x305feb
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x16cc70
movl %eax, 0x6c(%rsp)
callq 0x11d4a0
movq %rax, 0x58(%rsp)
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x171cc0
movq %rax, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x107320
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x30(%rsp)
leaq 0x2616ac(%rip), %rdi    # 0x56753c
callq 0x120930
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %rdx
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %r10
movq 0xf0(%rsp), %rax
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %r8d, %r9d
movq %r9, %r8
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x48f4f0
movl %eax, 0xac(%rsp)
cmpl $0x0, 0xac(%rsp)
jne 0x305fe1
movq $0x0, 0x40(%rsp)
movq 0x60(%rsp), %rdi
shlq $0x0, %rdi
leaq 0x28d3c0(%rip), %rsi    # 0x5932bd
movl $0x1d9, %edx            # imm = 0x1D9
callq 0xe80f0
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rdi
callq 0x11dee0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq 0x60(%rsp), %rdx
shlq $0x0, %rdx
callq 0x19330
movq 0x80(%rsp), %rdi
movq 0x60(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x1cb4f0
movq 0xe8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %rdi
callq 0x11dee0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
movq 0x80(%rsp), %rdx
movq 0xf0(%rsp), %rcx
callq 0x3061e0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0x306620
cmpq $0x0, %rax
jbe 0x305fbe
movq 0xe8(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x6c(%rsp), %rcx
callq 0x306680
movq 0x40(%rsp), %rdi
callq 0x306a80
movq 0x80(%rsp), %rdi
leaq 0x28d2e6(%rip), %rsi    # 0x5932bd
movl $0x1e6, %edx            # imm = 0x1E6
callq 0xe88c0
movq 0x58(%rsp), %rdi
callq 0x11f560
movl 0xac(%rsp), %eax
addq $0x108, %rsp            # imm = 0x108
retq
nopw (%rax,%rax)