// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/tools/gt_matstat.c
// Function: gt_matstat_runner
static int gt_matstat_runner(GT_UNUSED int argc, GT_UNUSED const char **argv,
                             GT_UNUSED int parsed_args,
                             void *tool_arguments, GtError *err)
{
  Gfmsubcallinfo *arguments = tool_arguments;
  Fmindex fmindex;
  Suffixarray suffixarray;
  void *packedindex = NULL;
  GtLogger *logger = NULL;
  bool haserr = false;
  const GtAlphabet *alphabet = NULL;
#ifdef WITHBCKTAB
  unsigned int prefixlength = 0;
#endif
  GtUword totallength;
  bool gt_mapfmindexfail = false;
  gt_error_check(err);
  gt_assert(arguments);

  logger = gt_logger_new(false, GT_LOGGER_DEFLT_PREFIX, stdout);
  if (arguments->indextype == Fmindextype)
  {
    if (gt_mapfmindex(&fmindex,gt_str_get(arguments->indexname),
                      logger, err) != 0)
    {
      haserr = true;
      gt_mapfmindexfail = true;
    } else
    {
      alphabet = fmindex.alphabet;
    }
    totallength = fmindex.bwtlength-1;
  } else
  {
    unsigned int mappedbits;

    if (arguments->indextype == Esaindextype)
    {
      mappedbits = SARR_ESQTAB | SARR_SUFTAB
#undef WITHBCKTAB
#ifdef WITHBCKTAB
                   | SARR_BCKTAB
#endif
                   ;
    } else
    {
      if (dotestsequence(arguments))
      {
        mappedbits = SARR_ESQTAB;
      } else
      {
        mappedbits = 0;
      }
    }
    if (gt_mapsuffixarray(&suffixarray,
                       mappedbits,
                       gt_str_get(arguments->indexname),
                       logger,
                       err) != 0)
    {
      haserr = true;
      totallength = 0;
    } else
    {
      alphabet = gt_encseq_alphabet(suffixarray.encseq);
#ifdef WITHBCKTAB
      prefixlength = suffixarray.prefixlength;
#endif
      totallength = gt_encseq_total_length(suffixarray.encseq);
    }
    if (!haserr)
    {
      if (arguments->indextype == Packedindextype)
      {
        packedindex =
          gt_loadvoidBWTSeqForSA(gt_str_get(arguments->indexname),
                                 false,
                                 err);
        if (packedindex == NULL)
        {
          haserr = true;
        }
      }
    }
  }
  if (!haserr)
  {
    const void *theindex;
    Greedygmatchforwardfunction gmatchforwardfunction;

    if (arguments->indextype == Fmindextype)
    {
      theindex = (const void *) &fmindex;
      if (arguments->doms)
      {
        gmatchforwardfunction = gt_skfmmstats;
      } else
      {
        gmatchforwardfunction = gt_skfmuniqueforward;
      }
    } else
    {
      if (arguments->indextype == Esaindextype)
      {
        theindex = (const void *) &suffixarray;
        if (arguments->doms)
        {
          gmatchforwardfunction = gt_suffixarraymstats;
        } else
        {
          gmatchforwardfunction = gt_suffixarrayuniqueforward;
        }
      } else
      {
        gt_assert(arguments->indextype == Packedindextype);
        theindex = (const void *) packedindex;
        if (arguments->doms)
        {
          gmatchforwardfunction = gt_voidpackedindexmstatsforward;
        } else
        {
          gmatchforwardfunction = gt_voidpackedindexuniqueforward;
        }
      }
    }
    if (!haserr)
    {
#ifdef WITHBCKTAB
      if (prefixlength > 0 &&
          arguments->indextype == Esaindextype &&
          runsubstringiteration(gmatchforwardfunction,
                                theindex,
                                totallength,
                                suffixarray.bcktab,
                                suffixarray.countspecialcodes,
                                alphabet,
                                prefixlength,
                                arguments->queryfilenames,
                                err) != 0)

      {
        haserr = true;
      }
#endif
      if (!haserr &&
          gt_findsubquerygmatchforward(dotestsequence(arguments)
                                      ? suffixarray.encseq
                                      : NULL,
                                      theindex,
                                      totallength,
                                      gmatchforwardfunction,
                                      alphabet,
                                      arguments->queryfilenames,
                                      arguments->minlength,
                                      arguments->maxlength,
                                      (arguments->showmode & SHOWSEQUENCE)
                                             ? true : false,
                                      (arguments->showmode & SHOWQUERYPOS)
                                             ? true : false,
                                      (arguments->showmode & SHOWSUBJECTPOS)
                                             ? true : false,
                                      err) != 0)
      {
        haserr = true;
      }
    }
  }
  if (arguments->indextype == Fmindextype)
  {
    if (!gt_mapfmindexfail)
    {
      gt_freefmindex(&fmindex);
    }
  } else
  {
    if (arguments->indextype == Packedindextype && packedindex != NULL)
    {
      gt_deletevoidBWTSeq(packedindex);
    }
    gt_freesuffixarray(&suffixarray);
  }
  gt_logger_delete(logger);

  return haserr ? -1 : 0;;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %r8, %r15
movq %rcx, %r14
testq %r8, %r8
je 0xb270d
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0xb29a1
testq %r14, %r14
je 0xb299c
movq 0x4117cb(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x29d1ad(%rip), %rsi    # 0x34f8d4
xorl %edi, %edi
callq 0x108ed0
movq %rax, %rbx
movl 0x40(%r14), %eax
cmpl $0x2, %eax
je 0xb278e
cmpl $0x1, %eax
je 0xb2787
testl %eax, %eax
jne 0xb27a1
movq 0x28(%r14), %rdi
callq 0x120d23
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x1b68a8
xorl %r13d, %r13d
movl $0x0, %r8d
testl %eax, %eax
setne %cl
jne 0xb2777
movq 0xb0(%rsp), %r8
movq 0x58(%rsp), %rbp
decq %rbp
movl %ecx, %r12d
jmp 0xb283d
movl $0x3, %ebp
jmp 0xb27a3
cmpb $0x1, 0x24(%r14)
jne 0xb27a1
movl $0x1, %ebp
cmpb $0x0, 0x44(%r14)
jne 0xb27a3
xorl %ebp, %ebp
movq 0x28(%r14), %rdi
callq 0x120d23
leaq 0x118(%rsp), %rdi
movl %ebp, %esi
movq %rax, %rdx
movq %rbx, %rcx
movq %r15, %r8
callq 0x1aab20
testl %eax, %eax
je 0xb27d2
movb $0x1, %r12b
xorl %r8d, %r8d
xorl %ebp, %ebp
jmp 0xb27f8
movq 0x118(%rsp), %rdi
callq 0xf02da
movq %rax, %r12
movq 0x118(%rsp), %rdi
callq 0xec1d8
movq %r12, %r8
movq %rax, %rbp
xorl %r12d, %r12d
testb %r12b, %r12b
jne 0xb2838
cmpl $0x2, 0x40(%r14)
jne 0xb2838
movq 0x28(%r14), %rdi
movq %r8, %r13
callq 0x120d23
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x1a86aa
xorl %ecx, %ecx
movq %r13, %r8
movq %rax, %r13
testq %rax, %rax
movzbl %r12b, %eax
movl $0x1, %r12d
cmovnel %eax, %r12d
jmp 0xb283d
xorl %r13d, %r13d
xorl %ecx, %ecx
testb %r12b, %r12b
jne 0xb293f
movl 0x40(%r14), %eax
cmpl $0x2, %eax
movq %rcx, 0x40(%rsp)
je 0xb2881
cmpl $0x1, %eax
je 0xb2871
testl %eax, %eax
jne 0xb29a6
cmpb $0x0, 0x44(%r14)
je 0xb28ae
leaq 0x103b24(%rip), %rcx    # 0x1b6393
jmp 0xb28b5
cmpb $0x0, 0x44(%r14)
je 0xb2891
leaq 0xf9d3c(%rip), %rcx     # 0x1ac5bb
jmp 0xb2898
cmpb $0x0, 0x44(%r14)
je 0xb28a2
leaq 0xf6450(%rip), %rcx     # 0x1a8cdf
jmp 0xb28a9
leaq 0xf9c7c(%rip), %rcx     # 0x1ac514
leaq 0x118(%rsp), %rsi
jmp 0xb28ba
leaq 0xf63f8(%rip), %rcx     # 0x1a8ca1
movq %r13, %rsi
jmp 0xb28ba
leaq 0x103767(%rip), %rcx    # 0x1b601c
leaq 0x48(%rsp), %rsi
cmpl $0x2, %eax
jne 0xb28cf
cmpb $0x1, 0x24(%r14)
jne 0xb28cf
movb $0x1, %al
cmpb $0x0, 0x44(%r14)
jne 0xb28d1
xorl %eax, %eax
testb %al, %al
je 0xb28df
movq 0x118(%rsp), %rdi
jmp 0xb28e1
xorl %edi, %edi
movq 0x30(%r14), %r9
movl 0x20(%r14), %eax
movl %eax, %edx
andl $0x1, %edx
movl %eax, %r10d
andl $0x2, %r10d
shrl %r10d
andl $0x4, %eax
shrl $0x2, %eax
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, 0x38(%rsp)
movl %eax, 0x30(%rsp)
movl %r10d, 0x28(%rsp)
movl %edx, 0x20(%rsp)
movq %rbp, %rdx
callq 0x1baad8
testl %eax, %eax
movzbl %r12b, %eax
movl $0x1, %r12d
cmovel %eax, %r12d
movq 0x40(%rsp), %rcx
movl 0x40(%r14), %eax
testl %eax, %eax
je 0xb296e
cmpl $0x2, %eax
setne %al
testq %r13, %r13
sete %cl
orb %al, %cl
jne 0xb295f
movq %r13, %rdi
callq 0x1a87ef
leaq 0x118(%rsp), %rdi
callq 0x1a9e1c
jmp 0xb297c
testb %cl, %cl
jne 0xb297c
leaq 0x48(%rsp), %rdi
callq 0x1b6878
movq %rbx, %rdi
callq 0x10916a
movzbl %r12b, %eax
negl %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1c86d
callq 0x1c7fb
callq 0x1c834