// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/fmi-locate.c
// Function: gt_fmfindtextpos
GtUword gt_fmfindtextpos (const Fmindex *fm,GtUword idx)
{
  GtUword offset = 0;
  GtUchar cc;

  while ((idx & fm->markdistminus1) != 0)
  {
    if (idx == fm->longestsuffixpos || GT_ISSPECIAL(cc = ACCESSBWTTEXT(idx)))
    {
      GtUword smallestgeq
               = searchsmallestgeq(fm->specpos.spaceGtPairBwtidx,
                                   fm->specpos.spaceGtPairBwtidx +
                                   fm->specpos.nextfreeGtPairBwtidx - 1,
                                   idx);
      return (smallestgeq + offset) % fm->bwtlength;
    }
    idx = fm->tfreq[cc] + fmoccurrence (fm, cc, idx);
    offset++;
  }
  return (fm->markpostable[idx / fm->markdist] + offset) % fm->bwtlength;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movq %rdi, %r15
testq %rsi, 0x48(%rdi)
je 0x1add3b
leaq 0x10(%r15), %rax
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
movq %r12, %r14
cmpq 0x30(%r15), %r14
je 0x1adcdf
movq (%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xe7bbc
cmpb $-0x2, %al
jae 0x1adcdf
movl %eax, %ebp
movzbl %al, %esi
movq 0x18(%r15), %rax
movq (%rax,%rsi,8), %rax
movq %rax, 0x10(%rsp)
movq 0xa8(%r15), %rdx
imulq %rsi, %rdx
movl 0x88(%r15), %eax
movq %r14, %r13
movl %eax, %ecx
shrq %cl, %r13
imulq 0xb0(%r15), %rsi
movb 0x8c(%r15), %cl
movq %r14, %r8
shrq %cl, %r8
movq 0x30(%r15), %rcx
movq %rcx, %r9
movl 0x7c(%r15), %edi
subq %r14, %r9
jae 0x1adaae
movq %r14, %r9
subq %rcx, %r9
cmpq %rdi, %r9
jae 0x1adb26
shlq $0x3, %rsi
addq 0x20(%r15), %rsi
movq 0x40(%r15), %rdi
andq %r14, %rdi
movl %eax, %ecx
shrq %cl, %rdi
leaq (%rdx,%r13), %rax
movq (%rsi,%r8,8), %r12
leaq (%rdi,%rdx), %rcx
cmpq %rax, %rcx
jae 0x1adaeb
addq 0x8(%r15), %rdx
movzbl (%rdx,%rdi), %eax
addq %rax, %r12
incq %rdi
cmpq %rdi, %r13
jne 0x1adadc
movq 0x38(%r15), %r13
andq %r14, %r13
cmpq %r14, %r13
je 0x1adc97
cmpq 0x30(%r15), %r13
je 0x1adb19
movq (%r15), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0xe7bbc
xorl %ecx, %ecx
cmpb %bpl, %al
sete %cl
addq %rcx, %r12
incq %r13
cmpq %r14, %r13
jb 0x1adafb
jmp 0x1adc97
movl 0x84(%r15), %ecx
movl %ecx, %r9d
shrl %r9d
testl %r9d, %r14d
je 0x1adbdd
movq 0x8(%rsp), %r9
movq (%r9), %r9
subq %r14, %r9
cmpq %rcx, %r9
jbe 0x1adbdd
leaq 0x1(%r8), %rdi
movb 0x90(%r15), %cl
shlq %cl, %rdi
shlq $0x3, %rsi
addq 0x20(%r15), %rsi
leaq (%rdi,%rdx), %r9
movq 0x8(%rsi,%r8,8), %r12
leaq (%rdx,%r13), %rcx
cmpq %r9, %rcx
jae 0x1adb8f
addq 0x8(%r15), %rdx
movq %r13, %rsi
movzbl (%rdx,%rsi), %r8d
subq %r8, %r12
incq %rsi
cmpq %rsi, %rdi
jne 0x1adb7f
testl %r14d, 0x80(%r15)
je 0x1adcb1
movq 0x8(%r15), %rdx
movzbl (%rdx,%rcx), %ecx
addq %rcx, %r12
incq %r13
movl %eax, %ecx
shlq %cl, %r13
cmpq %r14, %r13
jbe 0x1adc97
movq (%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xe7bbc
xorl %ecx, %ecx
cmpb %bpl, %al
sete %cl
subq %rcx, %r12
incq %r14
cmpq %r14, %r13
jne 0x1adbb8
jmp 0x1adc97
shlq $0x3, %rsi
addq 0x20(%r15), %rsi
movq 0x40(%r15), %r9
andq %r14, %r9
movl %eax, %ecx
shrq %cl, %r9
leaq (%rdx,%r13), %rax
movq (%rsi,%r8,8), %r12
leaq (%r9,%rdx), %rcx
cmpq %rax, %rcx
jae 0x1adc16
addq 0x8(%r15), %rdx
movzbl (%rdx,%r9), %ecx
addq %rcx, %r12
incq %r9
cmpq %r9, %r13
jne 0x1adc06
testl %r14d, 0x80(%r15)
je 0x1adc6b
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
subq %r14, %rcx
cmpq %rdi, %rcx
jbe 0x1adc6b
movq 0x8(%r15), %rcx
movzbl (%rcx,%rax), %eax
addq %rax, %r12
movq 0x38(%r15), %r13
andq %r14, %r13
addq %rdi, %r13
cmpq %r14, %r13
jbe 0x1adc97
movq (%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xe7bbc
xorl %ecx, %ecx
cmpb %bpl, %al
sete %cl
subq %rcx, %r12
incq %r14
cmpq %r13, %r14
jb 0x1adc49
jmp 0x1adc97
movq 0x38(%r15), %r13
andq %r14, %r13
cmpq %r14, %r13
je 0x1adc97
movq (%r15), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0xe7bbc
xorl %ecx, %ecx
cmpb %bpl, %al
sete %cl
addq %rcx, %r12
incq %r13
cmpq %r14, %r13
jb 0x1adc77
addq 0x10(%rsp), %r12
incq %rbx
movq %r12, %r14
testq %r12, 0x48(%r15)
jne 0x1ada38
jmp 0x1add3d
movq 0x38(%r15), %r13
andq %r14, %r13
cmpq %r14, %r13
je 0x1adc97
movq (%r15), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0xe7bbc
xorl %ecx, %ecx
cmpb %bpl, %al
sete %cl
addq %rcx, %r12
incq %r13
cmpq %r14, %r13
jb 0x1adcbd
jmp 0x1adc97
movq 0x50(%r15), %rax
testq %rax, %rax
je 0x1add7d
movq 0x60(%r15), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdx
addq $-0x10, %rdx
cmpq %rdx, %rax
ja 0x1add36
xorl %ecx, %ecx
movq %rdx, %rdi
subq %rax, %rdi
sarq %rdi
andq $-0x10, %rdi
leaq (%rax,%rdi), %rsi
cmpq %r14, (%rax,%rdi)
jbe 0x1add23
leaq -0x10(%rsi), %rdx
movq %rsi, %rcx
jmp 0x1add2c
jae 0x1add57
addq $0x10, %rsi
movq %rsi, %rax
cmpq %rdx, %rax
jbe 0x1add03
testq %rcx, %rcx
jne 0x1add5a
callq 0x645f1
xorl %ebx, %ebx
movq 0x28(%r15), %rcx
movq %r12, %rax
xorl %edx, %edx
divq 0xb8(%r15)
addq (%rcx,%rax,8), %rbx
addq $0x10, %r15
jmp 0x1add63
movq %rsi, %rcx
addq 0x8(%rcx), %rbx
movq 0x8(%rsp), %r15
movq %rbx, %rax
xorl %edx, %edx
divq (%r15)
movq %rdx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x64628
nop