// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/tir_stream.c
// Function: gt_tir_stream_next
static int gt_tir_stream_next(GtNodeStream *ns, GT_UNUSED GtGenomeNode **gn,
                              GtError *err)
{
  GtTIRStream *tir_stream;
  int had_err = 0;
  gt_error_check(err);
  tir_stream = gt_node_stream_cast(gt_tir_stream_class(), ns);

  /* generate and check seeds */
   if (tir_stream->state == GT_TIR_STREAM_STATE_START) {
    if (!had_err && gt_enumeratemaxpairs(tir_stream->ssar,
                      (unsigned int) tir_stream->min_seed_length,
                      gt_tir_store_seeds,
                      &tir_stream->seedinfo,
                      err) != 0) {
      had_err = -1;
    }

    /* extend seeds to TIRs and check TIRs */
    if (!had_err && gt_tir_searchforTIRs(tir_stream,
                                         tir_stream->encseq, err) != 0) {
      had_err = -1;
    }

    GT_FREEARRAY(&tir_stream->seedinfo.seed, Seed);
    tir_stream->state = GT_TIR_STREAM_STATE_REGIONS;
  }

  /* stream out the region nodes */
  if (!had_err && tir_stream->state == GT_TIR_STREAM_STATE_REGIONS) {
    bool skip = false;

    /* check whether index is valid */
    if (tir_stream->cur_elem_index < tir_stream->num_of_tirs) {
      GtUword seqnum, seqlength;
      GtGenomeNode *rn;
      GtStr *seqid;
      seqnum = tir_stream->tir_pairs[tir_stream->cur_elem_index]->contignumber;

      /* if first time we do this */
      if (tir_stream->prev_seqnum == GT_UNDEF_UWORD) {
        /* use current seqnum */
        tir_stream->prev_seqnum = seqnum;
      } else {
        /* else get seqnum of next contig */
        while (tir_stream->prev_seqnum == seqnum) {
          tir_stream->cur_elem_index++;

          /* do not go on if index is out of bounds */
          if (tir_stream->cur_elem_index >= tir_stream->num_of_tirs) {
            skip = true;
            break;
          }
          seqnum =
                tir_stream->tir_pairs[tir_stream->cur_elem_index]->contignumber;
        }
      }

      /* create node */
      if (!skip) {
        tir_stream->prev_seqnum = seqnum;
        seqlength = gt_encseq_seqlength(tir_stream->encseq, seqnum);
        seqid = gt_str_new();

        if (gt_encseq_has_md5_support(tir_stream->encseq)
              && tir_stream->output_md5) {
          GtMD5Tab *md5_tab = NULL;
          md5_tab = gt_encseq_get_md5_tab(tir_stream->encseq, err);
          if (!md5_tab) {
            had_err = -1;
            gt_str_delete(seqid);
          }
          if (!had_err) {
            gt_str_append_cstr(seqid, GT_MD5_SEQID_PREFIX);
            gt_str_append_cstr(seqid, gt_md5_tab_get(md5_tab, seqnum));
            gt_str_append_char(seqid, GT_MD5_SEQID_SEPARATOR);
          }
          gt_md5_tab_delete(md5_tab);
        }

        if (!had_err) {
          if (gt_encseq_has_description_support(tir_stream->encseq)
                && tir_stream->output_seqids) {
            GtUword desclength = 0UL, i = 0UL;
            const char *desc;
            desc = gt_encseq_description(tir_stream->encseq,
                                         &desclength, seqnum);
            while (*(desc+i) != ' ' && i != desclength)
              i++;
            gt_str_append_cstr_nt(seqid, desc, i);
          } else {
            gt_str_append_cstr(seqid, "seq");
            gt_str_append_uword(seqid, seqnum);
          }
          rn = gt_region_node_new(seqid, 1, seqlength);
          gt_str_delete(seqid);
          *gn = rn;
          tir_stream->cur_elem_index++;
        }
      } else {
        /* skipping */
        tir_stream->cur_elem_index = 0;
        tir_stream->state = GT_TIR_STREAM_STATE_COMMENTS;
        *gn = NULL;
      }
    } else {
      /* no valid index */
      tir_stream->cur_elem_index = 0;
      tir_stream->state = GT_TIR_STREAM_STATE_COMMENTS;
      *gn = NULL;
    }
  }

  /* then stream out the comment nodes */
  if (!had_err && tir_stream->state == GT_TIR_STREAM_STATE_COMMENTS)
  {
    bool skip = false;
    if (tir_stream->cur_elem_index < tir_stream->num_of_tirs) {
      const char *description;
      GtUword description_len, seqnum;
      GtGenomeNode *cn;

      seqnum = tir_stream->tir_pairs[tir_stream->cur_elem_index]->contignumber;

      /* for the first time */
      if (tir_stream->prev_seqnum == GT_UNDEF_WORD) {
        /* use current seqnum */
        tir_stream->prev_seqnum = seqnum;
      } else {
        /* else get seqnum of next contig */
        while (tir_stream->prev_seqnum == seqnum) {
          tir_stream->cur_elem_index++;

          if (tir_stream->cur_elem_index >= tir_stream->num_of_tirs) {
            skip = true;
            break;
          }
          seqnum =
                tir_stream->tir_pairs[tir_stream->cur_elem_index]->contignumber;
        }
      }

      /* create a new comment node */
      if (!skip) {
        char description_string[BUFSIZ];
        tir_stream->prev_seqnum = seqnum;

        /* get description and descriptionlength of current contig */
        description = gt_encseq_description(tir_stream->encseq,
                                            &description_len, seqnum);

       (void) strncpy(description_string, description,
                      (size_t) (description_len * sizeof (char)));
        description_string[description_len] = '\0';

        /* make a new comment node */
        cn = gt_comment_node_new(description_string);

        *gn = cn;
        tir_stream->cur_elem_index++;
      } else {
        /* skipping */
        tir_stream->cur_elem_index = 0;
        tir_stream->state = GT_TIR_STREAM_STATE_FEATURES;
        *gn = NULL;
      }
    } else {
      /* no valid index */
      tir_stream->cur_elem_index = 0;
      tir_stream->state = GT_TIR_STREAM_STATE_FEATURES;
      *gn = NULL;
    }
  }

  /* finally stream out the features */
  if (!had_err && tir_stream->state == GT_TIR_STREAM_STATE_FEATURES) {
    if (tir_stream->cur_elem_index < tir_stream->num_of_tirs) {
      GtStr *seqid, *source;
      GtGenomeNode *node, GT_UNUSED *parent;
      const TIRPair *pair =
                tir_stream->tir_pairs[tir_stream->cur_elem_index];
      GtUword seqstartpos;
      char buf[BUFSIZ];

      gt_assert(!pair->skip);
      gt_assert(pair->tsd_length > 0);

      seqstartpos = gt_encseq_seqstartpos(tir_stream->encseq,
                                          pair->contignumber);
      seqid = gt_str_new();
      source = gt_str_new_cstr("TIRvish");

      if (gt_encseq_has_md5_support(tir_stream->encseq)
            && tir_stream->output_md5) {
        GtMD5Tab *md5_tab = NULL;
        md5_tab = gt_encseq_get_md5_tab(tir_stream->encseq, err);
        if (!md5_tab) {
          had_err = -1;
          gt_str_delete(seqid);
        }
        if (!had_err) {
          gt_str_append_cstr(seqid, GT_MD5_SEQID_PREFIX);
          gt_str_append_cstr(seqid, gt_md5_tab_get(md5_tab,
                                                   pair->contignumber));
          gt_str_append_char(seqid, GT_MD5_SEQID_SEPARATOR);
        }
        gt_md5_tab_delete(md5_tab);
      }

      if (!had_err && gt_encseq_has_description_support(tir_stream->encseq)
            && tir_stream->output_seqids) {
        GtUword desclength = 0UL, i = 0UL;
        const char *desc;
        desc = gt_encseq_description(tir_stream->encseq,
                                     &desclength, pair->contignumber);
        while (*(desc+i) != ' ' && i != desclength)
          i++;
        gt_str_append_cstr_nt(seqid, desc, i);
      } else {
        gt_str_append_cstr(seqid, "seq");
        gt_str_append_uword(seqid, pair->contignumber);
      }

      /* repeat region */
      node = gt_feature_node_new(seqid, gt_ft_repeat_region,
                                 pair->left_tir_start - seqstartpos -
                                   pair->tsd_length + 1,
                                 pair->right_transformed_end - seqstartpos
                                   + pair->tsd_length + 1,
                                 GT_STRAND_UNKNOWN);
      gt_feature_node_set_source((GtFeatureNode*) node, source);
      *gn = node;
      parent = node;

      /* target site duplication */

      if (tir_stream->min_TSD_length > 1U) {
        node = gt_feature_node_new(seqid,
                       gt_ft_target_site_duplication,
                       pair->left_tir_start - seqstartpos + 1
                         - pair->tsd_length,
                       pair->left_tir_start - seqstartpos,
                       GT_STRAND_UNKNOWN);
        gt_feature_node_set_source((GtFeatureNode*) node, source);
        gt_feature_node_add_child((GtFeatureNode*) parent,
                      (GtFeatureNode*) node);

        node = gt_feature_node_new(seqid,
                       gt_ft_target_site_duplication,
                       pair->right_transformed_end - seqstartpos + 2,
                       pair->right_transformed_end - seqstartpos + 1
                       + pair->tsd_length,
                       GT_STRAND_UNKNOWN);
        gt_feature_node_set_source((GtFeatureNode*) node, source);
        gt_feature_node_add_child((GtFeatureNode*) parent,
                      (GtFeatureNode*) node);
      }

      /* terminal inverted repeat element */

      node = gt_feature_node_new(seqid, gt_ft_terminal_inverted_repeat_element,
                                 pair->left_tir_start - seqstartpos + 1,
                                 pair->right_transformed_end - seqstartpos +1,
                                 GT_STRAND_UNKNOWN);
      gt_feature_node_set_source((GtFeatureNode*) node, source);
      gt_feature_node_add_child((GtFeatureNode*) parent, (GtFeatureNode*)node);
      (void) snprintf(buf, BUFSIZ-1, "%.2f", pair->similarity);
      gt_feature_node_set_attribute((GtFeatureNode*) node,
                                    "tir_similarity",
                                    buf);
      parent = node;

      /* left terminal inverted repeat */

      node = gt_feature_node_new(seqid, gt_ft_terminal_inverted_repeat,
                                 pair->left_tir_start - seqstartpos + 1,
                                 pair->left_tir_end - seqstartpos + 1,
                                 GT_STRAND_UNKNOWN);
      gt_feature_node_set_source((GtFeatureNode*)node, source);
      gt_feature_node_add_child((GtFeatureNode*)parent, (GtFeatureNode*)node);

      /* right terminal inverted repeat */

      node = gt_feature_node_new(seqid, gt_ft_terminal_inverted_repeat,
                                pair->right_transformed_start - seqstartpos + 1,
                                pair->right_transformed_end - seqstartpos + 1,
                                GT_STRAND_UNKNOWN);
      gt_feature_node_set_source((GtFeatureNode*)node, source);
      gt_feature_node_add_child((GtFeatureNode*)parent, (GtFeatureNode*)node);

      /* clean up and get next pair */
      gt_str_delete(seqid);
      gt_str_delete(source);
      tir_stream->cur_elem_index++;
    } else {
      *gn = NULL;
    }
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20d8, %rsp           # imm = 0x20D8
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
testq %rdx, %rdx
je 0x189828
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x18aa8f
cmpq $0x0, 0x3400b8(%rip)    # 0x4c98e8
jne 0x189851
leaq -0xf7(%rip), %rsi       # 0x189742
leaq -0x47(%rip), %rdx       # 0x1897f9
movl $0x120, %edi            # imm = 0x120
callq 0x16abb4
movq %rax, 0x340097(%rip)    # 0x4c98e8
movq 0x340090(%rip), %rdi    # 0x4c98e8
movq %rbx, %rsi
callq 0x16ae64
movq %rax, %rbx
cmpl $0x0, 0x90(%rax)
movq %rax, 0x8(%rsp)
movq %r14, 0x48(%rsp)
je 0x189902
movb $0x1, %r15b
cmpl $0x1, 0x90(%rbx)
jne 0x18a59b
movq 0x98(%rbx), %rax
movq 0xa0(%rbx), %rsi
cmpq %rax, %rsi
jae 0x18a320
movq 0x70(%rbx), %rcx
movq 0xa8(%rbx), %rdx
movq (%rcx,%rsi,8), %rsi
movq (%rsi), %r14
cmpq $-0x1, %rdx
je 0x18a313
cmpq %r14, %rdx
jne 0x18a31a
movq 0xa0(%rbx), %rsi
incq %rsi
movq %rsi, %rdi
cmpq %rsi, %rax
cmovaq %rax, %rdi
jbe 0x1898f4
movq (%rcx,%rsi,8), %r8
movq (%r8), %r14
cmpq %r14, %rdx
jne 0x18a4c4
incq %rsi
cmpq %rax, %rsi
jb 0x1898dc
movq %rdi, 0xa0(%rbx)
movb $0x1, %al
jmp 0x18a31c
movq 0x18(%rbx), %rdi
movl 0xb8(%rbx), %esi
leaq 0x20(%rbx), %r15
leaq 0x148f(%rip), %rdx      # 0x18ada6
movq %r15, %rcx
movq %r14, %r8
callq 0x1ab866
movl %eax, %ebp
testl %eax, %eax
jne 0x18a480
movl %ebp, 0x44(%rsp)
movq %r15, 0x68(%rsp)
movq %r12, 0x30(%rsp)
movq 0x10(%rbx), %r15
callq 0x1ec02a
movq %rax, 0x20(%rsp)
callq 0x1ec02a
movq %rax, 0x38(%rsp)
movl $0x64, %edi
callq 0x1ba644
movq %rax, 0x58(%rsp)
testq %r14, %r14
je 0x189976
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x18aaa8
movq %rbx, %rdi
addq $0xe0, %rdi
callq 0x20cd7d
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x30(%rbx)
je 0x18a0fa
xorl %r14d, %r14d
movq %r15, (%rsp)
movq %r15, %rdi
callq 0xec1d8
movq %rax, %r12
movq %r14, 0x18(%rsp)
leaq (%r14,%r14,4), %rax
movq 0x20(%rbx), %rcx
movq 0x38(%rbx), %rbp
movq 0x18(%rcx,%rax,8), %r13
cmpq %r13, %rbp
jb 0x18aa6c
leaq (%rcx,%rax,8), %r15
movq 0x10(%rbx), %rdi
movq 0x20(%r15), %rsi
callq 0xefce0
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq 0x20(%r15), %rsi
callq 0xeffd3
movq %r14, %rsi
movq %rax, %r14
addq %rsi, %r14
decq %r12
movq %rbp, %rbx
subq %r13, %rbx
je 0x189aa7
movq (%r15), %r9
movq %r9, %rax
subq %rsi, %rax
jbe 0x189aa7
movq %r12, %rdx
subq %r14, %rdx
movq 0x8(%r15), %rcx
subq %rdx, %rcx
jbe 0x189aa7
cmpq %rcx, %rax
movq %rcx, %rdx
cmovbq %rax, %rdx
cmpq %rcx, %rbx
movq %rbx, %r8
cmovaq %rdx, %r8
cmpq %rax, %rbx
cmovaq %rdx, %r8
movq %r8, 0x28(%rsp)
subq %r8, %r9
xorl %edi, %edi
movq %rsi, 0x10(%rsp)
xorl %esi, %esi
movq 0x20(%rsp), %rdx
movq (%rsp), %rcx
callq 0x1ec1ee
movq 0x8(%r15), %r9
movq 0x28(%rsp), %r8
subq %r8, %r9
xorl %edi, %edi
xorl %esi, %esi
movq 0x38(%rsp), %rdx
movq (%rsp), %rcx
callq 0x1ec1ee
movq 0x8(%rsp), %rax
movslq 0xf0(%rax), %r9
xorl %edi, %edi
leaq 0x70(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0x20cec8
movq 0x10(%rsp), %rsi
jmp 0x189abd
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
cmpq %r13, %rbp
je 0x189b72
movq 0x18(%r15), %rax
movq (%r15), %r9
addq %rax, %r9
subq %r9, %r14
jbe 0x189b72
movq %r12, %rcx
subq %rsi, %rcx
addq 0x8(%r15), %rax
subq %rax, %rcx
jbe 0x189b72
cmpq %rcx, %r14
movq %rcx, %rax
cmovbq %r14, %rax
cmpq %rcx, %rbx
movq %rbx, %r13
cmovaq %rax, %r13
cmpq %r14, %rbx
cmovaq %rax, %r13
movl $0x1, %edi
xorl %esi, %esi
movq 0x20(%rsp), %r14
movq %r14, %rdx
movq (%rsp), %rbx
movq %rbx, %rcx
movq %r13, %r8
callq 0x1ec1ee
movq 0x18(%r15), %r9
addq 0x8(%r15), %r9
movl $0x1, %edi
xorl %esi, %esi
movq 0x38(%rsp), %rbp
movq %rbp, %rdx
movq %rbx, %rcx
movq %r13, %r8
callq 0x1ec1ee
movq 0x8(%rsp), %rbx
movslq 0xf0(%rbx), %r9
movl $0x1, %edi
leaq 0xa0(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r14, %rcx
movq %rbp, %r8
callq 0x20cec8
jmp 0x189b90
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movq 0x8(%rsp), %rbx
movq 0x18(%r15), %rax
addq 0xa0(%rsp), %rax
movq 0x78(%rsp), %rcx
addq %rcx, %rax
addq $-0x2, %rax
cmpq 0xc0(%rbx), %rax
jb 0x18a0e4
cmpq 0xc8(%rbx), %rax
ja 0x18a0e4
movq 0x80(%rbx), %rax
cmpq %rax, 0x88(%rbx)
jb 0x189c00
addq $0x100, %rax            # imm = 0x100
movq %rax, 0x80(%rbx)
movq 0x78(%rbx), %rdi
shlq $0x4, %rax
leaq (%rax,%rax,4), %rsi
leaq 0x216148(%rip), %rdx    # 0x39fd3a
movl $0x244, %ecx            # imm = 0x244
callq 0x1094e6
movq %rax, 0x78(%rbx)
movq 0x78(%rbx), %r14
testq %r14, %r14
je 0x18aa8a
movq 0x88(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x88(%rbx)
leaq (%rax,%rax,4), %r13
shlq $0x4, %r13
movq %rbx, %rsi
movq 0x20(%r15), %rbx
movq %rbx, (%r14,%r13)
xorl %edi, %edi
movq %rdi, 0x38(%r14,%r13)
movq (%r15), %rax
movq %rax, %rcx
subq 0x70(%rsp), %rcx
movq %rcx, 0x8(%r14,%r13)
movq 0x18(%r15), %rcx
addq %rcx, %rax
decq %rax
addq 0xa0(%rsp), %rax
movq %rax, 0x10(%r14,%r13)
movq 0x8(%r15), %rax
movq %rax, %rdx
subq 0x78(%rsp), %rdx
addq %rcx, %rax
decq %rax
movq %rdx, 0x18(%r14,%r13)
addq 0xa8(%rsp), %rax
movq %rax, 0x20(%r14,%r13)
movq %r12, %rcx
subq %rax, %rcx
movq %rcx, 0x40(%r14,%r13)
subq %rdx, %r12
movq %r12, 0x48(%r14,%r13)
movq %rdi, 0x28(%r14,%r13)
movb $0x0, 0x30(%r14,%r13)
incq 0x98(%rsi)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x189cc0
callq 0x101a9a
testb %al, %al
jne 0x18aa99
addq %r13, %r14
movq (%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xefce0
movq %rax, %rbp
movq %r15, %rdi
movq %rbx, %rsi
callq 0xeffd3
movq 0x8(%r14), %r12
movq %r12, %rdx
subq %rbp, %rdx
jb 0x18aa85
movq 0x10(%r14), %rcx
cmpq %rcx, %r12
movq 0x8(%rsp), %rbx
ja 0x18aa80
movq 0x18(%r14), %rsi
cmpq 0x20(%r14), %rsi
ja 0x18aa7b
movq 0x118(%rbx), %rsi
movq %r12, %rdi
subq %rsi, %rdi
cmpq %rsi, %rdx
cmovbq %rbp, %rdi
addq %rsi, %r12
cmpq %rcx, %r12
cmovaeq %rcx, %r12
movq 0x40(%r14), %rcx
movq 0x48(%r14), %r13
movq %r13, %r15
subq %rsi, %r15
cmpq %r15, %rcx
cmovaq %rcx, %r15
addq %rbp, %rax
decq %rax
addq %rsi, %r13
cmpq %rax, %r13
cmovaeq %rax, %r13
cmpq $0x2, 0x108(%rbx)
jb 0x189fd8
movq %r12, %rbp
subq %rdi, %rbp
incq %rbp
movq %r13, %rbx
subq %r15, %rbx
incq %rbx
movl $0x1, %esi
movq %rdi, 0x10(%rsp)
movq %rbp, %rdi
leaq 0x215fb3(%rip), %rdx    # 0x39fd3a
movl $0x1a1, %ecx            # imm = 0x1A1
callq 0x1093ef
movq %rax, 0x28(%rsp)
movl $0x1, %esi
movq %rbx, %rdi
leaq 0x215f95(%rip), %rdx    # 0x39fd3a
movl $0x1a2, %ecx            # imm = 0x1A2
callq 0x1093ef
movq %rax, 0x60(%rsp)
movq (%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
callq 0xed6e0
movq (%rsp), %rdi
movq %rdi, %r12
movq 0x60(%rsp), %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0xed6e0
movq 0x10(%rsp), %rcx
leaq 0xe0(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
cmpq %r15, %rcx
jae 0x18aa9e
movq %rcx, 0xd0(%rsp)
movq %r15, 0xd8(%rsp)
movq %r12, 0xf8(%rsp)
movq 0x8(%rsp), %rax
movl 0x108(%rax), %r15d
movq %r12, %rdi
callq 0xf02da
movq 0x28(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq 0x60(%rsp), %rbp
movq %rbp, %rdx
movq %rbx, %rcx
movl %r15d, %r8d
movq %rax, %r9
pushq 0x48(%rsp)
pushq $0x0
leaq 0xe0(%rsp), %rax
pushq %rax
leaq 0x10c0(%rip), %rax      # 0x18af25
pushq %rax
callq 0x1acb78
addq $0x20, %rsp
movl %eax, %ebx
movq %r13, %rdi
leaq 0x215ebf(%rip), %r15    # 0x39fd3a
movq %r15, %rsi
movl $0x1bb, %edx            # imm = 0x1BB
callq 0x109670
movq %rbp, %rdi
movq %r15, %rsi
movl $0x1bc, %edx            # imm = 0x1BC
callq 0x109670
testl %ebx, %ebx
movq 0x8(%rsp), %rbx
jne 0x189fa2
movq 0x8(%r14), %rdx
movq 0x20(%r14), %rax
movq 0xf0(%rsp), %r10
testq %r10, %r10
movq %r10, 0x10(%rsp)
je 0x189f52
movq 0xe0(%rsp), %rsi
movq 0x108(%rbx), %rdi
addq $0x18, %rsi
movq $-0x1, %r11
movq %rdx, %r9
xorl %r8d, %r8d
movq (%rsi), %rbx
cmpq %rdi, %rbx
jb 0x189f47
movq 0x8(%rsp), %rcx
cmpq 0x110(%rcx), %rbx
jae 0x189f47
movq -0x18(%rsi), %r15
movq 0x48(%r14), %rcx
movq -0x8(%rsi), %r12
addq %r15, %r12
movq %rcx, %rbp
subq %r12, %rbp
negq %rbp
subq %r12, %rcx
leaq -0x1(%r15,%rbx), %r13
cmovbq %rbp, %rcx
movq %r13, %rbp
subq %rdx, %rbp
negq %rbp
subq %rdx, %r13
cmovbq %rbp, %r13
addq %rcx, %r13
cmpq %r11, %r13
jae 0x189f47
addq %rbx, %r15
decq %r12
movq %r12, %rax
movq %r13, %r11
movq %rbx, %r8
movq %r15, %r9
addq $0x28, %rsi
decq %r10
jne 0x189ee3
jmp 0x189f58
xorl %r8d, %r8d
movq %rdx, %r9
cmpq $0x0, 0x10(%rsp)
je 0x189f6e
movq %r9, 0x8(%r14)
movq %rax, 0x48(%r14)
movq %r8, 0x38(%r14)
jmp 0x189f73
movb $0x1, 0x30(%r14)
movq 0x8(%rsp), %rbx
movq 0x48(%r14), %rax
cmpq 0x40(%r14), %rax
ja 0x189f87
movb $0x1, 0x30(%r14)
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rax
ja 0x189f96
movb $0x1, 0x30(%r14)
cmpq $0x0, 0x38(%r14)
jne 0x189fa2
movb $0x1, 0x30(%r14)
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x189fd8
leaq 0x215d84(%rip), %rsi    # 0x39fd3a
movl $0x1c2, %edx            # imm = 0x1C2
callq 0x109670
leaq 0xe0(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
cmpb $0x0, 0x30(%r14)
jne 0x189ff8
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rax
jbe 0x189ff3
movq 0x20(%r14), %rax
cmpq 0x18(%r14), %rax
ja 0x189ff8
movb $0x1, 0x30(%r14)
cmpb $0x0, 0x30(%r14)
jne 0x18a0e4
movq 0x8(%r14), %r9
movq 0x10(%r14), %rbx
subq %r9, %rbx
movq 0x20(%r14), %r15
subq 0x18(%r14), %r15
movl $0x1, %edi
xorl %esi, %esi
movq 0x20(%rsp), %r12
movq %r12, %rdx
movq (%rsp), %rbp
movq %rbp, %rcx
movq %rbx, %r8
callq 0x1ec1ee
movq 0x18(%r14), %r9
movl $0x1, %edi
xorl %esi, %esi
movq 0x38(%rsp), %r13
movq %r13, %rdx
movq %rbp, %rcx
movq %r15, %r8
callq 0x1ec1ee
movq 0x58(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1ba6cc
movq %rax, %xmm0
movq 0x1c6871(%rip), %xmm2   # 0x3508e0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1c6875(%rip), %xmm3   # 0x3508f0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
cmpq %r15, %rbx
cmovaq %rbx, %r15
movq 0x8(%rsp), %rbx
movq %r15, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd %xmm2, %xmm1
movsd 0x1c516c(%rip), %xmm0   # 0x34f228
subsd %xmm1, %xmm0
mulsd 0x1c8728(%rip), %xmm0   # 0x3527f0
movsd %xmm0, 0x28(%r14)
movsd 0xf8(%rbx), %xmm1
callq 0x10ad54
testb %al, %al
je 0x18a0e4
movb $0x1, 0x30(%r14)
movq 0x18(%rsp), %r14
incq %r14
cmpq 0x30(%rbx), %r14
movq (%rsp), %r15
jb 0x18999c
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x18a11b
movq 0x88(%rbx), %rsi
leaq 0xddf(%rip), %rcx       # 0x18aef0
movl $0x50, %edx
callq 0x17f60
cmpb $0x0, 0x101(%rbx)
jne 0x18a13a
cmpb $0x0, 0x100(%rbx)
jne 0x18a13a
cmpb $0x1, 0x102(%rbx)
jne 0x18a2c2
movq 0x78(%rbx), %rbp
testq %rbp, %rbp
je 0x18a2c2
cmpq $0x2, 0x88(%rbx)
jb 0x18a2c2
movb 0x100(%rbx), %sil
movb 0x102(%rbx), %al
movb %al, 0x28(%rsp)
movq 0x8(%rbp), %r14
movq 0x48(%rbp), %rax
movl $0x1, %r15d
movl $0x50, %r12d
movq %rbp, %r8
movq %rbp, %rdi
movb %sil, 0x10(%rsp)
movq 0x78(%rbx), %rcx
cmpb $0x0, 0x30(%rcx,%r12)
je 0x18a199
movq %rax, %r13
movq %rbp, %rbx
jmp 0x18a1c5
testq %rcx, %rcx
je 0x18aa94
leaq (%rcx,%r12), %rbx
movq 0x48(%rcx,%r12), %r13
cmpq %r13, %r14
ja 0x18a1ba
movq 0x8(%rcx,%r12), %rdx
cmpq %rdx, %rax
jae 0x18a1e5
movq 0x8(%rcx,%r12), %r14
movq %rbx, %rdi
movq %rbx, %r8
incq %r15
addq $0x50, %r12
movq %rbx, %rbp
movq %r13, %rax
movq 0x8(%rsp), %rbx
cmpq 0x88(%rbx), %r15
jb 0x18a185
jmp 0x18a2c2
cmpq %rdx, %r14
ja 0x18aaa3
cmpq %rax, %r13
cmovbeq %rax, %r13
testb %sil, %sil
je 0x18a204
movb $0x1, %al
movb %al, 0x30(%rdi)
movb %al, 0x30(%rbx)
jmp 0x18a194
movq %rdi, (%rsp)
cmpb $0x0, 0x28(%rsp)
movq %r8, 0x18(%rsp)
je 0x18a275
movq 0x20(%rbp), %rax
subq 0x8(%rbp), %rax
movq %rax, %xmm1
movq 0x1c66b7(%rip), %xmm3   # 0x3508e0
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x1c66bb(%rip), %xmm4   # 0x3508f0
subpd %xmm4, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x20(%rcx,%r12), %rax
subq %rdx, %rax
movq %rax, %xmm2
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
subpd %xmm4, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
callq 0x10ad54
testb %al, %al
je 0x18a2a8
movb $0x1, 0x30(%rbp)
jmp 0x18a2af
movsd 0x28(%r8), %xmm0
movsd 0x28(%rcx,%r12), %xmm1
callq 0x10ad54
testb %al, %al
je 0x18a2a8
movq 0x18(%rsp), %rax
movb $0x1, 0x30(%rax)
movq %rbx, %r8
movq %rbp, %rbx
movb 0x10(%rsp), %sil
movq (%rsp), %rdi
jmp 0x18a1c5
movb $0x1, 0x30(%rbx)
movq %rbp, %rbx
movb 0x10(%rsp), %sil
movq (%rsp), %rdi
movq 0x18(%rsp), %r8
jmp 0x18a1c5
movq 0x88(%rbx), %rcx
testq %rcx, %rcx
movq 0x68(%rsp), %r15
jle 0x18a3ce
movq 0x78(%rbx), %rax
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
addq %rax, %rcx
xorl %ebx, %ebx
movq 0x30(%rsp), %r12
movl 0x44(%rsp), %ebp
testq %rax, %rax
je 0x18aa71
movzbl 0x30(%rax), %edx
xorq $0x1, %rdx
addq %rdx, %rbx
addq $0x50, %rax
cmpq %rcx, %rax
jb 0x18a2f1
jmp 0x18a3d9
movq %r14, 0xa8(%rbx)
xorl %eax, %eax
testb %al, %al
je 0x18a33c
xorl %eax, %eax
movq %rax, 0xa0(%rbx)
movl $0x2, 0x90(%rbx)
movq %rax, (%r12)
jmp 0x18a59b
movq %r12, 0x30(%rsp)
movq %r14, 0xa8(%rbx)
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0xeffd3
movq %rax, %r13
callq 0x1208f8
movq %rax, %r12
movq 0x10(%rbx), %rdi
callq 0xf0ec3
testb %al, %al
je 0x18a4ee
cmpb $0x1, 0x104(%rbx)
jne 0x18a4ee
movq 0x10(%rbx), %rdi
movq 0x48(%rsp), %rsi
callq 0xf0e92
movq %rax, %rbx
testq %rax, %rax
je 0x18a4d0
leaq 0x1eb0ab(%rip), %rsi    # 0x375449
movq %r12, %rdi
callq 0x12097f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10c0bb
movq %r12, %rdi
movq %rax, %rsi
callq 0x12097f
movq %r12, %rdi
movl $0x3a, %esi
callq 0x120ba5
jmp 0x18a4d8
xorl %ebx, %ebx
movq 0x30(%rsp), %r12
movl 0x44(%rsp), %ebp
testq %rbx, %rbx
je 0x18a443
leaq (,%rbx,8), %rdi
leaq 0x21594d(%rip), %rsi    # 0x39fd3a
movl $0x125, %edx            # imm = 0x125
callq 0x1092b2
movq 0x8(%rsp), %rcx
movq 0x88(%rcx), %rsi
testq %rsi, %rsi
jle 0x18a445
movq 0x78(%rcx), %rcx
xorl %edx, %edx
leaq (%rsi,%rsi,4), %rsi
shlq $0x4, %rsi
testq %rcx, %rcx
je 0x18aa76
cmpb $0x0, 0x30(%rcx)
jne 0x18a42c
movq %rcx, (%rax,%rdx,8)
incq %rdx
addq $0x50, %rcx
movq 0x8(%rsp), %rdi
movq 0x78(%rdi), %rdi
addq %rsi, %rdi
cmpq %rdi, %rcx
jb 0x18a416
jmp 0x18a445
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movq %rbx, 0x98(%rcx)
movq %rcx, %rbx
movq %rax, 0x70(%rcx)
movq 0x50(%rsp), %rdi
callq 0x20ce46
movq 0x20(%rsp), %rdi
callq 0x1ec2af
movq 0x38(%rsp), %rdi
callq 0x1ec2af
movq 0x58(%rsp), %rdi
callq 0x1ba690
movq (%r15), %rdi
testq %rdi, %rdi
je 0x18a4aa
leaq 0x2158ab(%rip), %rsi    # 0x39fd3a
movl $0x2a6, %edx            # imm = 0x2A6
callq 0x109670
xorpd %xmm0, %xmm0
movupd %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movl $0x1, 0x90(%rbx)
testl %ebp, %ebp
je 0x18987a
xorl %r15d, %r15d
jmp 0x18a59b
movq %rsi, 0xa0(%rbx)
jmp 0x18a31a
movq %r12, %rdi
callq 0x121b03
movq %rbx, %rdi
callq 0x10c013
testq %rbx, %rbx
movq 0x8(%rsp), %rbx
je 0x18a62a
movq 0x10(%rbx), %rdi
callq 0xf0b65
testb %al, %al
je 0x18a551
cmpb $0x1, 0x103(%rbx)
jne 0x18a551
xorl %ebp, %ebp
movq %rbx, %rax
leaq 0xd0(%rsp), %rbx
movq %rbp, (%rbx)
movq 0x10(%rax), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xf079f
subq (%rbx), %rbp
movq $-0x1, %rcx
leaq 0x1(%rcx), %rdx
cmpb $0x20, 0x1(%rax,%rcx)
je 0x18a544
addq %rbp, %rcx
cmpq $-0x1, %rcx
movq %rdx, %rcx
jne 0x18a52d
movq %r12, %rdi
movq %rax, %rsi
callq 0x120a9d
jmp 0x18a56b
leaq 0x1d1bca(%rip), %rsi    # 0x35c122
movq %r12, %rdi
callq 0x12097f
movq %r12, %rdi
movq %r14, %rsi
callq 0x120af4
movl $0x1, %esi
movq %r12, %rdi
movq %r13, %rdx
callq 0x176bac
movq %rax, %rbx
movq %r12, %rdi
callq 0x121b03
movq 0x30(%rsp), %r12
movq %rbx, (%r12)
movq 0x8(%rsp), %rbx
incq 0xa0(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r15b, %r15b
je 0x18aa58
cmpl $0x2, 0x90(%rbx)
jne 0x18a6ae
movq 0xa0(%rbx), %rdx
cmpq 0x98(%rbx), %rdx
jae 0x18a644
movq 0x70(%rbx), %rax
movq 0xa8(%rbx), %rcx
movq (%rax,%rdx,8), %rdx
movq (%rdx), %rdx
movq %rcx, %rsi
negq %rsi
jno 0x18a5e9
movq %rdx, 0xa8(%rbx)
jmp 0x18a63e
cmpq %rdx, %rcx
jne 0x18a63e
movq 0x98(%rbx), %rdi
movq 0xa0(%rbx), %rsi
incq %rsi
movq %rsi, %r8
cmpq %rsi, %rdi
cmovaq %rdi, %r8
jbe 0x18a61f
movq (%rax,%rsi,8), %rdx
movq (%rdx), %rdx
cmpq %rdx, %rcx
jne 0x18a637
incq %rsi
cmpq %rdi, %rsi
jb 0x18a60b
movq %r8, 0xa0(%rbx)
movb $0x1, %al
jmp 0x18a640
xorl %r15d, %r15d
movq 0x30(%rsp), %r12
jmp 0x18a59b
movq %rsi, 0xa0(%rbx)
xorl %eax, %eax
testb %al, %al
je 0x18a65d
xorl %eax, %eax
movq %rax, 0xa0(%rbx)
movl $0x3, 0x90(%rbx)
movq %rax, (%r12)
jmp 0x18a6ae
movq %rdx, 0xa8(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x70(%rsp), %rbx
movq %rbx, %rsi
callq 0xf079f
movq (%rbx), %rbx
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x17370
movb $0x0, 0xd0(%rsp,%rbx)
movq 0x8(%rsp), %rbx
movq %r14, %rdi
callq 0x306964
movq %rax, (%r12)
incq 0xa0(%rbx)
testb %r15b, %r15b
je 0x18aa58
xorl %ebp, %ebp
cmpl $0x3, 0x90(%rbx)
jne 0x18aa58
movq 0xa0(%rbx), %rax
cmpq 0x98(%rbx), %rax
jae 0x18a818
movq 0x70(%rbx), %rcx
movq (%rcx,%rax,8), %r14
cmpb $0x1, 0x30(%r14)
je 0x18aaad
cmpq $0x0, 0x38(%r14)
je 0x18aab2
movq 0x10(%rbx), %rdi
movq (%r14), %rsi
callq 0xefce0
movq %rax, 0x20(%rsp)
callq 0x1208f8
movq %rax, %r15
leaq 0x1dc5f1(%rip), %rdi    # 0x366d09
callq 0x120955
movq %rax, %r13
movq 0x10(%rbx), %rdi
callq 0xf0ec3
xorl %ebp, %ebp
testb %al, %al
je 0x18a7a1
cmpb $0x1, 0x104(%rbx)
jne 0x18a7a1
movq 0x10(%rbx), %rdi
movq 0x48(%rsp), %rsi
callq 0xf0e92
movq %rax, %rbx
xorl %ebp, %ebp
testq %rax, %rax
jne 0x18a75d
movq %r15, %rdi
callq 0x121b03
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x18a794
leaq 0x1eace0(%rip), %rsi    # 0x375449
movq %r15, %rdi
callq 0x12097f
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x10c0bb
movq %r15, %rdi
movq %rax, %rsi
callq 0x12097f
movq %r15, %rdi
movl $0x3a, %esi
callq 0x120ba5
movq %rbx, %rdi
callq 0x10c013
movq 0x8(%rsp), %rbx
movq %r13, (%rsp)
testl %ebp, %ebp
jne 0x18a825
movq 0x10(%rbx), %rdi
callq 0xf0b65
testb %al, %al
je 0x18a825
cmpb $0x1, 0x103(%rbx)
jne 0x18a825
movq %r15, %r13
xorl %r15d, %r15d
movq %rbx, %rax
leaq 0xd0(%rsp), %rbx
movq %r15, (%rbx)
movq 0x10(%rax), %rdi
movq (%r14), %rdx
movq %rbx, %rsi
callq 0xf079f
subq (%rbx), %r15
movq $-0x1, %rcx
leaq 0x1(%rcx), %rdx
cmpb $0x20, 0x1(%rax,%rcx)
je 0x18a803
addq %r15, %rcx
cmpq $-0x1, %rcx
movq %rdx, %rcx
jne 0x18a7ec
movq %r13, %r15
movq %r13, %rdi
movq %rax, %rsi
callq 0x120a9d
movq 0x8(%rsp), %rbx
jmp 0x18a83f
movq $0x0, (%r12)
jmp 0x18aa58
leaq 0x1d18f6(%rip), %rsi    # 0x35c122
movq %r15, %rdi
callq 0x12097f
movq (%r14), %rsi
movq %r15, %rdi
callq 0x120af4
movq %r15, 0x18(%rsp)
movq 0x8(%r14), %rax
movq 0x38(%r14), %rcx
movq 0x20(%rsp), %r13
leaq (%rcx,%r13), %rdx
negq %rdx
addq %rax, %rdx
incq %rdx
movq 0x48(%r14), %rax
subq %r13, %rcx
addq %rax, %rcx
incq %rcx
leaq 0x2155a3(%rip), %rsi    # 0x39fe15
movq %r15, %rdi
movl $0x3, %r8d
callq 0x14952c
movq %rax, %r15
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x1491f1
movq %r15, (%r12)
cmpq $0x2, 0x108(%rbx)
jb 0x18a930
movq 0x8(%r14), %rcx
subq %r13, %rcx
movq %rcx, %rdx
subq 0x38(%r14), %rdx
incq %rdx
leaq 0x21556a(%rip), %rsi    # 0x39fe23
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl $0x3, %r8d
callq 0x14952c
movq %rax, %r12
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x1491f1
movq %r15, %rdi
movq %r12, %rsi
movq 0x20(%rsp), %r13
callq 0x149997
movq 0x38(%r14), %rax
movq 0x48(%r14), %rdx
subq %r13, %rdx
leaq (%rdx,%rax), %rcx
incq %rcx
addq $0x2, %rdx
movq %rbx, %rdi
leaq 0x215518(%rip), %rsi    # 0x39fe23
movl $0x3, %r8d
callq 0x14952c
movq %rax, %rbx
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x1491f1
movq %r15, %rdi
movq %rbx, %rsi
callq 0x149997
movq 0x8(%r14), %rdx
movq 0x48(%r14), %rcx
subq %r13, %rdx
incq %rdx
subq %r13, %rcx
incq %rcx
leaq 0x1dc39d(%rip), %rsi    # 0x366ce8
movq 0x18(%rsp), %rdi
movl $0x3, %r8d
callq 0x14952c
movq %rax, %r12
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x1491f1
movq %r15, %rdi
movq %r12, %rsi
callq 0x149997
movsd 0x28(%r14), %xmm0
leaq 0x1f5ccf(%rip), %rdx    # 0x380651
leaq 0xd0(%rsp), %rbx
movl $0x1fff, %esi           # imm = 0x1FFF
movq %rbx, %rdi
movb $0x1, %al
callq 0x17c60
leaq 0x21549b(%rip), %rsi    # 0x39fe3b
movq %r12, %rdi
movq %rbx, %rdx
callq 0x149c3c
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rcx
subq %r13, %rdx
incq %rdx
subq %r13, %rcx
incq %rcx
leaq 0x215484(%rip), %rsi    # 0x39fe4a
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl $0x3, %r8d
callq 0x14952c
movq %rax, %r15
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x1491f1
movq %r12, %rdi
movq %r15, %rsi
callq 0x149997
movq 0x40(%r14), %rdx
movq 0x48(%r14), %rcx
subq %r13, %rdx
incq %rdx
subq %r13, %rcx
incq %rcx
movq %rbx, %r14
movq %rbx, %rdi
leaq 0x215436(%rip), %rsi    # 0x39fe4a
movl $0x3, %r8d
callq 0x14952c
movq %rax, %rbx
movq %rax, %rdi
movq (%rsp), %r15
movq %r15, %rsi
callq 0x1491f1
movq %r12, %rdi
movq %rbx, %rsi
callq 0x149997
movq %r14, %rdi
callq 0x121b03
movq %r15, %rdi
callq 0x121b03
movq 0x8(%rsp), %rax
incq 0xa0(%rax)
movl %ebp, %eax
addq $0x20d8, %rsp           # imm = 0x20D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x594a9
callq 0x595ff
callq 0x59554
callq 0x593c5
callq 0x593fe
callq 0x59437
callq 0x59470
callq 0x592e1
callq 0x5951b
callq 0x59353
callq 0x5938c
callq 0x594e2
callq 0x5931a
callq 0x595c6
callq 0x5958d