// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/ltr/ltrdigest_file_out_stream.c
// Function: gt_ltrdigest_file_out_stream_new
GtNodeStream* gt_ltrdigest_file_out_stream_new(GtNodeStream *in_stream,
                                        int tests_to_run,
                                        GtRegionMapping *rmap,
                                        char *file_prefix,
                                        unsigned int seqnamelen,
                                        GtError* err)
{
  GtNodeStream *ns;
  GtLTRdigestFileOutStream *ls;
  char fn[GT_MAXFILENAMELEN];
  int had_err = 0;
  gt_error_check(err);

  gt_assert(file_prefix && in_stream && rmap);

  ns = gt_node_stream_create(gt_ltrdigest_file_out_stream_class(), false);
  ls = gt_ltrdigest_file_out_stream_cast(ns);

  /* ref GFF input stream and sequences*/
  ls->in_stream = gt_node_stream_ref(in_stream);
  ls->rmap = rmap;
  ls->tests_to_run = tests_to_run;
  ls->seqnamelen = seqnamelen;
  ls->write_pdom_alignments = false;
  ls->write_pdom_aaseqs = false;
  ls->tabout_file = ls->pptout_file = ls->pbsout_file = ls->ltr3out_file =
    ls->ltr5out_file = ls->elemout_file = NULL;

  /* open outfiles */
  ls->fileprefix = file_prefix;
  (void) snprintf(fn, (size_t) (GT_MAXFILENAMELEN-1),
                  "%s_tabout.csv", file_prefix);
  ls->tabout_file = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, fn, "w+", err);
  if (!ls->tabout_file)
    had_err = -1;
  if (!had_err && (tests_to_run & GT_LTRDIGEST_RUN_PPT))
  {
    (void) snprintf(fn, (size_t) (GT_MAXFILENAMELEN-1),
                    "%s_ppt.fas", file_prefix);
    ls->pptout_file = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, fn, "w+", err);
    if (!ls->pptout_file)
      had_err = -1;
  }
  if (!had_err && (tests_to_run & GT_LTRDIGEST_RUN_PBS))
  {
    (void) snprintf(fn, (size_t) (GT_MAXFILENAMELEN-1),
                    "%s_pbs.fas", file_prefix);
    ls->pbsout_file = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, fn, "w+", err);
    if (!ls->pbsout_file)
      had_err = -1;
  }
  if (!had_err) {
    (void) snprintf(fn, (size_t) (GT_MAXFILENAMELEN-1),
                     "%s_5ltr.fas", file_prefix);
    ls->ltr5out_file = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, fn, "w+", err);
    if (!ls->ltr5out_file)
      had_err = -1;
  }
  if (!had_err) {
    (void) snprintf(fn, (size_t) (GT_MAXFILENAMELEN-1),
                    "%s_3ltr.fas", file_prefix);
    ls->ltr3out_file = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, fn, "w+", err);
    if (!ls->ltr3out_file)
      had_err = -1;
  }
  if (!had_err) {
    (void) snprintf(fn, (size_t) (GT_MAXFILENAMELEN-1),
                    "%s_complete.fas", file_prefix);
    ls->elemout_file = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, fn, "w+", err);
    if (!ls->elemout_file)
      had_err = -1;
  }

  if (!had_err) {
    /* print tabular outfile headline */
    gt_file_xprintf(ls->tabout_file,
                "element start\telement end\telement length\tsequence\t"
                "lLTR start\tlLTR end\tlLTR length\t"
                "rLTR start\trLTR end\trLTR length\t"
                "lTSD start\tlTSD end\tlTSD motif\t"
                "rTSD start\trTSD end\trTSD motif\t"
                "PPT start\tPPT end\tPPT motif\tPPT strand\tPPT offset");
    gt_file_xprintf(ls->tabout_file,
                "\tPBS start\tPBS end\tPBS strand\ttRNA\ttRNA motif\tPBS "
                "offset\t"
                "tRNA offset\tPBS/tRNA edist");
  #ifdef HAVE_HMMER
    gt_file_xprintf(ls->tabout_file, "\tProtein domain hits");
  #endif
    gt_file_xprintf(ls->tabout_file, "\n");

    /* create visitor */
    ls->lv = (GtLTRVisitor*) gt_ltr_visitor_new(&ls->element);
    gt_assert(ls->lv);
  }

  if (had_err) {
    gt_node_stream_delete(ns);
    ns = NULL;
  }
  return ns;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r9, %r14
movl %r8d, %r13d
movq %rcx, %r12
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
testq %r9, %r9
je 0x20aac8
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x20ad65
movq %r14, 0x8(%rsp)
testq %rbx, %rbx
je 0x20ad60
testq %r15, %r15
je 0x20ad60
testq %r12, %r12
je 0x20ad60
callq 0x20a5d1
movq %rax, %rdi
xorl %esi, %esi
callq 0x162d6c
movq %rax, %r14
callq 0x20a5d1
movq %rax, %rdi
movq %r14, (%rsp)
movq %r14, %rsi
callq 0x162ff7
movq %rax, %r14
movq %r15, %rdi
callq 0x162dd8
movq %rax, 0x10(%r14)
movq %rbx, 0x18(%r14)
movl %ebp, 0x60(%r14)
movl %r13d, 0x64(%r14)
movw $0x0, 0xd8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r14)
movups %xmm0, 0x38(%r14)
movups %xmm0, 0x48(%r14)
movq %r12, 0x20(%r14)
leaq 0x1b521b(%rip), %rdx    # 0x3bfd6b
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13aafb(%rip), %rdx    # 0x345669
xorl %edi, %edi
movq %rbx, %rsi
movq 0x8(%rsp), %r15
movq %r15, %rcx
callq 0xfead5
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x20ad43
testb $0x1, %bpl
je 0x20abd2
leaq 0x1b51df(%rip), %rdx    # 0x3bfd79
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13aab1(%rip), %rdx    # 0x345669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0xfead5
movq %rax, 0x38(%r14)
testq %rax, %rax
je 0x20ad43
testb $0x2, %bpl
je 0x20ac17
leaq 0x1b51a5(%rip), %rdx    # 0x3bfd84
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13aa6c(%rip), %rdx    # 0x345669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0xfead5
movq %rax, 0x30(%r14)
testq %rax, %rax
je 0x20ad43
leaq 0x1b5171(%rip), %rdx    # 0x3bfd8f
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13aa2d(%rip), %rdx    # 0x345669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0xfead5
movq %rax, 0x40(%r14)
testq %rax, %rax
je 0x20ad43
leaq 0x1b513e(%rip), %rdx    # 0x3bfd9b
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a9ee(%rip), %rdx    # 0x345669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0xfead5
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x20ad43
leaq 0x1b510b(%rip), %rdx    # 0x3bfda7
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a9af(%rip), %rdx    # 0x345669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0xfead5
movq %rax, 0x50(%r14)
testq %rax, %rax
je 0x20ad43
movq 0x28(%r14), %rdi
leaq 0x1b50dc(%rip), %rsi    # 0x3bfdb7
xorl %eax, %eax
callq 0xfee51
movq 0x28(%r14), %rdi
leaq 0x1b51ac(%rip), %rsi    # 0x3bfe99
xorl %eax, %eax
callq 0xfee51
movq 0x28(%r14), %rdi
leaq 0x1b53a0(%rip), %rsi    # 0x3c009f
xorl %eax, %eax
callq 0xfee51
movq %r14, %r15
addq $0x68, %r15
callq 0x2093e8
movq %rax, %rdi
callq 0x163080
movq %rax, %rbx
callq 0x2093e8
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1630b1
movq %r15, 0x10(%rax)
movq %rbx, 0x58(%r14)
testq %rbx, %rbx
movq (%rsp), %rax
jne 0x20ad4e
callq 0x80ac1
movq (%rsp), %rdi
callq 0x162dee
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x80a88
callq 0x80a4f
nop