// File: /workspace/github_c_makefile_star2_O3/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)
movq 0x33c512(%rip), %rdi    # 0x4be8e8
testq %rdi, %rdi
jne 0x1823fd
leaq -0x1360(%rip), %rsi     # 0x181082
leaq -0x12b2(%rip), %rdx     # 0x181137
movl $0x120, %edi            # imm = 0x120
callq 0x162d34
movq %rax, %rdi
movq %rax, 0x33c4eb(%rip)    # 0x4be8e8
xorl %esi, %esi
callq 0x162d6c
movq %rax, %r13
movq 0x33c4da(%rip), %rdi    # 0x4be8e8
testq %rdi, %rdi
jne 0x182435
leaq -0x1398(%rip), %rsi     # 0x181082
leaq -0x12ea(%rip), %rdx     # 0x181137
movl $0x120, %edi            # imm = 0x120
callq 0x162d34
movq %rax, %rdi
movq %rax, 0x33c4b3(%rip)    # 0x4be8e8
movq %r13, %rsi
callq 0x162ff7
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 0x11b1f3
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 0x11b0a1
movq %rax, %rdi
movl $0xb7, %esi
movl $0x1, %edx
xorl %ecx, %ecx
movq 0xa8(%rsp), %r14
movq %r14, %r8
callq 0x1a5580
movq %rax, 0x18(%r12)
testq %rax, %rax
je 0x182619
movq %rax, %rdi
callq 0x1a59f6
movq %rax, 0x10(%r12)
movq %rax, %rdi
callq 0xf6567
testb %al, %al
je 0x1825fb
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 0xe7bac
movq %rax, 0x58(%r12)
movq 0x10(%r12), %rdi
callq 0xe7b9c
movq %rax, 0x68(%r12)
movq 0x10(%r12), %rdi
callq 0xe7b9c
decq %rax
shrq %rax
movq %rax, 0x60(%r12)
movq %r13, %rax
jmp 0x182623
movq 0x8(%rsp), %rdi
callq 0x11b0a1
leaq 0x214225(%rip), %rsi    # 0x396831
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xfcb67
movq %r13, %rdi
callq 0x162dee
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq