// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/tir_stream.c
// Function: gt_tir_stream_new
GtNodeStream* gt_tir_stream_new(GtStr *str_indexname,
                                GtUword min_seed_length,
                                GtUword min_TIR_length,
                                GtUword max_TIR_length,
                                GtUword min_TIR_distance,
                                GtUword max_TIR_distance,
                                GtXdropArbitraryscores arbit_scores,
                                int xdrop_belowscore,
                                double similarity_threshold,
                                bool best_overlaps,
                                bool longest_overlaps,
                                bool no_overlaps,
                                GtUword min_TSD_length,
                                GtUword max_TSD_length,
                                GtUword vicinity,
                                GtError *err)
{
  int had_err = 0;
  GtNodeStream *ns = gt_node_stream_create(gt_tir_stream_class(), false);
  GtTIRStream *tir_stream = gt_node_stream_cast(gt_tir_stream_class(), ns);
  tir_stream->num_of_tirs = 0;
  tir_stream->tir_pairs = NULL;
  tir_stream->cur_elem_index = 0;
  tir_stream->prev_seqnum = GT_UNDEF_UWORD;
  tir_stream->state = GT_TIR_STREAM_STATE_START;

  tir_stream->str_indexname = gt_str_ref(str_indexname);
  tir_stream->min_seed_length = min_seed_length;
  tir_stream->min_TIR_length = min_TIR_length;
  tir_stream->max_TIR_length = max_TIR_length;
  tir_stream->min_TIR_distance = min_TIR_distance;
  tir_stream->max_TIR_distance = max_TIR_distance;
  tir_stream->arbit_scores = arbit_scores;
  tir_stream->xdrop_belowscore = xdrop_belowscore;
  tir_stream->similarity_threshold = similarity_threshold;
  tir_stream->best_overlaps = best_overlaps;
  tir_stream->longest_overlaps = longest_overlaps;
  tir_stream->no_overlaps = no_overlaps;
  tir_stream->min_TSD_length = min_TSD_length;
  tir_stream->max_TSD_length = max_TSD_length;
  tir_stream->vicinity = vicinity;
  tir_stream->output_seqids = true;
  tir_stream->output_md5 = false;

  tir_stream->seedinfo.max_tir_length = max_TIR_length;
  tir_stream->seedinfo.min_tir_length = min_TIR_length;
  tir_stream->seedinfo.max_tir_distance = max_TIR_distance;
  tir_stream->seedinfo.min_tir_distance = min_TIR_distance;

  tir_stream->ssar =
      gt_newSequentialsuffixarrayreaderfromfile(gt_str_get(str_indexname),
                                                SARR_LCPTAB | SARR_SUFTAB |
                                                SARR_ESQTAB | SARR_DESTAB |
                                                SARR_SSPTAB | SARR_SDSTAB,
                                                true,
                                                NULL,
                                                err);
  if (tir_stream->ssar == NULL) {
    gt_node_stream_delete(ns);
    return NULL;
  }
  tir_stream->encseq = gt_encseqSequentialsuffixarrayreader(tir_stream->ssar);
  if (!gt_encseq_is_mirrored(tir_stream->encseq)) {
    gt_error_set(err, "index for '%s' is not mirrored (suffixerator option "
                      "-mirrored)!", gt_str_get(str_indexname));
    gt_node_stream_delete(ns);
    return NULL;
  }
  GT_INITARRAY(&tir_stream->seedinfo.seed, Seed);
  GT_INITARRAY(&tir_stream->first_pairs, TIRPair);
  tir_stream->seedinfo.num_of_contigs =
                                 gt_encseq_num_of_sequences(tir_stream->encseq);
  tir_stream->seedinfo.totallength =
                                 gt_encseq_total_length(tir_stream->encseq);
  tir_stream->seedinfo.midpos =
                           (gt_encseq_total_length(tir_stream->encseq) - 1) / 2;

  if (!had_err)
    return ns;

  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movsd %xmm0, 0x18(%rsp)
movq %r9, %rbp
movq %r8, 0x20(%rsp)
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
cmpq $0x0, 0x33edfd(%rip)    # 0x4c98e8
jne 0x18ab0c
leaq -0x13b2(%rip), %rsi     # 0x189742
leaq -0x1302(%rip), %rdx     # 0x1897f9
movl $0x120, %edi            # imm = 0x120
callq 0x16abb4
movq %rax, 0x33eddc(%rip)    # 0x4c98e8
movq 0x33edd5(%rip), %rdi    # 0x4c98e8
xorl %esi, %esi
callq 0x16abec
movq %rax, %r13
cmpq $0x0, 0x33edc3(%rip)    # 0x4c98e8
jne 0x18ab46
leaq -0x13ec(%rip), %rsi     # 0x189742
leaq -0x133c(%rip), %rdx     # 0x1897f9
movl $0x120, %edi            # imm = 0x120
callq 0x16abb4
movq %rax, 0x33eda2(%rip)    # 0x4c98e8
movq 0x33ed9b(%rip), %rdi    # 0x4c98e8
movq %r13, %rsi
callq 0x16ae64
movq %rax, %r12
movq $0x0, 0x70(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rax)
movq $-0x1, 0xa8(%rax)
movl $0x0, 0x90(%rax)
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x120e79
movq %rax, 0xb0(%r12)
movq 0x10(%rsp), %rax
movq %rax, 0xb8(%r12)
movq %r15, 0xc0(%r12)
movq %r14, 0xc8(%r12)
movq 0x20(%rsp), %rax
movq %rax, 0xd0(%r12)
movq %rbp, 0xd8(%r12)
leaq 0x60(%rsp), %rcx
movups (%rcx), %xmm0
movups %xmm0, 0xe0(%r12)
movl 0x70(%rsp), %ecx
movl %ecx, 0xf0(%r12)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0xf8(%r12)
movb 0x78(%rsp), %cl
movb %cl, 0x101(%r12)
movb 0x80(%rsp), %cl
movb %cl, 0x102(%r12)
movb 0x88(%rsp), %cl
movb %cl, 0x100(%r12)
movq 0x90(%rsp), %rcx
movq %rcx, 0x108(%r12)
movq 0x98(%rsp), %rcx
movq %rcx, 0x110(%r12)
movq 0xa0(%rsp), %rcx
movq %rcx, 0x118(%r12)
movw $0x1, 0x103(%r12)
movq %r14, 0x38(%r12)
movq %r15, 0x40(%r12)
movq %rbp, 0x48(%r12)
movq %rax, 0x50(%r12)
movq %rbx, %rdi
callq 0x120d23
movq %rax, %rdi
movl $0xb7, %esi
movl $0x1, %edx
xorl %ecx, %ecx
movq 0xa8(%rsp), %r14
movq %r14, %r8
callq 0x1ae094
movq %rax, 0x18(%r12)
testq %rax, %rax
je 0x18ad31
movq %rax, %rdi
callq 0x1ae549
movq %rax, 0x10(%r12)
movq %rax, %rdi
callq 0xfac80
testb %al, %al
je 0x18ad13
movq %r12, %rax
addq $0x20, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movq %rcx, 0x88(%r12)
movups %xmm0, 0x78(%r12)
movq 0x10(%r12), %rdi
callq 0xec1e8
movq %rax, 0x58(%r12)
movq 0x10(%r12), %rdi
callq 0xec1d8
movq %rax, 0x68(%r12)
movq 0x10(%r12), %rdi
callq 0xec1d8
decq %rax
shrq %rax
movq %rax, 0x60(%r12)
movq %r13, %rax
jmp 0x18ad3b
movq 0x8(%rsp), %rdi
callq 0x120d23
leaq 0x214fbd(%rip), %rsi    # 0x39fce1
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1019cf
movq %r13, %rdi
callq 0x16ac6e
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq