// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/esa-mmsearch.c
// Function: gt_queryuniquematch
void gt_queryuniquematch(bool selfmatch,
                         const Suffixarray *suffixarray,
                         uint64_t queryunitnum,
                         GtQueryrepresentation *queryrep,
                         GtUword minmatchlength,
                         GtProcessquerymatch processquerymatch,
                         void *processquerymatchinfo,
                         GtQuerymatch *querymatchspaceptr)
{
  GtUword offset, totallength = gt_encseq_total_length(suffixarray->encseq),
          localqueryoffset = 0;
  uint64_t localqueryunitnum = queryunitnum;

  gt_assert(!selfmatch && queryrep->seqlen >= minmatchlength);
  /*XXX gt_assert(!gt_querymatch_seq_desc_display(querymatchspaceptr));*/
  for (offset = 0; offset <= queryrep->seqlen - minmatchlength; offset++)
  {
    GtUword matchlen, dbstart;

    matchlen = gt_suffixarrayfindmums (suffixarray,
                                       0,
                                       0, /* leftbound */
                                       totallength, /* rightbound */
                                       &dbstart,
                                       queryrep->sequence + offset,
                                       queryrep->sequence + queryrep->seqlen);
    if (dbstart != ULONG_MAX &&
        matchlen >= minmatchlength &&
        gt_mum_isleftmaximal(suffixarray->encseq,
                             suffixarray->readmode,
                             dbstart,
                             offset,
                             queryrep->sequence))
    {
      GtUword dbseqnum = gt_encseq_seqnum(suffixarray->encseq,dbstart),
              dbseqlen = gt_encseq_seqlength(suffixarray->encseq,dbseqnum),
              db_seqstart = gt_encseq_seqstartpos(suffixarray->encseq,dbseqnum);

      gt_querymatch_init(querymatchspaceptr,
                         matchlen,
                         dbseqnum,
                         dbstart - db_seqstart,
                         db_seqstart,
                         dbseqlen,
                         0, /* score */
                         0, /* edist */
                         0, /* mismatches */
                         selfmatch,
                         localqueryunitnum,
                         matchlen,
                         localqueryoffset,
                         0,
                         queryrep->seqlen,
                         NULL,
                         NULL);
      processquerymatch(processquerymatchinfo,querymatchspaceptr);
    }
    if (queryrep->sequence[offset] == (GtUchar) GT_SEPARATOR)
    {
      localqueryunitnum++;
      localqueryoffset = 0;
    } else
    {
      localqueryoffset++;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, 0x88(%rsp)
movq %r8, %rbp
movq %rcx, %r14
movq %rdx, %r12
movl %edi, %ebx
movq %rsi, 0x78(%rsp)
movq (%rsi), %rdi
callq 0xe7b9c
movq %rax, 0x90(%rsp)
testl %ebx, %ebx
jne 0x1a4163
movq 0x20(%r14), %rcx
cmpq %rbp, %rcx
jb 0x1a4163
movq (%r14), %rax
leaq 0x60(%rsp), %rbx
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rbp, 0x80(%rsp)
movq %r14, 0x70(%rsp)
leaq (%rax,%r15), %r9
addq %rax, %rcx
movq %rcx, (%rsp)
movq 0x78(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq 0x90(%rsp), %rcx
movq %rbx, %r8
callq 0x1a3c8a
movq 0x60(%rsp), %rsi
cmpq $-0x1, %rsi
je 0x1a411a
movq %rax, %r14
cmpq %rbp, %rax
jb 0x1a411a
testq %rsi, %rsi
sete %al
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x1a4068
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x78(%rsp), %rax
movl 0x48(%rax), %edx
movq (%rax), %rdi
decq %rsi
callq 0xe7bbc
cmpb $-0x3, %al
ja 0x1a4068
movq 0x68(%rsp), %rcx
cmpb -0x1(%rcx,%r15), %al
je 0x1a411a
movq 0x78(%rsp), %rbx
movq (%rbx), %rdi
movq 0x60(%rsp), %rsi
callq 0xeb655
movq %rax, %rbp
movq (%rbx), %rdi
movq %rax, %rsi
callq 0xeb9d2
movq %rax, 0x68(%rsp)
movq (%rbx), %rdi
movq %rbp, %rsi
callq 0xeb6ee
movq 0x60(%rsp), %rcx
subq %rax, %rcx
movq 0x70(%rsp), %rdx
movq 0x20(%rdx), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
xorl %edx, %edx
movq %rdx, 0x38(%rsp)
movq %r13, 0x30(%rsp)
movq %r14, 0x28(%rsp)
movq %r12, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
movups %xmm0, (%rsp)
movl $0x0, 0x18(%rsp)
movq 0xd8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq 0x80(%rsp), %rbp
movq %rax, %r8
movq 0x68(%rsp), %r9
callq 0x1bacde
movq 0xd0(%rsp), %rdi
movq %rbx, %rsi
leaq 0x60(%rsp), %rbx
callq *0x88(%rsp)
movq 0x70(%rsp), %r14
movq (%r14), %rax
incq %r13
xorl %ecx, %ecx
cmpb $-0x1, (%rax,%r15)
sete %cl
movl $0x0, %edx
cmoveq %rdx, %r13
addq %rcx, %r12
incq %r15
movq 0x20(%r14), %rcx
movq %rcx, %rdx
subq %rbp, %rdx
cmpq %rdx, %r15
jbe 0x1a3fe5
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x620be