// File: /workspace/github_c_makefile_star2_O1/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, %ebp
movq %rcx, %r13
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r15
testq %r9, %r9
je 0x21442d
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x2146da
movq %r14, 0x8(%rsp)
testq %rbx, %rbx
je 0x2146d5
testq %r15, %r15
je 0x2146d5
testq %r13, %r13
je 0x2146d5
callq 0x213f35
movq %rax, %rdi
xorl %esi, %esi
callq 0x16abec
movq %rax, %r14
callq 0x213f35
movq %rax, %rdi
movq %r14, (%rsp)
movq %r14, %rsi
callq 0x16ae64
movq %rax, %r14
movq %r15, %rdi
callq 0x16ac58
movq %rax, 0x10(%r14)
movq %rbx, 0x18(%r14)
movl %r12d, 0x60(%r14)
movl %ebp, 0x64(%r14)
movw $0x0, 0xd8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r14)
movups %xmm0, 0x38(%r14)
movups %xmm0, 0x48(%r14)
movq %r13, 0x20(%r14)
leaq 0x1b4f36(%rip), %rdx    # 0x3c93eb
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a196(%rip), %rdx    # 0x34e669
xorl %edi, %edi
movq %rbx, %rsi
movq 0x8(%rsp), %r15
xorl %ebp, %ebp
movq %r15, %rcx
callq 0x1039a2
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x214639
testb $0x1, %r12b
je 0x21453b
leaq 0x1b4ef8(%rip), %rdx    # 0x3c93f9
xorl %ebp, %ebp
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a148(%rip), %rdx    # 0x34e669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x1039a2
movq %rax, 0x38(%r14)
testq %rax, %rax
je 0x214639
testb $0x2, %r12b
je 0x214582
leaq 0x1b4ebc(%rip), %rdx    # 0x3c9404
xorl %ebp, %ebp
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a101(%rip), %rdx    # 0x34e669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x1039a2
movq %rax, 0x30(%r14)
testq %rax, %rax
je 0x214639
leaq 0x1b4e86(%rip), %rdx    # 0x3c940f
xorl %ebp, %ebp
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a0c0(%rip), %rdx    # 0x34e669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x1039a2
movq %rax, 0x40(%r14)
testq %rax, %rax
je 0x214639
leaq 0x1b4e55(%rip), %rdx    # 0x3c941b
xorl %ebp, %ebp
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a083(%rip), %rdx    # 0x34e669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x1039a2
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x214639
leaq 0x1b4e24(%rip), %rdx    # 0x3c9427
leaq 0x10(%rsp), %rbx
movl $0xff, %esi
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x13a048(%rip), %rdx    # 0x34e669
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x1039a2
movq %rax, 0x50(%r14)
testq %rax, %rax
setne %bpl
testb %bpl, %bpl
je 0x2146b8
movq 0x28(%r14), %rdi
leaq 0x1b4dee(%rip), %rsi    # 0x3c9437
xorl %eax, %eax
callq 0x103d21
movq 0x28(%r14), %rdi
leaq 0x1b4ebe(%rip), %rsi    # 0x3c9519
xorl %eax, %eax
callq 0x103d21
movq 0x28(%r14), %rdi
leaq 0x1b50b2(%rip), %rsi    # 0x3c971f
xorl %eax, %eax
callq 0x103d21
movq %r14, %r15
addq $0x68, %r15
callq 0x212d3c
movq %rax, %rdi
callq 0x16aef0
movq %rax, %rbx
callq 0x212d3c
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16af21
movq %r15, 0x10(%rax)
testq %rax, %rax
je 0x2146df
movq %rbx, 0x58(%r14)
testq %rbx, %rbx
je 0x2146e4
testb %bpl, %bpl
je 0x2146b8
movq (%rsp), %rax
jmp 0x2146c3
movq (%rsp), %rdi
callq 0x16ac6e
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x829ad
callq 0x82974
callq 0x82a1f
callq 0x829e6
nopl (%rax)