// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/firstcodes-cache.c
// Function: gt_firstcodes_find_accu
GtUword gt_firstcodes_find_accu(GtUword *foundcode,
                                      const GtUword *differences,
                                      GtUword allfirstcodes0,
                                      GtUword differentcodes,
                                      GtUword differencemask,
                                      const GtArrayGtIndexwithcode
                                         *binsearchcache,
                                      GtUword code)
{
  GtUword leftptr = ULONG_MAX, rightptr = ULONG_MAX,
                foundindex = ULONG_MAX, previouscode = ULONG_MAX;

  if (code <= allfirstcodes0)
  {
    *foundcode = allfirstcodes0;
    return 0;
  }
  *foundcode = ULONG_MAX;
  if (binsearchcache != NULL)
  {
    const GtIndexwithcode *leftic, *midic, *rightic;
    unsigned int depth;

    gt_assert(binsearchcache->spaceGtIndexwithcode != NULL);
    leftic = binsearchcache->spaceGtIndexwithcode;
    rightic = binsearchcache->spaceGtIndexwithcode +
              binsearchcache->nextfreeGtIndexwithcode - 1;
    for (depth = 0; /* Nothing */; depth++)
    {
      midic = leftic + GT_DIV2((GtUword) (rightic-leftic));
      if (code < midic->code)
      {
        foundindex = midic->afcindex;
        *foundcode = midic->code;
        if (depth < binsearchcache->depth)
        {
          rightic = midic - 1;
        } else
        {
          gt_assert(leftic->afcindex != ULONG_MAX &&
                    rightic->afcindex != ULONG_MAX);
          if (leftic > binsearchcache->spaceGtIndexwithcode)
          {
            leftptr = (leftic-1)->afcindex + 1;
            previouscode = (leftic-1)->code;
          } else
          {
            gt_assert(code > allfirstcodes0);
            leftptr = 1UL;
            previouscode = allfirstcodes0;
          }
          gt_assert(rightic->afcindex > 0);
          rightptr = rightic->afcindex - 1;
          break;
        }
      } else
      {
        if (code > midic->code)
        {
          if (depth < binsearchcache->depth)
          {
            leftic = midic + 1;
          } else
          {
            gt_assert(leftic->afcindex != ULONG_MAX &&
                      rightic->afcindex != ULONG_MAX);
            leftptr = leftic->afcindex + 1;
            previouscode = leftic->code;
            if (rightic < binsearchcache->spaceGtIndexwithcode +
                          binsearchcache->nextfreeGtIndexwithcode - 1)
            {
              gt_assert((rightic+1)->afcindex > 0);
              rightptr = (rightic+1)->afcindex - 1;
            } else
            {
              rightptr = differentcodes - 1;
            }
            break;
          }
        } else
        {
          gt_assert(midic->afcindex != ULONG_MAX);
          *foundcode = midic->code;
          return midic->afcindex;
        }
      }
    }
    gt_assert(leftptr != ULONG_MAX && rightptr != ULONG_MAX);
  } else
  {
    leftptr = 1UL;
    previouscode = allfirstcodes0;
    rightptr = differentcodes - 1;
  }
  if (leftptr <= rightptr)
  {
    GtUword idx;

    for (idx = leftptr; idx <= rightptr; idx++)
    {
      previouscode += (differences[idx] & differencemask); /* extract diff */
      if (code <= previouscode)
      {
        *foundcode = previouscode;
        foundindex = idx;
        break;
      }
    }
  }
  return foundindex;
}

// Assembly:
subq $0x88, %rsp
movq 0x90(%rsp), %rax
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %r8, 0x58(%rsp)
movq %r9, 0x50(%rsp)
movq $-0x1, 0x48(%rsp)
movq $-0x1, 0x40(%rsp)
movq $-0x1, 0x38(%rsp)
movq $-0x1, 0x30(%rsp)
movq 0x90(%rsp), %rax
cmpq 0x68(%rsp), %rax
ja 0x4bab1e
movq 0x68(%rsp), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movq $0x0, 0x80(%rsp)
jmp 0x4bb029
movq 0x78(%rsp), %rax
movq $-0x1, (%rax)
cmpq $0x0, 0x50(%rsp)
je 0x4baf80
jmp 0x4bab38
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x4bab7b
movq 0x181456(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b4bf(%rip), %rsi     # 0x516013
leaq 0xfccc2(%rip), %rdx     # 0x5b781d
leaq 0xfcd92(%rip), %rcx     # 0x5b78f4
leaq 0xfcc36(%rip), %r8      # 0x5b779f
movl $0xa2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4bab7d
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $-0x10, %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rdx
subq %rdx, %rcx
sarq $0x4, %rcx
shrq %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x90(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x4bad71
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movl 0x14(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jae 0x4bac2e
movq 0x20(%rsp), %rax
addq $-0x10, %rax
movq %rax, 0x18(%rsp)
jmp 0x4bad6c
jmp 0x4bac30
movq 0x28(%rsp), %rax
cmpq $-0x1, (%rax)
je 0x4bac46
movq 0x18(%rsp), %rax
cmpq $-0x1, (%rax)
jne 0x4bac7e
movq 0x181353(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b3bc(%rip), %rsi     # 0x516013
leaq 0xfccae(%rip), %rdx     # 0x5b790c
leaq 0xfcc8f(%rip), %rcx     # 0x5b78f4
leaq 0xfcb33(%rip), %r8      # 0x5b779f
movl $0xb3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4bac80
movq 0x28(%rsp), %rax
movq 0x50(%rsp), %rcx
cmpq (%rcx), %rax
jbe 0x4bacb1
movq 0x28(%rsp), %rax
movq -0x10(%rax), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
movq 0x28(%rsp), %rax
movq -0x8(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x4bad0f
jmp 0x4bacb3
movq 0x90(%rsp), %rax
cmpq 0x68(%rsp), %rax
ja 0x4bacfa
movq 0x1812d7(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b340(%rip), %rsi     # 0x516013
leaq 0xfcc72(%rip), %rdx     # 0x5b794c
leaq 0xfcc13(%rip), %rcx     # 0x5b78f4
leaq 0xfcab7(%rip), %r8      # 0x5b779f
movl $0xba, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4bacfc
movq $0x1, 0x48(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x4bad11
movq 0x18(%rsp), %rax
cmpq $0x0, (%rax)
ja 0x4bad54
movq 0x18127d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b2e6(%rip), %rsi     # 0x516013
leaq 0xfcc2e(%rip), %rdx     # 0x5b7962
leaq 0xfcbb9(%rip), %rcx     # 0x5b78f4
leaq 0xfca5d(%rip), %r8      # 0x5b779f
movl $0xbe, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4bad56
movq 0x18(%rsp), %rax
movq (%rax), %rax
subq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x4baf32
jmp 0x4baf20
movq 0x90(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jbe 0x4baeb1
movl 0x14(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jae 0x4bada9
movq 0x20(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x28(%rsp)
jmp 0x4baeaf
jmp 0x4badab
movq 0x28(%rsp), %rax
cmpq $-0x1, (%rax)
je 0x4badc1
movq 0x18(%rsp), %rax
cmpq $-0x1, (%rax)
jne 0x4badf9
movq 0x1811d8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b241(%rip), %rsi     # 0x516013
leaq 0xfcb33(%rip), %rdx     # 0x5b790c
leaq 0xfcb14(%rip), %rcx     # 0x5b78f4
leaq 0xfc9b8(%rip), %r8      # 0x5b779f
movl $0xcc, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4badfb
movq 0x28(%rsp), %rax
movq (%rax), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
movq 0x50(%rsp), %rcx
movq (%rcx), %rcx
movq 0x50(%rsp), %rdx
movq 0x10(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
addq $-0x10, %rcx
cmpq %rcx, %rax
jae 0x4bae9c
jmp 0x4bae42
movq 0x18(%rsp), %rax
cmpq $0x0, 0x10(%rax)
ja 0x4bae86
movq 0x18114b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b1b4(%rip), %rsi     # 0x516013
leaq 0xfcb12(%rip), %rdx     # 0x5b7978
leaq 0xfca87(%rip), %rcx     # 0x5b78f4
leaq 0xfc92b(%rip), %r8      # 0x5b779f
movl $0xd2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4bae88
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
subq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x4baeaa
movq 0x60(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x4baf32
jmp 0x4baf1e
jmp 0x4baeb3
movq 0x20(%rsp), %rax
cmpq $-0x1, (%rax)
jne 0x4baef6
movq 0x1810db(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b144(%rip), %rsi     # 0x516013
leaq 0xfcabc(%rip), %rdx     # 0x5b7992
leaq 0xfca17(%rip), %rcx     # 0x5b78f4
leaq 0xfc8bb(%rip), %r8      # 0x5b779f
movl $0xdc, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4baef8
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x80(%rsp)
jmp 0x4bb029
jmp 0x4baf20
jmp 0x4baf22
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x4babb3
jmp 0x4baf34
cmpq $-0x1, 0x48(%rsp)
je 0x4baf44
cmpq $-0x1, 0x40(%rsp)
jne 0x4baf7c
movq 0x181055(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5b0be(%rip), %rsi     # 0x516013
leaq 0xfca53(%rip), %rdx     # 0x5b79af
leaq 0xfc991(%rip), %rcx     # 0x5b78f4
leaq 0xfc835(%rip), %r8      # 0x5b779f
movl $0xe2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4baf7e
jmp 0x4bafa1
movq $0x1, 0x48(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
ja 0x4bb01c
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpq 0x40(%rsp), %rax
ja 0x4bb01a
movq 0x70(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
andq 0x58(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x90(%rsp), %rax
cmpq 0x30(%rsp), %rax
ja 0x4bb008
movq 0x30(%rsp), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x38(%rsp)
jmp 0x4bb01a
jmp 0x4bb00a
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x4bafb7
jmp 0x4bb01c
movq 0x38(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
addq $0x88, %rsp
retq
nopl (%rax)