// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/tools/gt_encseq2spm.c
// Function: gt_encseq2spm_runner
static int gt_encseq2spm_runner(GT_UNUSED int argc,
                                GT_UNUSED const char **argv,
                                GT_UNUSED int parsed_args,
                                void *tool_arguments,
                                GtError *err)
{
  GtEncseq2spmArguments *arguments = tool_arguments;
  GtEncseqLoader *el = NULL;
  GtEncseq *encseq = NULL;
  bool haserr = false;

  gt_error_check(err);
  gt_assert(arguments);
  el = gt_encseq_loader_new();
  gt_encseq_loader_drop_description_support(el);
  gt_encseq_loader_disable_autosupport(el);
  encseq = gt_encseq_loader_load(el, gt_str_get(arguments->encseqinput),
                                 err);
  if (encseq == NULL)
  {
    haserr = true;
  }
  if (!haserr)
  {
    if (arguments->singlestrand)
    {
      gt_error_set(err,"option -singlestand is not implemented");
      haserr = true;
    } else
    {
      if (gt_encseq_mirror(encseq, err) != 0)
      {
        haserr = true;
      }
    }
  }

  if (!haserr && arguments->singlescan > 0)
  {
    GtTimer *timer = NULL;

    if (gt_showtime_enabled())
    {
      char *outmsg;

      switch (arguments->singlescan)
      {
        case 1:
          outmsg = "to run fast scanning";
          break;
        case 2:
          outmsg = "to run fast scanning with check";
          break;
        case 3:
          outmsg = "to run fast scanning with output";
          break;
        case 4:
          outmsg = "to run old scanning code";
          break;
        default:
          gt_error_set(err,"argument %u to option -singlescan not allowed",
                       arguments->singlescan);
          haserr = true;
      }
      if (!haserr)
      {
        timer = gt_timer_new_with_progress_description(outmsg);
        gt_timer_start(timer);
      }
    }
    if (!haserr)
    {
      unsigned int kmersize = 0;
      haserr = gt_encseq2spm_kmersize(arguments, &kmersize, err);
      if (!haserr)
      {
        if (arguments->singlescan == 4U)
        {
          gt_rungetencseqkmers(encseq,kmersize);
        } else
        {
          if (arguments->singlescan > 0)
          {
            gt_firstcode_runkmerscan(encseq,arguments->singlescan - 1,kmersize,
                arguments->minmatchlength);
          }
        }
      }
    }
    if (timer != NULL)
    {
      gt_timer_show_progress_final(timer, stdout);
      gt_timer_delete(timer);
    }
  }
  if (!haserr && arguments->singlescan == 0)
  {
    GtLogger *logger;
    const GtReadmode readmode = GT_READMODE_FORWARD;
    GtBUstate_spmsk **spmsk_states = NULL;
    unsigned int kmersize, threadcount;

#ifdef GT_THREADS_ENABLED
    const unsigned int threads = gt_jobs;
#else
    const unsigned int threads = 1U;
#endif

    if (arguments->countspms || arguments->outputspms)
    {
      spmsk_states = gt_malloc(sizeof (*spmsk_states) * threads);
      for (threadcount = 0; threadcount < threads; threadcount++)
      {
        spmsk_states[threadcount]
          = gt_spmsk_inl_new(encseq,
                             readmode,
                             (GtUword) arguments->minmatchlength,
                             arguments->countspms,
                             arguments->outputspms,
                             gt_str_get(arguments->encseqinput));
      }
    }
    logger = gt_logger_new(arguments->verbose,GT_LOGGER_DEFLT_PREFIX, stdout);
    haserr = gt_encseq2spm_kmersize(arguments, &kmersize, err);
    if (!haserr)
    {
      if (storefirstcodes_getencseqkmers_twobitencoding(encseq,
                                                      kmersize,
                                                      arguments->numofparts,
                                                      arguments->maximumspace,
                                                      arguments->minmatchlength,
                                     /* use false */  arguments->checksuftab,
                                     /* use false */  arguments->onlyaccum,
                                     /* use false */  arguments->
                                                            onlyallfirstcodes,
                                     /* use 5U */     arguments->
                                                            addbscache_depth,
                                     /* specify the extra space needed for
                                        the function processing the interval */
                                                      arguments->phase2extra,
                                     /* use true */   arguments->radixlarge ?
                                                        false : true,
                                     /* use 2 without threads and
                                        use 1 with threads */
                                                      arguments->radixparts,
                                                      spmsk_states != NULL
                                                        ? gt_spmsk_inl_process
                                                        : NULL,
                                                      gt_spmsk_inl_process_end,
                                                      spmsk_states,
                                                      logger,
                                                      err) != 0)
      {
        haserr = true;
      }
    }
    if (spmsk_states != NULL)
    {
      GtUword countmatches = 0;

      for (threadcount = 0; threadcount < threads; threadcount++)
      {
        countmatches += gt_spmsk_inl_delete(spmsk_states[threadcount]);
      }
      if (arguments->countspms)
      {
        printf("number of suffix-prefix matches="GT_WU"\n",countmatches);
      }
      gt_free(spmsk_states);
    }
    gt_logger_delete(logger);
  }
  gt_encseq_delete(encseq);
  gt_encseq_loader_delete(el);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r13
movq %rcx, %r14
testq %r8, %r8
je 0xa4dc6
movq %r13, %rdi
callq 0x101a9a
testb %al, %al
jne 0xa5199
testq %r14, %r14
je 0xa5194
callq 0xf36ef
movq %rax, %r15
movq %rax, %rdi
callq 0xf6920
movq %r15, %rdi
callq 0xf69cc
movq 0x30(%r14), %rdi
callq 0x120d23
movq %r15, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0xf374b
movq %rax, %r12
xorl %ebx, %ebx
testq %rax, %rax
sete %bpl
je 0xa4e41
cmpb $0x1, 0x1(%r14)
jne 0xa4e29
leaq 0x2aec97(%rip), %rsi    # 0x353ab1
movq %r13, %rdi
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %bpl
jmp 0xa4e41
movq %r12, %rdi
movq %r13, %rsi
callq 0xf6aed
testl %eax, %eax
movb %bpl, %bl
movl $0x1, %ebp
cmovel %ebx, %ebp
testb %bpl, %bpl
jne 0xa4f44
cmpl $0x0, 0x14(%r14)
je 0xa4f44
callq 0x11ed94
testb %al, %al
je 0xa4e83
movl 0x14(%r14), %edx
leal -0x1(%rdx), %eax
cmpl $0x3, %eax
ja 0xa4ea3
leaq 0x2ae807(%rip), %rcx    # 0x353678
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2aec57(%rip), %rdi    # 0x353ad8
jmp 0xa4eb7
movq %r13, %rbx
jmp 0xa4ebf
leaq 0x2aec7e(%rip), %rdi    # 0x353b0d
jmp 0xa4eb7
leaq 0x2aec96(%rip), %rdi    # 0x353b2e
jmp 0xa4eb7
leaq 0x2aec4c(%rip), %rdi    # 0x353aed
jmp 0xa4eb7
leaq 0x2aec9d(%rip), %rsi    # 0x353b47
movq %r13, %rdi
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %bpl
movq %r13, %rbx
testb %bpl, %bpl
je 0xa4ec4
xorl %r13d, %r13d
jmp 0xa4ed4
callq 0x1226d6
movq %rax, %r13
movq %rax, %rdi
callq 0x122733
testb %bpl, %bpl
jne 0xa4f22
leaq 0x14(%rsp), %rsi
movl $0x0, (%rsi)
movq %r14, %rdi
movq %rbx, %rdx
callq 0xa519e
movl %eax, %ebp
testb %al, %al
jne 0xa4f22
movl 0x14(%r14), %esi
testl %esi, %esi
je 0xa4f22
cmpl $0x4, %esi
jne 0xa4f10
movl 0x14(%rsp), %esi
movq %r12, %rdi
callq 0x1b364f
jmp 0xa4f22
decl %esi
movl 0x14(%rsp), %edx
movl 0x8(%r14), %ecx
movq %r12, %rdi
callq 0x1b34ba
testq %r13, %r13
je 0xa4f41
movq 0x41efba(%rip), %rax    # 0x4c3ee8
movq (%rax), %rsi
movq %r13, %rdi
callq 0x122c67
movq %r13, %rdi
callq 0x122d79
movq %rbx, %r13
testb %bpl, %bpl
jne 0xa516f
cmpl $0x0, 0x14(%r14)
jne 0xa516f
movq %r15, %rbp
leaq 0x41feb6(%rip), %rax    # 0x4c4e18
movl (%rax), %r15d
cmpb $0x0, 0x7(%r14)
movq %r15, 0x20(%rsp)
movq %rbp, 0x18(%rsp)
movq %r12, 0x28(%rsp)
jne 0xa4f82
cmpb $0x1, 0x3(%r14)
jne 0xa4fff
leaq (,%r15,8), %rdi
leaq 0x2ae6f7(%rip), %rsi    # 0x353688
movl $0x198, %edx            # imm = 0x198
callq 0x1092b2
movq %rax, %rbx
testq %r15, %r15
je 0xa5001
movq %r13, 0x8(%rsp)
xorl %r15d, %r15d
movl 0x8(%r14), %ebp
movq %rbx, %r13
movzbl 0x7(%r14), %ebx
movzbl 0x3(%r14), %r12d
movq 0x30(%r14), %rdi
callq 0x120d23
movq 0x28(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
movl %ebx, %ecx
movq %r13, %rbx
movl %r12d, %r8d
movq %rax, %r9
callq 0x1b03e0
movq %rax, (%r13,%r15,8)
incq %r15
cmpq %r15, 0x20(%rsp)
jne 0xa4fab
movq 0x18(%rsp), %r15
movq 0x28(%rsp), %r12
movq 0x8(%rsp), %r13
jmp 0xa5004
xorl %ebx, %ebx
movq %rbp, %r15
movzbl 0x2(%r14), %edi
movq 0x41eed8(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x2aa8ba(%rip), %rsi    # 0x34f8d4
callq 0x108ed0
movq %rax, 0x38(%rsp)
leaq 0x34(%rsp), %rsi
movq %r14, %rdi
movq %r13, %rdx
callq 0xa519e
movl %eax, %ebp
testb %al, %al
movq %rbx, 0x8(%rsp)
jne 0xa50f7
movq %r13, %r10
movq %r12, %r13
movl 0x34(%rsp), %esi
movl 0x8(%r14), %r8d
movl 0xc(%r14), %edx
movq 0x20(%r14), %rcx
movzbl (%r14), %r9d
movzbl 0x4(%r14), %eax
movq %rax, 0x50(%rsp)
movzbl 0x5(%r14), %eax
movq %rax, 0x48(%rsp)
movl 0x18(%r14), %eax
movq %rax, 0x40(%rsp)
movq %rbx, %r15
movq 0x28(%r14), %rbx
xorl %r12d, %r12d
cmpb $0x0, 0x6(%r14)
sete %dil
movl 0x10(%r14), %eax
movq %r15, %r11
testq %r15, %r15
je 0xa50a0
leaq 0x10b482(%rip), %r11    # 0x1b0522
subq $0x8, %rsp
leaq 0x10b85c(%rip), %r15    # 0x1b0907
movb %dil, %r12b
movq %r13, %rdi
pushq %r10
pushq 0x48(%rsp)
movq 0x20(%rsp), %r10
pushq %r10
pushq %r15
pushq %r11
pushq %rax
pushq %r12
movq %r13, %r12
pushq %rbx
movq %r10, %rbx
pushq 0x88(%rsp)
pushq 0x98(%rsp)
pushq 0xa8(%rsp)
callq 0x1b3679
addq $0x60, %rsp
testl %eax, %eax
setne %al
orb %al, %bpl
movq 0x18(%rsp), %r15
testq %rbx, %rbx
je 0xa5165
cmpq $0x0, 0x20(%rsp)
je 0xa512a
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x8(%rsp), %r13
movq 0x20(%rsp), %r15
movq (%r13,%rbx,8), %rdi
callq 0x1b0466
addq %rax, %r12
incq %rbx
cmpq %rbx, %r15
jne 0xa5113
jmp 0xa512d
xorl %r12d, %r12d
cmpb $0x1, 0x7(%r14)
movq 0x18(%rsp), %r15
jne 0xa514a
leaq 0x2aea35(%rip), %rdi    # 0x353b75
movq %r12, %rsi
xorl %eax, %eax
callq 0x17070
leaq 0x2ae537(%rip), %rsi    # 0x353688
movq 0x8(%rsp), %rdi
movl $0x1d2, %edx            # imm = 0x1D2
callq 0x109670
movq 0x28(%rsp), %r12
movq 0x38(%rsp), %rdi
callq 0x10916a
movq %r12, %rdi
callq 0xee90c
movq %r15, %rdi
callq 0xf424d
movzbl %bpl, %eax
negl %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x19ed6
callq 0x19e9d