// File: /workspace/github_c_makefile_star2_O3/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, 0x10(%rsp)
callq 0x20f01c
movq %rax, %rdi
movq %r14, %rsi
callq 0x1630b1
testq %rax, %rax
je 0x20f41f
movq %rax, 0x28(%rsp)
testq %r15, %r15
je 0x20f0b7
movq %r15, %rdi
callq 0xfcc32
testb %al, %al
jne 0x20f424
movq %r15, 0x20(%rsp)
movq %rbx, %rdi
callq 0x143f54
movq %rax, %rbp
movq $0x0, 0x18(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x8(%rsp)
xorl %r13d, %r13d
movq %r14, %r12
movq %rbp, %rdi
callq 0x1440ea
testq %rax, %rax
je 0x20f1bc
movq %rax, %r14
movq %rax, %rdi
callq 0x142988
movq %rax, %r15
movq %rax, %rdi
leaq 0x185aac(%rip), %rsi    # 0x394bb7
callq 0x17a40
xorl %ebx, %ebx
testl %eax, %eax
jne 0x20f156
movq %r14, %rdi
leaq 0x1b1cfe(%rip), %rsi    # 0x3c0e1e
callq 0x141f50
testq %rax, %rax
je 0x20f139
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x10b217
jmp 0x20f151
movq 0x20(%rsp), %rdi
leaq 0x1b1ce4(%rip), %rsi    # 0x3c0e29
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r14, 0x8(%rsp)
movq %r15, %rdi
leaq 0x188358(%rip), %rsi    # 0x3974b8
callq 0x17a40
testl %eax, %eax
je 0x20f16e
movq %r12, %r14
jmp 0x20f19e
testl %r13d, %r13d
je 0x20f193
cmpl $0x1, %r13d
je 0x20f19b
movq 0x20(%rsp), %rdi
leaq 0x1b1cc3(%rip), %rsi    # 0x3c0e48
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x20f198
movq %r14, 0x18(%rsp)
movq %r12, %r14
incl %r13d
testl %ebx, %ebx
je 0x20f0df
movq %rbp, %rdi
callq 0x14417c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movq 0x28(%rsp), %r12
jmp 0x20f1ff
movq %rbp, %rdi
callq 0x14417c
cmpq $0x0, 0x18(%rsp)
setne %al
movq %r12, %r14
testq %r12, %r12
setne %cl
testb %cl, %al
movq 0x28(%rsp), %r12
je 0x20f1e5
xorl %ebp, %ebp
movb $0x1, %bl
jmp 0x20f1ff
leaq 0x1b1c8b(%rip), %rsi    # 0x3c0e77
xorl %ebx, %ebx
movq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %r13
cmpb $0x1, 0x20(%r12)
jne 0x20f243
cmpq $0x0, 0x18(%rsp)
je 0x20f42e
testq %r14, %r14
je 0x20f42e
movq 0x18(%rsp), %rdi
callq 0x144679
incq %rdx
movq %rdx, 0x30(%rsp)
movq %r14, %rdi
callq 0x144679
movq %rax, %r15
decq %r15
jmp 0x20f25c
testq %r13, %r13
je 0x20f429
movq %r13, %rdi
callq 0x144679
movq %rdx, %r15
movq %rax, 0x30(%rsp)
movq %r15, 0x38(%rsp)
testq %r13, %r13
setne %al
andb %al, %bl
cmpb $0x1, %bl
jne 0x20f40e
movq 0x30(%rsp), %r14
cmpq %r15, %r14
jae 0x20f3d5
movl %ebp, 0x8(%rsp)
movq 0x10(%rsp), %rbx
cmpq $-0x1, %rbx
je 0x20f433
movq 0x28(%r12), %rdi
callq 0xe7bac
cmpq %rax, %rbx
jae 0x20f433
movq 0x28(%r12), %rdi
movq 0x10(%rsp), %rdx
movq %r12, %rbp
leaq 0x40(%rsp), %r12
movq %r12, %rsi
callq 0xec19e
movq %rax, %r13
callq 0x11ac6c
movq %rax, %rbx
movq (%r12), %rdx
movq %rax, %rdi
movq %r13, %rsi
callq 0x11ae1b
leaq 0x1b1c1d(%rip), %rsi    # 0x3c0efe
movq %rbx, %rdi
callq 0x11acf3
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x11ae72
leaq 0x1b1c0d(%rip), %rsi    # 0x3c0f0a
movq %rbx, %rdi
callq 0x11acf3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11ae72
leaq 0x191e25(%rip), %rsi    # 0x3a113c
movq %rbx, %rdi
callq 0x11acf3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11ae72
leaq 0x1b8ab1(%rip), %rsi    # 0x3c7de2
movq %rbx, %rdi
callq 0x11acf3
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x112233
leaq 0x1(%rax), %rdi
leaq 0x1b1a79(%rip), %r14    # 0x3c0dca
movl $0x1, %esi
movq %r14, %rdx
movl $0x90, %ecx
callq 0x10436a
movq %rax, %r12
movq 0x28(%rbp), %rdi
movq 0x10(%rsp), %rsi
callq 0xeb6ee
movq 0x28(%rbp), %rdi
leaq -0x1(%rax), %rcx
movq (%r15), %rdx
addq %rcx, %rdx
addq 0x8(%r15), %rcx
movq %r12, %rsi
callq 0xe92be
movq %rbx, %rdi
callq 0x11b0a1
movq %rax, %r13
movq %r15, %rdi
callq 0x112233
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xfe000
movq %r12, %rdi
movq %r14, %rsi
movl $0x97, %edx
callq 0x1045eb
movq %rbx, %rdi
callq 0x11bdbf
movl 0x8(%rsp), %ebp
jmp 0x20f40e
movq %r13, %rdi
callq 0x144679
movq %rdx, %rcx
leaq 0x1b1b72(%rip), %rdx    # 0x3c0f59
cmpb $0x0, 0x20(%r12)
leaq 0x1bad7c(%rip), %rsi    # 0x3ca170
cmovneq %rdx, %rsi
movq 0x10(%rsp), %r8
leaq 0x1b1b0a(%rip), %rdi    # 0x3c0f0e
movq %rax, %rdx
xorl %eax, %eax
callq 0x11f68c
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x818a0
callq 0x817c2
callq 0x817f9
callq 0x81830
callq 0x81867