// File: /workspace/github_c_makefile_star2_O1/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 $0xa8, %rsp
movq %rsi, %r15
movq %rdi, %r14
movzbl 0x21(%rdi), %edi
movq 0x30756d(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x192f4f(%rip), %rsi    # 0x34f8d4
callq 0x108ed0
movq %rax, %rbp
cmpb $0x1, 0x23(%r14)
jne 0x1bc9e2
callq 0xf36ef
movq %rax, %rbx
movq %rax, %rdi
callq 0xf6ad8
movq %rbx, %rdi
callq 0xf6920
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xf6add
movq 0x8(%r14), %rdi
callq 0x120d23
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xf374b
movq %rax, %r12
movq %rbx, %rdi
callq 0xf424d
testq %r12, %r12
sete %r13b
jmp 0x1bca3c
movq 0x8(%r14), %rdi
callq 0x120d23
movb 0x20(%r14), %cl
movb $0x1, %r13b
movb $0x1, %dl
testb %cl, %cl
jne 0x1bc9fc
movb 0x24(%r14), %dl
movq %r15, 0x8(%rsp)
movq %rbp, (%rsp)
movzbl %cl, %esi
movzbl %dl, %edx
xorl %r12d, %r12d
movq %rax, %rdi
xorl %ecx, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x1bae8e
testq %rax, %rax
je 0x1bca3c
movq %rax, %rbx
movq %rax, %rdi
callq 0x1bae6d
movq %rbx, %rdi
movq %rax, %r12
xorl %r13d, %r13d
jmp 0x1bca3e
xorl %edi, %edi
testb %r13b, %r13b
jne 0x1bcd23
movq %rdi, 0x50(%rsp)
movl %r13d, 0x24(%rsp)
movq %rbp, 0x48(%rsp)
xorl %eax, %eax
movq %rax, 0x58(%rsp)
movq %rax, 0x28(%rsp)
movq %r12, %rdi
callq 0xf02da
cmpb $0x1, 0x24(%r14)
movq %rax, 0x60(%rsp)
jne 0x1bca9f
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1bc800
leaq 0x68(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1bc800
leaq 0x2bf(%rip), %r13       # 0x1bcd5c
jmp 0x1bcad5
movq %rax, %r13
leaq 0x88(%rsp), %rbx
movq %r12, 0x18(%rbx)
movq %rax, %rdi
callq 0xd3733
movq %rax, (%rbx)
movq %r13, %rdi
callq 0xd3746
movb %al, 0x10(%rbx)
movb 0x22(%r14), %al
movb %al, 0x11(%rbx)
leaq 0x2d2(%rip), %r13       # 0x1bcda4
movq %rbx, %rbp
cmpb $0x0, 0x23(%r14)
jne 0x1bcae3
cmpb $0x1, 0x24(%r14)
jne 0x1bcb0b
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rsi
movq 0x48(%r14), %rdx
movzbl 0x22(%r14), %r8d
movq %rbx, (%rsp)
movq %r13, %r9
callq 0x1bde49
movq %rax, 0x38(%rsp)
jmp 0x1bcb14
movq $0x0, 0x38(%rsp)
callq 0x1bcfd6
movq %rax, %rbx
cmpb $0x1, 0x23(%r14)
jne 0x1bcb2a
cmpb $0x1, 0x24(%r14)
jne 0x1bcb65
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1bcd57
movq %rbx, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movq %rbp, (%rsp)
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movq %r13, %r9
callq 0x1bb007
movq %rax, 0x28(%rsp)
movq (%r14), %rdi
movq %r15, %rsi
callq 0x11a648
movq %rax, %r13
testq %rax, %rax
movzbl 0x24(%rsp), %eax
movl $0x1, %ebp
cmovnel %eax, %ebp
testb %bpl, %bpl
je 0x1bcb95
movl %ebp, %r13d
movq 0x48(%rsp), %rbp
jmp 0x1bcce9
movq 0x60(%rsp), %rdi
callq 0xd3700
movq %r13, %rdi
movq %rax, %rsi
callq 0x119998
movq $0x0, 0x90(%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x58(%rsp), %rcx
movq %r13, %rdi
movq %r15, %r8
callq 0x119a11
movb $0x1, %cl
movl %ecx, 0x24(%rsp)
testl %eax, %eax
js 0x1bccb3
testl %eax, %eax
je 0x1bccaf
movq 0x90(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x1f48ca(%rip), %rdi    # 0x3b14c4
xorl %eax, %eax
callq 0x17070
cmpb $0x0, 0x23(%r14)
jne 0x1bcc0f
cmpb $0x1, 0x24(%r14)
jne 0x1bcc26
movq 0x40(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x1bd5f8
cmpb $0x1, 0x23(%r14)
jne 0x1bcc34
cmpb $0x1, 0x24(%r14)
jne 0x1bcc6a
movq 0x28(%rsp), %rdi
movq 0x28(%r14), %r9
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
movq 0x40(%r14), %rcx
movq 0x48(%r14), %r8
movq 0x40(%rsp), %rax
movq 0x30(%rsp), %r10
movq %rbx, 0x10(%rsp)
movq %r10, 0x8(%rsp)
movq %rax, (%rsp)
callq 0x1bb82d
cmpb $0x1, 0x24(%r14)
jne 0x1bcc88
movq 0x90(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x1bc860
incq 0x90(%rsp)
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x58(%rsp), %rcx
movq %r15, %r8
callq 0x119a11
jmp 0x1bcbd6
movl %ebp, 0x24(%rsp)
cmpq $0x0, 0x28(%rsp)
movq 0x48(%rsp), %rbp
je 0x1bcccd
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x1bb202
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1bccdc
callq 0x1bded6
movq %r13, %rdi
callq 0x119a53
movl 0x24(%rsp), %r13d
cmpb $0x1, 0x24(%r14)
jne 0x1bcd1e
movq 0x80(%rsp), %rdi
leaq 0x1f4716(%rip), %rbx    # 0x3b1415
movq %rbx, %rsi
movl $0x96, %edx
callq 0x109670
movq 0x70(%rsp), %rdi
movq %rbx, %rsi
movl $0x96, %edx
callq 0x109670
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1bcd2f
callq 0x1bae24
jmp 0x1bcd37
movq %r12, %rdi
callq 0xee90c
movq %rbp, %rdi
callq 0x10916a
movzbl %r13b, %eax
negl %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x670ec