// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-bltrie.c
// Function: blindtrie_findcompanion
static GtBlindtriesnodeptr blindtrie_findcompanion(
                                    GtBlindtrie *blindtrie,
                                    GtUword currentstartpos,
                                    GtUword currenttwobitencodingstoppos)
{
  GtBlindtriesymbol newchar;
  GtBlindtriesnodeptr head, succ;
  GtUword headdepth;

  blindtrie->stack.nextfreeGtBlindtriesnodeptr = 0;
  head = GT_BLINDTRIE_ROOTIDX;
  while (!blindtrie_isleaf(blindtrie,head))
  {
    GT_STOREINARRAY (&blindtrie->stack, GtBlindtriesnodeptr, 128, head);
    headdepth = blindtrie_getdepth(blindtrie,head);
    if (blindtrie_isleftofboundary(blindtrie,currentstartpos,headdepth))
    {
      if (!blindtrie->cmpcharbychar &&
          blindtrie->has_twobitencoding_stoppos_support)
      {
        if ((GT_ISDIRREVERSE(blindtrie->readmode) &&
            GT_REVERSEPOS(blindtrie->totallength,currentstartpos+headdepth)
            >= currenttwobitencodingstoppos) ||
            (!GT_ISDIRREVERSE(blindtrie->readmode) &&
             currentstartpos + headdepth < currenttwobitencodingstoppos))
        {
          newchar = (GtBlindtriesymbol)
                    gt_encseq_get_encoded_char_nospecial(
                                                   blindtrie->encseq,
                                                   currentstartpos + headdepth,
                                                   blindtrie->readmode);
        } else
        {
          newchar = GT_UNIQUEINT(currentstartpos + headdepth);
        }
      } else
      {
        newchar = (GtBlindtriesymbol)
                  gt_encseq_get_encoded_char(blindtrie->encseq,
                                             currentstartpos + headdepth,
                                             blindtrie->readmode);
        if (GT_BLINDTRIECHAR_GT_ISSPECIAL(newchar))
        {
          newchar = GT_UNIQUEINT(currentstartpos + headdepth);
        }
      }
    } else
    {
      newchar = GT_UNIQUEINT(currentstartpos + headdepth);
    }
    if (GT_ISUNIQUEINT(newchar))
    {
      return blindtrie_extractleafnode(blindtrie,head);
    }
    succ = blindtrie_findsucc(blindtrie,
                              blindtrie_firstchild_get(blindtrie,head),
                              newchar);
    if (succ == GT_BLINDTRIE_REFNULL)
    {
      return blindtrie_extractleafnode(blindtrie,head);
    }
    head = succ;
  }
  GT_STOREINARRAY (&blindtrie->stack, GtBlindtriesnodeptr, 128, head);
  return head;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, 0x20(%rdi)
xorl %ebp, %ebp
movl $0x1, %r14d
movl %ebp, %r12d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1e6d66
movq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rdx
testb %al, %al
jne 0x1e6cfe
cmpq %rcx, %rdx
jae 0x1e6bbc
movq 0x10(%rbx), %rax
jmp 0x1e6be8
leaq 0x80(%rcx), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x200(,%rcx,4), %rsi
leaq 0x1cf144(%rip), %rdx    # 0x3b5d1e
movl $0x1d0, %ecx            # imm = 0x1D0
callq 0x104461
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x1e6d5c
movq 0x20(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%rbx)
movl %r12d, (%rax,%rcx,4)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x1e7455
movq %rax, %r13
movq 0x70(%rbx), %rcx
testq %rcx, %rcx
je 0x1e6c28
addq %r15, %rcx
movq 0x60(%rbx), %rax
cmpq %rax, %rcx
cmovaeq %rax, %rcx
jmp 0x1e6c2f
movq 0x60(%rbx), %rax
movq %rax, %rcx
addq %r15, %r13
cmpq %rcx, %r13
jae 0x1e6c8b
cmpb $0x0, 0x78(%rbx)
jne 0x1e6c78
cmpb $0x1, 0x7a(%rbx)
jne 0x1e6c78
movl 0x58(%rbx), %edx
movl %edx, %ecx
orl $0x2, %ecx
cmpl $0x3, %ecx
jne 0x1e6c64
movq %r13, %rsi
notq %rsi
addq %rsi, %rax
cmpq (%rsp), %rax
jae 0x1e6c6a
cmpl $0x3, %ecx
je 0x1e6c8b
cmpq (%rsp), %r13
jae 0x1e6c8b
movq 0x40(%rbx), %rdi
movq %r13, %rsi
callq 0xe7fcb
jmp 0x1e6c96
movq 0x40(%rbx), %rdi
movl 0x58(%rbx), %edx
movq %r13, %rsi
callq 0xe7bbc
cmpb $-0x2, %al
jb 0x1e6c96
subq $-0x100, %r13
jae 0x1e6c9a
jmp 0x1e6ce5
movzbl %al, %r13d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x1e7428
movl %eax, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1e770b
cmpq %r13, %rax
movl $0x0, %ecx
sbbl %ecx, %ecx
cmpq %r13, %rax
cmoval %r14d, %ecx
testl %ecx, %ecx
je 0x1e6cdd
cmpl $0x1, %ecx
je 0x1e6ce5
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1e74b1
movl %eax, %ebp
testl %eax, %eax
jne 0x1e6ca7
jmp 0x1e6ce5
testl %ebp, %ebp
jne 0x1e6b94
movq %rbx, %rdi
movl %r12d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1e76d2
cmpq %rcx, %rdx
jae 0x1e6d09
movq 0x10(%rbx), %rax
jmp 0x1e6d35
leaq 0x80(%rcx), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x200(,%rcx,4), %rsi
leaq 0x1ceff7(%rip), %rdx    # 0x3b5d1e
movl $0x202, %ecx            # imm = 0x202
callq 0x104461
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x1e6d61
movq 0x20(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%rbx)
movl %r12d, (%rax,%rcx,4)
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x76427
callq 0x76460