// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/ltr/ltrharvest_fasta_out_visitor.c
// Function: gt_ltrharvest_fasta_out_visitor_feature_node
static int gt_ltrharvest_fasta_out_visitor_feature_node(GtNodeVisitor *nv,
                                                        GtFeatureNode *fn,
                                                        GT_UNUSED GtError *err)
{
  GtLTRharvestFastaOutVisitor *lv;
  GtFeatureNodeIterator *fni;
  GtFeatureNode *curnode = NULL,
                *leftltr = NULL,
                *rightltr = NULL,
                *ltr_retrotrans = NULL;
  int had_err = 0,
      added_ltr = 0;
  GtRange rng,
          outrng;
  GtUword seqnum = GT_UNDEF_UWORD;
  const char *fnt;
  lv = gt_ltrharvest_fasta_out_visitor_cast(nv);
  gt_assert(lv);
  gt_error_check(err);

  /* traverse annotation subgraph and collect info */
  fni = gt_feature_node_iterator_new(fn);
  while (!had_err && (curnode = gt_feature_node_iterator_next(fni))) {
    fnt = gt_feature_node_get_type(curnode);

    if (strcmp(fnt, gt_ft_LTR_retrotransposon) == 0)
    {
      const char *val;
      ltr_retrotrans = curnode;
      val = gt_feature_node_get_attribute(curnode, "seq_number");
      if (val == NULL) {
        gt_error_set(err, "missing attribute \"seq_number\"");
        had_err = -1;
      }
      if (!had_err) {
        (void) gt_parse_uword(&seqnum, val);
      }
    }
    if (strcmp(fnt, gt_ft_long_terminal_repeat) == 0)
    {
      switch (added_ltr) {
        case 0:
          leftltr = curnode;
          break;
        case 1:
          rightltr = curnode;
          break;
        default:
          gt_error_set(err,
                       "invalid number of LTR annotations: more than 2");
          had_err = -1;
      }
      added_ltr++;
    }
  }
  gt_feature_node_iterator_delete(fni);

  /* check for invalid annotations */
  if (!had_err && (!leftltr || !rightltr)) {
    gt_error_set(err, "missing LTR annotations");
    had_err = -1;
  }

  /* determine sequence interval to output */
  if (lv->inner) {
    gt_assert(leftltr && rightltr);
    rng = gt_genome_node_get_range((GtGenomeNode*) leftltr);
    outrng.start = rng.end + 1;
    rng = gt_genome_node_get_range((GtGenomeNode*) rightltr);
    outrng.end = rng.start - 1;
  } else {
    gt_assert(ltr_retrotrans);
    rng = gt_genome_node_get_range((GtGenomeNode*) ltr_retrotrans);
    outrng = rng;
  }

  /* output FASTA sequences */
  if (!had_err && ltr_retrotrans != NULL) {
    if (outrng.start < outrng.end) {
      char *buf;
      const char *seqdesc;
      GtStr *desc;
      GtUword startpos,
                    seqdesclen;
      gt_assert(seqnum != GT_UNDEF_UWORD
                  && seqnum < gt_encseq_num_of_sequences(lv->encseq));
      seqdesc = gt_encseq_description(lv->encseq, &seqdesclen, seqnum);
      desc = gt_str_new();
      gt_str_append_cstr_nt(desc, seqdesc, seqdesclen);
      gt_str_append_cstr(desc, " (dbseq-nr ");
      gt_str_append_uword(desc, seqnum);
      gt_str_append_cstr(desc, ") [");
      gt_str_append_uword(desc, outrng.start);
      gt_str_append_cstr(desc, ",");
      gt_str_append_uword(desc, outrng.end);
      gt_str_append_cstr(desc, "]");
      buf = gt_calloc((size_t) gt_range_length(&outrng) + 1, sizeof (char));
      startpos = gt_encseq_seqstartpos(lv->encseq, seqnum);
      gt_encseq_extract_decoded(lv->encseq, buf,
                                startpos + outrng.start - 1,
                                startpos + outrng.end - 1);
      gt_fasta_show_entry(gt_str_get(desc), buf, gt_range_length(&outrng),
                          lv->width, lv->outfp);
      gt_free(buf);
      gt_str_delete(desc);
    } else {
      GtRange rootrng;
      rootrng = gt_genome_node_get_range((GtGenomeNode*) ltr_retrotrans);
      gt_warning("trying to output empty%s sequence for candidate at "
                 ""GT_WU"-"GT_WU" on sequence "GT_WU"",
                 (lv->inner ? " inner" : ""),
                 rootrng.start,
                 rootrng.end,
                 seqnum);
    }
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq $-0x1, 0x8(%rsp)
callq 0x218a00
movq %rax, %rdi
movq %r14, %rsi
callq 0x16af21
testq %rax, %rax
je 0x218e05
movq %rax, 0x20(%rsp)
testq %r15, %r15
je 0x218a9b
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0x218e0a
movq %r15, 0x28(%rsp)
movq %rbx, %rdi
callq 0x14b1a8
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %ebx, %ebx
movq %r14, %rbp
movq 0x10(%rsp), %rdi
callq 0x14b33e
testq %rax, %rax
je 0x218ba2
movq %rax, %r14
movq %rax, %rdi
callq 0x149bb2
movq %rax, %r13
movq %rax, %rdi
leaq 0x185572(%rip), %rsi    # 0x39e05e
callq 0x17a40
xorl %r12d, %r12d
testl %eax, %eax
jne 0x218b40
movq %r14, %rdi
leaq 0x1b19e0(%rip), %rsi    # 0x3ca4e2
callq 0x14918c
movq %rax, %r15
xorl %r12d, %r12d
testq %rax, %rax
jne 0x218b2b
movq 0x28(%rsp), %rdi
leaq 0x1b19cf(%rip), %rsi    # 0x3ca4ed
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x218b3d
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x11043f
movq %r14, %r15
movq %r13, %rdi
leaq 0x187e34(%rip), %rsi    # 0x3a097e
callq 0x17a40
testl %eax, %eax
je 0x218b58
movq %rbp, %r14
jmp 0x218b86
testl %ebx, %ebx
je 0x218b7c
cmpl $0x1, %ebx
je 0x218b84
movq 0x28(%rsp), %rdi
leaq 0x1b199f(%rip), %rsi    # 0x3ca50c
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x218b81
movq %r14, 0x18(%rsp)
movq %rbp, %r14
incl %ebx
testl %r12d, %r12d
je 0x218abe
movq 0x10(%rsp), %rdi
callq 0x14b3d0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %ebx, %ebx
jmp 0x218be2
movq 0x10(%rsp), %rdi
callq 0x14b3d0
cmpq $0x0, 0x18(%rsp)
setne %al
movq %rbp, %r14
testq %rbp, %rbp
setne %cl
testb %cl, %al
je 0x218bc8
xorl %ebp, %ebp
movb $0x1, %bl
jmp 0x218be2
leaq 0x1b196c(%rip), %rsi    # 0x3ca53b
xorl %ebx, %ebx
movq 0x28(%rsp), %rdi
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rax
cmpb $0x1, 0x20(%rax)
jne 0x218c21
cmpq $0x0, 0x18(%rsp)
je 0x218e14
testq %r14, %r14
je 0x218e14
movq 0x18(%rsp), %rdi
callq 0x14b8df
incq %rdx
movq %rdx, 0x30(%rsp)
movq %r14, %rdi
callq 0x14b8df
decq %rax
jmp 0x218c3d
testq %r15, %r15
je 0x218e0f
movq %r15, %rdi
callq 0x14b8df
movq %rax, %rcx
movq %rdx, %rax
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
testq %r15, %r15
setne %al
andb %al, %bl
cmpb $0x1, %bl
jne 0x218df4
movq 0x30(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x218db8
movl %ebp, 0x10(%rsp)
movq 0x8(%rsp), %rbx
cmpq $-0x1, %rbx
movq 0x20(%rsp), %rbp
je 0x218e19
movq 0x28(%rbp), %rdi
callq 0xec1e8
cmpq %rax, %rbx
jae 0x218e19
movq 0x28(%rbp), %rdi
movq 0x8(%rsp), %rdx
leaq 0x40(%rsp), %r14
movq %r14, %rsi
callq 0xf079f
movq %rax, %r15
callq 0x1208f8
movq %rax, %rbx
movq (%r14), %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x120a9d
leaq 0x1b18ff(%rip), %rsi    # 0x3ca5c2
movq %rbx, %rdi
callq 0x12097f
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x120af4
leaq 0x1b18ef(%rip), %rsi    # 0x3ca5ce
movq %rbx, %rdi
callq 0x12097f
leaq 0x30(%rsp), %r14
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x120af4
leaq 0x19199b(%rip), %rsi    # 0x3aa699
movq %rbx, %rdi
callq 0x12097f
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x120af4
leaq 0x1b87f1(%rip), %rsi    # 0x3d150a
movq %rbx, %rdi
callq 0x12097f
movq %r14, %rdi
callq 0x117813
leaq 0x1(%rax), %rdi
leaq 0x1b175a(%rip), %r15    # 0x3ca48e
movl $0x1, %esi
movq %r15, %rdx
movl $0x90, %ecx
callq 0x1093ef
movq %rax, %r12
movq 0x28(%rbp), %rdi
movq 0x8(%rsp), %rsi
callq 0xefce0
movq 0x28(%rbp), %rdi
leaq -0x1(%rax), %rcx
movq (%r14), %rdx
addq %rcx, %rdx
addq 0x8(%r14), %rcx
movq %r12, %rsi
callq 0xed87b
movq %rbx, %rdi
callq 0x120d23
movq %rax, %r13
movq %r14, %rdi
callq 0x117813
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x102ec0
movq %r12, %rdi
movq %r15, %rsi
movl $0x97, %edx
callq 0x109670
movq %rbx, %rdi
callq 0x121b03
movl 0x10(%rsp), %ebp
jmp 0x218df4
movq %r15, %rdi
callq 0x14b8df
movq %rdx, %rcx
leaq 0x1b1853(%rip), %rdx    # 0x3ca61d
movq 0x20(%rsp), %rsi
cmpb $0x0, 0x20(%rsi)
leaq 0x1baab6(%rip), %rsi    # 0x3d3890
cmovneq %rdx, %rsi
movq 0x8(%rsp), %r8
leaq 0x1b17e8(%rip), %rdi    # 0x3ca5d2
movq %rax, %rdx
xorl %eax, %eax
callq 0x125448
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x838a9
callq 0x837cb
callq 0x83802
callq 0x83839
callq 0x83870