// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/idxlocali.c
// Function: gt_runidxlocali
int gt_runidxlocali(const IdxlocaliOptions *idxlocalioptions,GtError *err)
{
  Genericindex *genericindex = NULL;
  bool haserr = false;
  GtLogger *logger;
  const GtEncseq *encseq = NULL;

  logger = gt_logger_new(idxlocalioptions->verbose,
                         GT_LOGGER_DEFLT_PREFIX, stdout);

  if (idxlocalioptions->doonline)
  {
    GtEncseqLoader *el;
    el = gt_encseq_loader_new();
    gt_encseq_loader_require_multiseq_support(el);
    gt_encseq_loader_drop_description_support(el);
    gt_encseq_loader_set_logger(el, logger);
    encseq = gt_encseq_loader_load(el, gt_str_get(idxlocalioptions->indexname),
                                   err);
    gt_encseq_loader_delete(el);
    if (encseq == NULL)
    {
      haserr = true;
    }
  } else
  {
    genericindex = genericindex_new(gt_str_get(idxlocalioptions->indexname),
                                    idxlocalioptions->withesa,
                                    idxlocalioptions->withesa ||
                                    idxlocalioptions->docompare,
                                    false,
                                    true,
                                    0,
                                    logger,
                                    err);
    if (genericindex == NULL)
    {
      haserr = true;
    } else
    {
      encseq = genericindex_getencseq(genericindex);
    }
  }
  if (!haserr)
  {
    GtSeqIterator *seqit;
    const GtUchar *query;
    GtUword querylen;
    char *desc = NULL;
    int retval;
    Limdfsresources *limdfsresources = NULL;
    const AbstractDfstransformer *dfst;
    SWdpresource *swdpresource = NULL;
    Showmatchinfo showmatchinfo;
    ProcessIdxMatch processmatch;
    GtAlphabet *a;
    void *processmatchinfoonline, *processmatchinfooffline;
    Storematchinfo storeonline, storeoffline;

    a = gt_encseq_alphabet(encseq);
    if (idxlocalioptions->docompare)
    {
      processmatch = storematch;
      gt_initstorematch(&storeonline,encseq);
      gt_initstorematch(&storeoffline,encseq);
      processmatchinfoonline = &storeonline;
      processmatchinfooffline = &storeoffline;
    } else
    {
      processmatch = idxlocali_showmatch;
      showmatchinfo.encseq = encseq;
      showmatchinfo.characters = gt_alphabet_characters(a);
      showmatchinfo.wildcardshow = gt_alphabet_wildcard_show(a);
      showmatchinfo.showalignment = idxlocalioptions->showalignment;
      processmatchinfoonline = processmatchinfooffline = &showmatchinfo;
    }
    if (idxlocalioptions->doonline || idxlocalioptions->docompare)
    {
      swdpresource = gt_newSWdpresource(idxlocalioptions->matchscore,
                                     idxlocalioptions->mismatchscore,
                                     idxlocalioptions->gapextend,
                                     idxlocalioptions->threshold,
                                     idxlocalioptions->showalignment,
                                     processmatch,
                                     processmatchinfoonline);
    }
    dfst = gt_locali_AbstractDfstransformer();
    if (!idxlocalioptions->doonline || idxlocalioptions->docompare)
    {
      gt_assert(genericindex != NULL);
      limdfsresources = gt_newLimdfsresources(genericindex,
                                           true,
                                           0,
                                           0,    /* maxpathlength */
                                           true, /* keepexpandedonstack */
                                           processmatch,
                                           processmatchinfooffline,
                                           NULL, /* processresult */
                                           NULL, /* processresult info */
                                           dfst);
    }
    seqit = gt_seq_iterator_sequence_buffer_new(idxlocalioptions->queryfiles,
                                               err);
    if (!seqit)
      haserr = true;
    if (!haserr)
    {
      gt_seq_iterator_set_symbolmap(seqit, gt_alphabet_symbolmap(a));
      for (showmatchinfo.queryunit = 0; /* Nothing */;
           showmatchinfo.queryunit++)
      {
        retval = gt_seq_iterator_next(seqit,
                                     &query,
                                     &querylen,
                                     &desc,
                                     err);
        if (retval < 0)
        {
          haserr = true;
          break;
        }
        if (retval == 0)
        {
          break;
        }
        printf("process sequence " Formatuint64_t " of length "GT_WU"\n",
                PRINTuint64_tcast(showmatchinfo.queryunit),querylen);
        if (idxlocalioptions->doonline || idxlocalioptions->docompare)
        {
          gt_multiapplysmithwaterman(swdpresource,encseq,query,querylen);
        }
        if (!idxlocalioptions->doonline || idxlocalioptions->docompare)
        {
          gt_indexbasedlocali(limdfsresources,
                           idxlocalioptions->matchscore,
                           idxlocalioptions->mismatchscore,
                           idxlocalioptions->gapstart,
                           idxlocalioptions->gapextend,
                           idxlocalioptions->threshold,
                           query,
                           querylen,
                           dfst);
        }
        if (idxlocalioptions->docompare)
        {
          gt_checkandresetstorematch(showmatchinfo.queryunit,
                                  &storeonline,&storeoffline);
        }
      }
      if (limdfsresources != NULL)
      {
        gt_freeLimdfsresources(&limdfsresources,dfst);
      }
      if (swdpresource != NULL)
      {
        gt_freeSWdpresource(swdpresource);
        swdpresource = NULL;
      }
      gt_seq_iterator_delete(seqit);
    }
    if (idxlocalioptions->docompare)
    {
      gt_freestorematch(&storeonline);
      gt_freestorematch(&storeoffline);
    }
  }
  if (genericindex == NULL)
  {
    gt_encseq_delete((GtEncseq *) encseq);
    encseq = NULL;
  } else
  {
    genericindex_delete(genericindex);
  }
  gt_logger_delete(logger);
  logger = NULL;
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbp
movq %rdi, %r14
movzbl 0x21(%rdi), %edi
movq 0x2d62be(%rip), %rax    # 0x437eb0
movq (%rax), %rdx
leaq 0x184cd8(%rip), %rsi    # 0x2e68d4
callq 0x92b50
movq %rax, %r15
cmpb $0x0, 0x23(%r14)
je 0x161c6a
callq 0x791cd
movq %rax, %rbx
movq %rax, %rdi
callq 0x7d482
movq %rbx, %rdi
callq 0x7cece
movq %rbx, %rdi
movq %r15, 0x30(%rsp)
movq %r15, %rsi
callq 0x7d487
movq 0x8(%r14), %rdi
callq 0xad1fa
movq %rbx, %rdi
movq %rax, %rsi
movq %rbp, %rdx
callq 0x7921d
movq %rax, %r15
movq %rbx, %rdi
callq 0x79f01
xorl %r13d, %r13d
testq %r15, %r15
jne 0x161cc6
movb $0x1, %r12b
movq 0x30(%rsp), %r15
jmp 0x161f82
movq 0x8(%r14), %rdi
callq 0xad1fa
movb 0x20(%r14), %cl
movb $0x1, %r12b
movb $0x1, %dl
testb %cl, %cl
jne 0x161c84
movb 0x24(%r14), %dl
movq %rbp, 0x8(%rsp)
movq %r15, (%rsp)
movzbl %cl, %esi
movzbl %dl, %edx
pushq $0x1
popq %r8
xorl %r13d, %r13d
movq %rax, %rdi
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x15fd30
testq %rax, %rax
je 0x161f82
movq %rax, %rbx
movq %r15, 0x30(%rsp)
movq %rax, %rdi
callq 0x15fcad
movq %rax, %r15
movq %rbx, %r13
andq $0x0, 0x70(%rsp)
andq $0x0, 0x58(%rsp)
movq %r15, %rdi
callq 0x754dd
cmpb $0x1, 0x24(%r14)
movq %r15, 0x40(%rsp)
movq %rax, 0x68(%rsp)
jne 0x161d17
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x161a78
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x161a78
leaq 0x2cd(%rip), %r15       # 0x161fe2
jmp 0x161d4d
movq %rax, %r12
leaq 0x98(%rsp), %rbx
movq %r15, 0x18(%rbx)
movq %rax, %rdi
callq 0x56d14
movq %rax, (%rbx)
movq %r12, %rdi
callq 0x56d5a
movb %al, 0x10(%rbx)
movb 0x22(%r14), %al
movb %al, 0x11(%rbx)
leaq 0x2e0(%rip), %r15       # 0x16202a
movq %rbx, %r12
cmpb $0x0, 0x23(%r14)
jne 0x161d5b
cmpb $0x1, 0x24(%r14)
jne 0x161d83
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rsi
movq 0x48(%r14), %rdx
movzbl 0x22(%r14), %r8d
movq %rbx, (%rsp)
movq %r15, %r9
callq 0x1634ed
movq %rax, 0x38(%rsp)
jmp 0x161d8c
movq $0x0, 0x38(%rsp)
callq 0x162419
movq %rax, %rbx
cmpb $0x1, 0x23(%r14)
movq %r13, 0x50(%rsp)
jne 0x161da7
cmpb $0x1, 0x24(%r14)
jne 0x161de0
testq %r13, %r13
je 0x161faa
movq %rbx, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movq %r12, (%rsp)
pushq $0x1
popq %rsi
movq %r13, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl %esi, %r8d
movq %r15, %r9
callq 0x15febd
movq %rax, %r13
movq %rax, 0x58(%rsp)
jmp 0x161de3
xorl %r13d, %r13d
movq (%r14), %rdi
movq %rbp, %rsi
callq 0xa70d0
testq %rax, %rax
sete 0x2f(%rsp)
movq 0x30(%rsp), %r15
je 0x161f07
movq %rax, %r12
movq 0x68(%rsp), %rdi
callq 0x56c48
movq %r12, %rdi
movq %rax, %rsi
callq 0xa61a8
leaq 0x70(%rsp), %r15
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
movq %r12, %rdi
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %r15, %rcx
movq %rbp, %r8
callq 0xa62e5
testl %eax, %eax
js 0x161f13
je 0x161f18
movq 0xa0(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq 0x1e6426(%rip), %rdi    # 0x348288
xorl %eax, %eax
callq 0x17070
movb 0x23(%r14), %al
testb %al, %al
jne 0x161e78
cmpb $0x1, 0x24(%r14)
jne 0x161e95
movq 0x60(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x162b08
movb 0x23(%r14), %al
testb $0x1, %al
je 0x161ea1
movb 0x24(%r14), %al
cmpb $0x1, %al
jne 0x161ed9
movq 0x28(%r14), %r9
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
movq 0x40(%r14), %rcx
movq 0x48(%r14), %r8
movq 0x60(%rsp), %rax
movq 0x48(%rsp), %rdi
movq %rbx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq %rax, (%rsp)
movq %r13, %rdi
callq 0x16084b
movb 0x24(%r14), %al
testb $0x1, %al
je 0x161ef7
movq 0xa0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x161ad4
movq 0xa0(%rsp), %rax
incq %rax
jmp 0x161e20
movq 0x50(%rsp), %rbx
movq 0x40(%rsp), %r13
jmp 0x161f50
movb $0x1, 0x2f(%rsp)
testq %r13, %r13
movq 0x30(%rsp), %r15
movq 0x40(%rsp), %r13
je 0x161f34
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x1600dc
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
movq 0x50(%rsp), %rbx
je 0x161f48
callq 0x163577
movq %r12, %rdi
callq 0xa6389
cmpb $0x1, 0x24(%r14)
movb 0x2f(%rsp), %r12b
jne 0x161f73
leaq 0x88(%rsp), %rdi
callq 0x161bbb
leaq 0x78(%rsp), %rdi
callq 0x161bbb
testq %rbx, %rbx
je 0x161f82
movq %rbx, %rdi
callq 0x15fc68
jmp 0x161f8a
movq %r13, %rdi
callq 0x735fd
movq %r15, %rdi
callq 0x92fd0
movzbl %r12b, %eax
negl %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d5fb7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x183058(%rip), %rsi    # 0x2e5013
leaq 0x1e5c7e(%rip), %rdx    # 0x347c40
leaq 0x1e62af(%rip), %rcx    # 0x348278
leaq 0x1e6209(%rip), %r8     # 0x3481d9
movl $0xf2, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390