// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movq %rdx, 0x110(%rsp)
movq $0x0, 0xf8(%rsp)
movq $0x0, 0xf0(%rsp)
movq $0x0, 0xe8(%rsp)
movq $0x0, 0xe0(%rsp)
movl $0x0, 0xdc(%rsp)
movl $0x0, 0xd8(%rsp)
movq $-0x1, 0xb0(%rsp)
callq 0x30d810
movq %rax, %rdi
movq 0x120(%rsp), %rsi
callq 0x1b2350
movq %rax, 0x108(%rsp)
cmpq $0x0, 0x108(%rsp)
jne 0x30d931
movq 0x32e6a0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x208709(%rip), %rsi    # 0x516013
leaq 0x285771(%rip), %rdx    # 0x593082
leaq 0x2867c7(%rip), %rcx    # 0x5940df
leaq 0x286799(%rip), %r8     # 0x5940b8
movl $0x41, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30d933
jmp 0x30d935
cmpq $0x0, 0x110(%rsp)
je 0x30d98b
movq 0x110(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x30d953
jmp 0x30d98b
movq 0x32e646(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2086af(%rip), %rsi    # 0x516013
leaq 0x208854(%rip), %rdx    # 0x5161bf
leaq 0x28676d(%rip), %rcx    # 0x5940df
leaq 0x28673f(%rip), %r8     # 0x5940b8
movl $0x42, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30d98d
movq 0x118(%rsp), %rdi
callq 0x170b00
movq %rax, 0x100(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xdc(%rsp)
movb %al, 0x27(%rsp)
jne 0x30d9d2
movq 0x100(%rsp), %rdi
callq 0x170e30
movq %rax, 0xf8(%rsp)
cmpq $0x0, %rax
setne %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x30d9df
jmp 0x30db16
movq 0xf8(%rsp), %rdi
callq 0x16d430
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
leaq 0x259b39(%rip), %rsi    # 0x56753c
callq 0x19980
cmpl $0x0, %eax
jne 0x30da86
movq 0xf8(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xf8(%rsp), %rdi
leaq 0x2866e0(%rip), %rsi    # 0x59410c
callq 0x16c040
movq %rax, 0xa0(%rsp)
cmpq $0x0, 0xa0(%rsp)
jne 0x30da65
movq 0x110(%rsp), %rdi
leaq 0x2866c4(%rip), %rsi    # 0x594117
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0xdc(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0xdc(%rsp)
jne 0x30da84
movq 0xa0(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0xf86d0
jmp 0x30da86
movq 0xa8(%rsp), %rdi
leaq 0x25c421(%rip), %rsi    # 0x569eb6
callq 0x19980
cmpl $0x0, %eax
jne 0x30db11
movl 0xd8(%rsp), %eax
movl %eax, 0x20(%rsp)
testl %eax, %eax
je 0x30dabb
jmp 0x30dab0
movl 0x20(%rsp), %eax
subl $0x1, %eax
je 0x30dacd
jmp 0x30dadf
movq 0xf8(%rsp), %rax
movq %rax, 0xf0(%rsp)
jmp 0x30db00
movq 0xf8(%rsp), %rax
movq %rax, 0xe8(%rsp)
jmp 0x30db00
movq 0x110(%rsp), %rdi
leaq 0x286648(%rip), %rsi    # 0x594136
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0xdc(%rsp) # imm = 0xFFFFFFFF
movl 0xd8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd8(%rsp)
jmp 0x30d9a2
movq 0x100(%rsp), %rdi
callq 0x170f50
cmpl $0x0, 0xdc(%rsp)
jne 0x30db64
cmpq $0x0, 0xf0(%rsp)
je 0x30db43
cmpq $0x0, 0xe8(%rsp)
jne 0x30db64
movq 0x110(%rsp), %rdi
leaq 0x286613(%rip), %rsi    # 0x594165
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0xdc(%rsp) # imm = 0xFFFFFFFF
movq 0x108(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x30dc6f
jmp 0x30db78
cmpq $0x0, 0xf0(%rsp)
je 0x30db8e
cmpq $0x0, 0xe8(%rsp)
jne 0x30dbc6
movq 0x32e40b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x208474(%rip), %rsi    # 0x516013
leaq 0x2865d7(%rip), %rdx    # 0x59417d
leaq 0x286532(%rip), %rcx    # 0x5940df
leaq 0x286504(%rip), %r8     # 0x5940b8
movl $0x71, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30dbc8
movq 0xf0(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x90(%rsp)
movq %rdx, 0x98(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
movq 0xe8(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x80(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0xc8(%rsp), %rax
subq $0x1, %rax
movq %rax, 0xc0(%rsp)
jmp 0x30dd07
jmp 0x30dc71
cmpq $0x0, 0xe0(%rsp)
jne 0x30dcb4
movq 0x32e31d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x208386(%rip), %rsi    # 0x516013
leaq 0x2864fd(%rip), %rdx    # 0x594191
leaq 0x286444(%rip), %rcx    # 0x5940df
leaq 0x286416(%rip), %r8     # 0x5940b8
movl $0x77, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30dcb6
movq 0xe0(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x70(%rsp)
movq %rdx, 0x78(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
cmpl $0x0, 0xdc(%rsp)
jne 0x30dfcb
cmpq $0x0, 0xe0(%rsp)
je 0x30dfcb
movq 0xb8(%rsp), %rax
cmpq 0xc0(%rsp), %rax
jae 0x30df5e
jmp 0x30dd3c
cmpq $-0x1, 0xb0(%rsp)
je 0x30dd72
movq 0xb0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x108(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xa9d50
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jb 0x30ddaa
movq 0x32e227(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x208290(%rip), %rsi    # 0x516013
leaq 0x286416(%rip), %rdx    # 0x5941a0
leaq 0x28634e(%rip), %rcx    # 0x5940df
leaq 0x286320(%rip), %r8     # 0x5940b8
movl $0x85, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x30ddac
movq 0x108(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0xb0(%rsp), %rdx
leaq 0x48(%rsp), %rsi
callq 0xb1b40
movq %rax, 0x60(%rsp)
callq 0x11d4a0
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x11d830
movq 0x58(%rsp), %rdi
leaq 0x2863f3(%rip), %rsi    # 0x5941ec
callq 0x11d550
movq 0x58(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x11d930
movq 0x58(%rsp), %rdi
leaq 0x2863dc(%rip), %rsi    # 0x5941f8
callq 0x11d550
movq 0x58(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x11d930
movq 0x58(%rsp), %rdi
leaq 0x2658b4(%rip), %rsi    # 0x5736f3
callq 0x11d550
movq 0x58(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x11d930
movq 0x58(%rsp), %rdi
leaq 0x28d4fd(%rip), %rsi    # 0x59b35f
callq 0x11d550
leaq 0xb8(%rsp), %rdi
callq 0x107320
movq %rax, %rdi
addq $0x1, %rdi
movl $0x1, %esi
leaq 0x286231(%rip), %rdx    # 0x5940b8
movl $0x90, %ecx
callq 0xe83c0
movq %rax, 0x68(%rsp)
movq 0x108(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0xb0(%rsp), %rsi
callq 0xb0530
movq %rax, 0x50(%rsp)
movq 0x108(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x68(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq 0xb8(%rsp), %rdx
subq $0x1, %rdx
movq 0x50(%rsp), %rcx
addq 0xc0(%rsp), %rcx
subq $0x1, %rcx
callq 0xac570
movq 0x58(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x107320
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
movq 0x108(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x108(%rsp), %rax
movq 0x10(%rax), %r8
callq 0xdbd10
movq 0x68(%rsp), %rdi
leaq 0x286170(%rip), %rsi    # 0x5940b8
movl $0x97, %edx
callq 0xe88c0
movq 0x58(%rsp), %rdi
callq 0x11f560
jmp 0x30dfc9
movq 0xe0(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x108(%rsp), %rax
movb 0x20(%rax), %cl
leaq 0x28f68d(%rip), %rsi    # 0x59d628
leaq 0x2862a5(%rip), %rax    # 0x594247
testb $0x1, %cl
cmovneq %rax, %rsi
movq 0x38(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0xb0(%rsp), %r8
leaq 0x28623a(%rip), %rdi    # 0x5941fc
movb $0x0, %al
callq 0x1267d0
jmp 0x30dfcb
movl 0xdc(%rsp), %eax
addq $0x128, %rsp            # imm = 0x128
retq
nopw (%rax,%rax)