// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x150(%rsp)
movl %esi, 0x14c(%rsp)
movq %rdx, 0x140(%rsp)
movq %rcx, 0x138(%rsp)
movl %r8d, 0x134(%rsp)
movq %r9, 0x128(%rsp)
movl $0x0, 0xc(%rsp)
cmpq $0x0, 0x128(%rsp)
je 0x3054d4
movq 0x128(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x30549c
jmp 0x3054d4
movq 0x336afd(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x210b66(%rip), %rsi    # 0x516013
leaq 0x210d0b(%rip), %rdx    # 0x5161bf
leaq 0x28d9ff(%rip), %rcx    # 0x592eba
leaq 0x28d61f(%rip), %r8     # 0x592ae1
movl $0x334, %r9d            # imm = 0x334
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x3054d6
jmp 0x3054d8
cmpq $0x0, 0x138(%rsp)
je 0x3054f9
cmpq $0x0, 0x150(%rsp)
je 0x3054f9
cmpq $0x0, 0x140(%rsp)
jne 0x305531
movq 0x336aa0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x210b09(%rip), %rsi    # 0x516013
leaq 0x28d9ca(%rip), %rdx    # 0x592edb
leaq 0x28d9a2(%rip), %rcx    # 0x592eba
leaq 0x28d5c2(%rip), %r8     # 0x592ae1
movl $0x336, %r9d            # imm = 0x336
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x305533
callq 0x304240
movq %rax, %rdi
xorl %esi, %esi
callq 0x1b1b80
movq %rax, 0x120(%rsp)
callq 0x304240
movq %rax, %rdi
movq 0x120(%rsp), %rsi
callq 0x1b20f0
movq %rax, 0x118(%rsp)
movq 0x150(%rsp), %rdi
callq 0x1b1c50
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x140(%rsp), %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x18(%rax)
movl 0x14c(%rsp), %ecx
movq 0x118(%rsp), %rax
movl %ecx, 0x60(%rax)
movl 0x134(%rsp), %ecx
movq 0x118(%rsp), %rax
movl %ecx, 0x64(%rax)
movq 0x118(%rsp), %rax
movb $0x0, 0xd8(%rax)
movq 0x118(%rsp), %rax
movb $0x0, 0xd9(%rax)
movq 0x118(%rsp), %rax
movq $0x0, 0x50(%rax)
movq 0x118(%rsp), %rax
movq $0x0, 0x40(%rax)
movq 0x118(%rsp), %rax
movq $0x0, 0x48(%rax)
movq 0x118(%rsp), %rax
movq $0x0, 0x30(%rax)
movq 0x118(%rsp), %rax
movq $0x0, 0x38(%rax)
movq 0x118(%rsp), %rax
movq $0x0, 0x28(%rax)
movq 0x138(%rsp), %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x20(%rax)
leaq 0x10(%rsp), %rdi
movq 0x138(%rsp), %rcx
movl $0xff, %esi
leaq 0x28d896(%rip), %rdx    # 0x592efc
movb $0x0, %al
callq 0x19b90
leaq 0x10(%rsp), %rsi
movq 0x128(%rsp), %rcx
xorl %edi, %edi
leaq 0x211021(%rip), %rdx    # 0x5166a4
callq 0xdd3f0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x3056ae
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
cmpl $0x0, 0xc(%rsp)
jne 0x305727
movl 0x14c(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x305727
leaq 0x10(%rsp), %rdi
movq 0x138(%rsp), %rcx
movl $0xff, %esi
leaq 0x28d82d(%rip), %rdx    # 0x592f0a
movb $0x0, %al
callq 0x19b90
leaq 0x10(%rsp), %rsi
movq 0x128(%rsp), %rcx
xorl %edi, %edi
leaq 0x210faa(%rip), %rdx    # 0x5166a4
callq 0xdd3f0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x305725
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
jmp 0x305727
cmpl $0x0, 0xc(%rsp)
jne 0x3057a0
movl 0x14c(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x3057a0
leaq 0x10(%rsp), %rdi
movq 0x138(%rsp), %rcx
movl $0xff, %esi
leaq 0x28d7bf(%rip), %rdx    # 0x592f15
movb $0x0, %al
callq 0x19b90
leaq 0x10(%rsp), %rsi
movq 0x128(%rsp), %rcx
xorl %edi, %edi
leaq 0x210f31(%rip), %rdx    # 0x5166a4
callq 0xdd3f0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x30579e
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
jmp 0x3057a0
cmpl $0x0, 0xc(%rsp)
jne 0x30580a
leaq 0x10(%rsp), %rdi
movq 0x138(%rsp), %rcx
movl $0xff, %esi
leaq 0x28d760(%rip), %rdx    # 0x592f20
movb $0x0, %al
callq 0x19b90
leaq 0x10(%rsp), %rsi
movq 0x128(%rsp), %rcx
xorl %edi, %edi
leaq 0x210ec7(%rip), %rdx    # 0x5166a4
callq 0xdd3f0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x40(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x305808
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
jmp 0x30580a
cmpl $0x0, 0xc(%rsp)
jne 0x305874
leaq 0x10(%rsp), %rdi
movq 0x138(%rsp), %rcx
movl $0xff, %esi
leaq 0x28d702(%rip), %rdx    # 0x592f2c
movb $0x0, %al
callq 0x19b90
leaq 0x10(%rsp), %rsi
movq 0x128(%rsp), %rcx
xorl %edi, %edi
leaq 0x210e5d(%rip), %rdx    # 0x5166a4
callq 0xdd3f0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x48(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x305872
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
jmp 0x305874
cmpl $0x0, 0xc(%rsp)
jne 0x3058de
leaq 0x10(%rsp), %rdi
movq 0x138(%rsp), %rcx
movl $0xff, %esi
leaq 0x28d6a4(%rip), %rdx    # 0x592f38
movb $0x0, %al
callq 0x19b90
leaq 0x10(%rsp), %rsi
movq 0x128(%rsp), %rcx
xorl %edi, %edi
leaq 0x210df3(%rip), %rdx    # 0x5166a4
callq 0xdd3f0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x3058dc
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
jmp 0x3058de
cmpl $0x0, 0xc(%rsp)
jne 0x3059a2
movq 0x118(%rsp), %rax
movq 0x28(%rax), %rdi
leaq 0x28d64c(%rip), %rsi    # 0x592f48
movb $0x0, %al
callq 0xddca0
movq 0x118(%rsp), %rax
movq 0x28(%rax), %rdi
leaq 0x28d714(%rip), %rsi    # 0x59302a
movb $0x0, %al
callq 0xddca0
movq 0x118(%rsp), %rax
movq 0x28(%rax), %rdi
leaq 0x28d943(%rip), %rsi    # 0x593273
movb $0x0, %al
callq 0xddca0
movq 0x118(%rsp), %rdi
addq $0x68, %rdi
callq 0x3059e0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x58(%rax)
movq 0x118(%rsp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x30599e
movq 0x336633(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x21069c(%rip), %rsi    # 0x516013
leaq 0x28d700(%rip), %rdx    # 0x59307e
leaq 0x28d535(%rip), %rcx    # 0x592eba
leaq 0x28d155(%rip), %r8     # 0x592ae1
movl $0x386, %r9d            # imm = 0x386
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x3059a0
jmp 0x3059a2
cmpl $0x0, 0xc(%rsp)
je 0x3059c2
movq 0x120(%rsp), %rdi
callq 0x1b1cb0
movq $0x0, 0x120(%rsp)
movq 0x120(%rsp), %rax
addq $0x158, %rsp            # imm = 0x158
retq
nopw %cs:(%rax,%rax)