// File: /workspace/github_c_makefile_star2_O2/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 0x33745
movq %r15, %rdi
callq 0x89eb7
testb %al, %al
jne 0x339c3
testq %r14, %r14
je 0x33995
movq 0x40475b(%rip), %rax    # 0x437eb0
movq (%rax), %rdx
leaq 0x2b3175(%rip), %rsi    # 0x2e68d4
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x92b50
movq %rax, %rbx
movl 0x40(%r14), %eax
cmpl $0x2, %eax
je 0x337b3
cmpl $0x1, %eax
je 0x337ae
testl %eax, %eax
jne 0x337c1
movq 0x28(%r14), %rdi
callq 0xad1fa
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x15b1b5
xorl %r12d, %r12d
movb $0x1, %cl
testl %eax, %eax
je 0x33849
movb $0x1, %bpl
jmp 0x33938
pushq $0x3
popq %rbp
jmp 0x337c3
cmpb $0x1, 0x24(%r14)
jne 0x337c3
movzbl 0x44(%r14), %ebp
jmp 0x337c3
xorl %ebp, %ebp
movq 0x28(%r14), %rdi
callq 0xad1fa
leaq 0x118(%rsp), %rdi
movl %ebp, %esi
movq %rax, %rdx
movq %rbx, %rcx
movq %r15, %r8
callq 0x14de4e
testl %eax, %eax
je 0x337fb
movb $0x1, %bpl
cmpl $0x0, 0x40(%r14)
jne 0x33958
jmp 0x3396b
movq 0x118(%rsp), %rdi
callq 0x754dd
movq %rax, %r13
movq 0x118(%rsp), %rdi
callq 0x7055e
movq %rax, %rbp
movl 0x40(%r14), %eax
cmpl $0x2, %eax
jne 0x33844
movq 0x28(%r14), %rdi
callq 0xad1fa
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x14b51f
movq %rax, %r12
testq %rax, %rax
jne 0x33859
jmp 0x337e8
xorl %r12d, %r12d
jmp 0x3385d
movq 0x58(%rsp), %rbp
movq 0xb0(%rsp), %r13
decq %rbp
movl 0x40(%r14), %eax
cmpl $0x2, %eax
je 0x3388f
cmpl $0x1, %eax
je 0x3387f
testl %eax, %eax
jne 0x339fb
cmpb $0x0, 0x44(%r14)
je 0x338d6
leaq 0x1273c7(%rip), %rcx    # 0x15ac44
jmp 0x338dd
cmpb $0x0, 0x44(%r14)
je 0x338a4
leaq 0x11c014(%rip), %rcx    # 0x14f8a1
jmp 0x338ab
movb 0x24(%r14), %dl
movb 0x44(%r14), %al
testb %al, %al
je 0x338b5
leaq 0x1184e8(%rip), %rcx    # 0x14bd8a
jmp 0x338bc
leaq 0x11bf5d(%rip), %rcx    # 0x14f808
leaq 0x118(%rsp), %rsi
jmp 0x338e2
leaq 0x11845d(%rip), %rcx    # 0x14bd19
cmpb $0x1, %dl
jne 0x338cf
testb %al, %al
je 0x338cf
movq 0x118(%rsp), %rdi
jmp 0x338d1
xorl %edi, %edi
movq %r12, %rsi
jmp 0x338e4
leaq 0x12701b(%rip), %rcx    # 0x15a8f8
leaq 0x48(%rsp), %rsi
xorl %edi, %edi
movq 0x30(%r14), %r9
movl 0x20(%r14), %eax
movl %eax, %edx
andl $0x1, %edx
movl %eax, %r8d
andl $0x2, %r8d
shrl %r8d
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 %r8d, 0x28(%rsp)
movl %edx, 0x20(%rsp)
movq %rbp, %rdx
movq %r13, %r8
callq 0x15f908
testl %eax, %eax
setne %bpl
xorl %ecx, %ecx
movl 0x40(%r14), %eax
testl %eax, %eax
je 0x33967
cmpl $0x2, %eax
setne %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x33958
movq %r12, %rdi
callq 0x14b703
leaq 0x118(%rsp), %rdi
callq 0x14d148
jmp 0x33975
testb %cl, %cl
jne 0x33975
leaq 0x48(%rsp), %rdi
callq 0x15b188
movq %rbx, %rdi
callq 0x92fd0
movzbl %bpl, %eax
negl %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4045cc(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b166d(%rip), %rsi    # 0x2e5013
leaq 0x314ca6(%rip), %rdx    # 0x348653
leaq 0x2bd35b(%rip), %rcx    # 0x2f0d0f
leaq 0x2bd085(%rip), %r8     # 0x2f0a40
movl $0x134, %r9d            # imm = 0x134
jmp 0x339ef
movq 0x40459e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b163f(%rip), %rsi    # 0x2e5013
leaq 0x2b17e4(%rip), %rdx    # 0x2e51bf
leaq 0x2bd32d(%rip), %rcx    # 0x2f0d0f
leaq 0x2bd057(%rip), %r8     # 0x2f0a40
movl $0x133, %r9d            # imm = 0x133
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x404566(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b1607(%rip), %rsi    # 0x2e5013
leaq 0x2bd30e(%rip), %rdx    # 0x2f0d21
leaq 0x2bd2f5(%rip), %rcx    # 0x2f0d0f
leaq 0x2bd01f(%rip), %r8     # 0x2f0a40
movl $0x195, %r9d            # imm = 0x195
jmp 0x339ef