// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/esa-mmsearch.c
// Function: gt_querysubstringmatchiterator_next
int gt_querysubstringmatchiterator_next(GtQuerysubstringmatchiterator *qsmi,
                                        GtError *err)
{
  gt_assert(qsmi != NULL);
  while (true)
  {
    if (qsmi->query_seqlen < qsmi->userdefinedleastlength)
    {
      if (qsmi->seqit != NULL)
      {
        int retval = gt_seq_iterator_next(qsmi->seqit,
                                          &qsmi->query_for_seqit,
                                          &qsmi->query_seqlen,
                                          &qsmi->desc,
                                          err);
        if (retval < 0)
        {
          return -1; /* error */
        }
        if (retval == 0)
        {
          return 1; /* no more sequences */
        }
        gt_assert(qsmi->query_seqlen > 0 && qsmi->query_for_seqit != NULL);
        qsmi->queryrep.sequence = qsmi->query_for_seqit;
      } else
      {
        if (qsmi->queryunitnum == qsmi->query_encseq_numofsequences)
        {
          return 1;
        }
        qsmi->queryrep.startpos = gt_encseq_seqstartpos(qsmi->queryrep.encseq,
                                                        qsmi->queryunitnum);
        qsmi->query_seqlen = gt_encseq_seqlength(qsmi->queryrep.encseq,
                                                 qsmi->queryunitnum);
      }
      gt_assert(qsmi->query_seqlen > 0);
      qsmi->queryrep.seqlen = qsmi->query_seqlen;
      qsmi->querysubstring.currentoffset = 0;
    }
    if (qsmi->query_seqlen >= qsmi->userdefinedleastlength)
    {
      if (!qsmi->mmsi_defined)
      {
        gt_mmsearchiterator_reinit(qsmi->mmsi,
                                   qsmi->dbencseq,
                                   qsmi->suftabpart,
                                   0, /* l */
                                   qsmi->numberofsuffixes - 1, /* r */
                                   0, /* offset */
                                   qsmi->db_readmode,
                                   &qsmi->querysubstring,
                                   qsmi->userdefinedleastlength);
        qsmi->mmsi_defined = true;
      } else
      {
        if (gt_mmsearchiterator_next(&qsmi->dbstart,qsmi->mmsi))
        {
          GtUword extend;

          if (gt_mmsearch_isleftmaximal(qsmi->dbencseq,
                                        qsmi->db_readmode,
                                        qsmi->dbstart,
                                        &qsmi->querysubstring))
          {
            extend = gt_mmsearch_extendright(qsmi->dbencseq,
                                             qsmi->mmsi->esr,
                                             qsmi->db_readmode,
                                             qsmi->totallength,
                                             qsmi->dbstart +
                                               qsmi->userdefinedleastlength,
                                             &qsmi->querysubstring,
                                             qsmi->userdefinedleastlength);
            qsmi->matchlength = qsmi->userdefinedleastlength + extend;
            return 0;
          }
        } else
        {
          qsmi->mmsi_defined = false;
          if (qsmi->querysubstring.currentoffset +
              qsmi->userdefinedleastlength < qsmi->query_seqlen)
          {
            qsmi->querysubstring.currentoffset++;
          } else
          {
            qsmi->query_seqlen = 0;
            qsmi->queryunitnum++;
          }
        }
      }
    } else
    {
      qsmi->query_seqlen = 0;
      qsmi->queryunitnum++;
    }
  }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x23934e
movq 0x402c83(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2dccec(%rip), %rsi    # 0x516013
leaq 0x33de98(%rip), %rdx    # 0x5771c6
leaq 0x33e00c(%rip), %rcx    # 0x577341
leaq 0x33dd2e(%rip), %r8     # 0x57706a
movl $0x353, %r9d            # imm = 0x353
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x239350
jmp 0x239352
movq 0x38(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x38(%rsp), %rcx
cmpq 0x28(%rcx), %rax
jae 0x23951f
movq 0x38(%rsp), %rax
cmpq $0x0, 0x80(%rax)
je 0x239445
movq 0x38(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x38(%rsp), %rsi
addq $0x70, %rsi
movq 0x38(%rsp), %rdx
addq $0x78, %rdx
movq 0x38(%rsp), %rcx
addq $0xa8, %rcx
movq 0x30(%rsp), %r8
callq 0x111ab0
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x2c(%rsp)
jge 0x2393c9
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
jmp 0x23971c
cmpl $0x0, 0x2c(%rsp)
jne 0x2393dd
movl $0x1, 0x44(%rsp)
jmp 0x23971c
jmp 0x2393df
movq 0x38(%rsp), %rax
cmpq $0x0, 0x78(%rax)
jbe 0x2393f7
movq 0x38(%rsp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x23942f
movq 0x402ba2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2dcc0b(%rip), %rsi    # 0x516013
leaq 0x33df56(%rip), %rdx    # 0x577365
leaq 0x33df2b(%rip), %rcx    # 0x577341
leaq 0x33dc4d(%rip), %r8     # 0x57706a
movl $0x367, %r9d            # imm = 0x367
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x239431
movq 0x38(%rsp), %rax
movq 0x70(%rax), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x2394b8
movq 0x38(%rsp), %rax
movq 0x98(%rax), %rax
movq 0x38(%rsp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x23946c
movl $0x1, 0x44(%rsp)
jmp 0x23971c
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x98(%rax), %rsi
callq 0xb0530
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x98(%rax), %rsi
callq 0xb09f0
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x78(%rax)
jmp 0x2394ba
movq 0x38(%rsp), %rax
cmpq $0x0, 0x78(%rax)
ja 0x2394fe
movq 0x402ad3(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2dcb3c(%rip), %rsi    # 0x516013
leaq 0x33debf(%rip), %rdx    # 0x57739d
leaq 0x33de5c(%rip), %rcx    # 0x577341
leaq 0x33db7e(%rip), %r8     # 0x57706a
movl $0x374, %r9d            # imm = 0x374
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x239500
movq 0x38(%rsp), %rax
movq 0x78(%rax), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x58(%rax)
movq 0x38(%rsp), %rax
movq $0x0, 0x68(%rax)
movq 0x38(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x38(%rsp), %rcx
cmpq 0x28(%rcx), %rax
jb 0x2396f3
movq 0x38(%rsp), %rax
testb $0x1, 0xb0(%rax)
jne 0x2395b3
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x38(%rsp), %rax
movq (%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x38(%rsp), %rax
movq 0x18(%rax), %r8
subq $0x1, %r8
movq 0x38(%rsp), %rax
movl 0x10(%rax), %r11d
movq 0x38(%rsp), %r10
addq $0x60, %r10
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %r9d
movq %r9, %rcx
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x239730
movq 0x38(%rsp), %rax
movb $0x1, 0xb0(%rax)
jmp 0x2396f1
movq 0x38(%rsp), %rdi
addq $0x88, %rdi
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rsi
callq 0x238350
testb $0x1, %al
jne 0x2395d6
jmp 0x23968d
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movl 0x10(%rax), %esi
movq 0x38(%rsp), %rax
movq 0x88(%rax), %rdx
movq 0x38(%rsp), %rcx
addq $0x60, %rcx
callq 0x239850
testb $0x1, %al
jne 0x239609
jmp 0x23968b
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x28(%rax), %rsi
movq 0x38(%rsp), %rax
movl 0x10(%rax), %edx
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x88(%rax), %r8
movq 0x38(%rsp), %rax
addq 0x28(%rax), %r8
movq 0x38(%rsp), %r9
addq $0x60, %r9
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, (%rsp)
callq 0x2398f0
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rcx
addq 0x20(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x90(%rax)
movl $0x0, 0x44(%rsp)
jmp 0x23971c
jmp 0x2396ef
movq 0x38(%rsp), %rax
movb $0x0, 0xb0(%rax)
movq 0x38(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x38(%rsp), %rcx
addq 0x28(%rcx), %rax
movq 0x38(%rsp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x2396c9
movq 0x38(%rsp), %rax
movq 0x68(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rax)
jmp 0x2396ed
movq 0x38(%rsp), %rax
movq $0x0, 0x78(%rax)
movq 0x38(%rsp), %rax
movq 0x98(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x98(%rax)
jmp 0x2396ef
jmp 0x2396f1
jmp 0x239717
movq 0x38(%rsp), %rax
movq $0x0, 0x78(%rax)
movq 0x38(%rsp), %rax
movq 0x98(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x98(%rax)
jmp 0x239352
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)