// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/ltr/ltrharvest_stream.c
// Function: gt_ltrharvest_stream_new
GtNodeStream* gt_ltrharvest_stream_new(GtStr *str_indexname,
                                       GtRange searchrange,
                                       GtUword minseedlength,
                                       GtUword minltrlength,
                                       GtUword maxltrlength,
                                       GtUword mindistance,
                                       GtUword maxdistance,
                                       double similaritythreshold,
                                       int xdropbelowscore,
                                       GtXdropArbitraryscores arbitscores,
                                       GtLTRFourCharMotif *motif,
                                       bool verbosemode,
                                       bool nooverlaps,
                                       bool bestoverlaps,
                                       bool scanfile,
                                       GtUword offset,
                                       unsigned int minlengthTSD,
                                       unsigned int maxlengthTSD,
                                       GtUword vicinity,
                                       GtError *err)
{
  int had_err = 0;
  GtUword max_contiglength;
  GtNodeStream *ns = gt_node_stream_create(gt_ltrharvest_stream_class(), false);
  GtLTRharvestStream *ltrh_stream = gt_ltrharvest_stream_cast(ns);

  ltrh_stream->str_indexname = str_indexname;
  ltrh_stream->minseedlength = minseedlength;
  ltrh_stream->similaritythreshold = similaritythreshold;
  ltrh_stream->xdropbelowscore = xdropbelowscore;
  ltrh_stream->arbitscores = arbitscores;
  ltrh_stream->motif = motif;
  ltrh_stream->verbosemode = verbosemode;
  ltrh_stream->offset = offset;
  ltrh_stream->repeatinfo.ltrsearchseqrange = searchrange;
  ltrh_stream->minlengthTSD = minlengthTSD;
  ltrh_stream->maxlengthTSD = maxlengthTSD;
  ltrh_stream->nooverlaps = nooverlaps;
  ltrh_stream->bestoverlaps = bestoverlaps;
  ltrh_stream->vicinityforcorrectboundaries = vicinity;
  ltrh_stream->cur_elem_index = 0;
  ltrh_stream->output_md5 = false;
  ltrh_stream->output_seqids = false;
  ltrh_stream->state = GT_LTRHARVEST_STREAM_STATE_START;
  /* init array for maximal repeats */
  GT_INITARRAY(&ltrh_stream->arrayLTRboundaries, LTRboundaries);

  ltrh_stream->ssar =
    gt_newSequentialsuffixarrayreaderfromfile(gt_str_get(str_indexname),
                                                SARR_LCPTAB | SARR_SUFTAB |
                                                SARR_ESQTAB |
                                                SARR_SSPTAB | SARR_SDSTAB,
                                                scanfile,
                                                NULL,
                                                err);
  if (ltrh_stream->ssar == NULL)
  {
    gt_node_stream_delete(ns);
    return NULL;
  }
  /* get encseq associated with suffix array */
  ltrh_stream->encseq = gt_encseqSequentialsuffixarrayreader(ltrh_stream->ssar);
  /* let's print a warning if a mirrored index is used, this might have
     probably unintended effects if the user is reusing indexes from
     TIRvish */
  if (gt_encseq_is_mirrored(ltrh_stream->encseq)) {
    gt_warning("running LTRharvest on a mirrored index, "
               "results may be duplicated");
  }
  max_contiglength = gt_encseq_max_seq_length(ltrh_stream->encseq);
  ltrh_stream->repeatinfo.dmax = GT_MIN(maxdistance,max_contiglength);
  ltrh_stream->repeatinfo.dmin = mindistance;
  ltrh_stream->repeatinfo.lmin = minltrlength;
  ltrh_stream->repeatinfo.lmax = maxltrlength;

  /* encode motif according to encseq alphabet */
  had_err = gt_ltr_four_char_motif_encode(motif, ltrh_stream->encseq, err);
  if (had_err)
  {
    gt_node_stream_delete(ns);
    return NULL;
  }

  return had_err ? NULL : ns;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movsd %xmm0, 0x10(%rsp)
movq %r9, 0x8(%rsp)
movq %r8, (%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1c3d50
movq %rax, %rdi
xorl %esi, %esi
callq 0x10289f
movq %rax, %r13
callq 0x1c3d50
movq %rax, %rdi
movq %r13, %rsi
callq 0x102c81
movq %rax, %rbp
movq %r14, 0x58(%rax)
movq %r15, 0x60(%rax)
movq 0xc0(%rsp), %r15
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x68(%rax)
movl 0x60(%rsp), %eax
movl %eax, 0x70(%rbp)
movups 0x68(%rsp), %xmm0
movups %xmm0, 0x74(%rbp)
movq 0x78(%rsp), %rax
movq %rax, 0x88(%rbp)
movb 0x80(%rsp), %al
movb %al, 0xe8(%rbp)
movq 0xa0(%rsp), %rax
movq %rax, 0x90(%rbp)
movq %rbx, 0x48(%rbp)
movq %r12, 0x50(%rbp)
movl 0xa8(%rsp), %eax
movl %eax, 0x98(%rbp)
movl 0xb0(%rsp), %eax
movl %eax, 0x9c(%rbp)
movb 0x88(%rsp), %al
movb %al, 0xe9(%rbp)
movb 0x90(%rsp), %al
movb %al, 0xea(%rbp)
movq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rbp)
andq $0x0, 0xf0(%rbp)
andw $0x0, 0xeb(%rbp)
andl $0x0, 0xf8(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0xc0(%rbp)
andq $0x0, 0xd0(%rbp)
movq %r14, %rdi
callq 0xad1fa
movzbl 0x98(%rsp), %edx
movq %rax, %rdi
movl $0xa7, %esi
xorl %ecx, %ecx
movq %r15, %r8
callq 0x1516ac
movq %rax, 0xe0(%rbp)
testq %rax, %rax
je 0x1c4ddf
movq 0x58(%rsp), %r14
movq 0x50(%rsp), %rbx
movq %rax, %rdi
callq 0x151c21
movq %rax, 0xd8(%rbp)
movq %rax, %rdi
callq 0x81dea
testb %al, %al
je 0x1c4d9b
leaq 0x19c6c2(%rip), %rdi    # 0x361456
xorl %eax, %eax
callq 0xb2cd0
movq 0xd8(%rbp), %rdi
callq 0x755c5
cmpq %r14, %rax
cmovbq %rax, %r14
movq %r14, 0x40(%rbp)
movq %rbx, 0x38(%rbp)
movq (%rsp), %rax
movq %rax, 0x28(%rbp)
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rbp)
movq 0xd8(%rbp), %rsi
movq 0x78(%rsp), %rdi
movq %r15, %rdx
callq 0x2ce1f0
testl %eax, %eax
je 0x1c4dea
movq %r13, %rdi
callq 0x10297b
xorl %r13d, %r13d
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq