// File: /workspace/github_c_makefile_star2_O2/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 %rdi, %rbx
andq $0x0, 0x20(%rdi)
movq %rsi, %r15
xorl %ebp, %ebp
pushq $0x1
popq %r14
movl %ebp, %r12d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x195fa6
movq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rdx
testb %al, %al
jne 0x195ee2
cmpq %rcx, %rdx
jae 0x195da0
movq 0x10(%rbx), %rax
jmp 0x195dcc
leaq 0x80(%rcx), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x200(,%rcx,4), %rsi
leaq 0x1c03c0(%rip), %rdx    # 0x35617e
movl $0x1d0, %ecx            # imm = 0x1D0
callq 0x93472
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x195f40
movq 0x20(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%rbx)
movl %r12d, (%rax,%rcx,4)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x196880
movq %rax, %r13
movq 0x70(%rbx), %rcx
testq %rcx, %rcx
je 0x195e0c
addq %r15, %rcx
movq 0x60(%rbx), %rax
cmpq %rax, %rcx
cmovaeq %rax, %rcx
jmp 0x195e13
movq 0x60(%rbx), %rax
movq %rax, %rcx
addq %r15, %r13
cmpq %rcx, %r13
jae 0x195e6f
cmpb $0x0, 0x78(%rbx)
jne 0x195e5c
cmpb $0x1, 0x7a(%rbx)
jne 0x195e5c
movl 0x58(%rbx), %edx
movl %edx, %ecx
orl $0x2, %ecx
cmpl $0x3, %ecx
jne 0x195e48
movq %r13, %rsi
notq %rsi
addq %rsi, %rax
cmpq (%rsp), %rax
jae 0x195e4e
cmpl $0x3, %ecx
je 0x195e6f
cmpq (%rsp), %r13
jae 0x195e6f
movq 0x40(%rbx), %rdi
movq %r13, %rsi
callq 0x70bf6
jmp 0x195e7a
movq 0x40(%rbx), %rdi
movl 0x58(%rbx), %edx
movq %r13, %rsi
callq 0x705e4
cmpb $-0x2, %al
jb 0x195e7a
subq $-0x100, %r13
jae 0x195e7e
jmp 0x195ec9
movzbl %al, %r13d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x196820
movl %eax, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x196f80
cmpq %r13, %rax
movl $0x0, %ecx
sbbl %ecx, %ecx
cmpq %r13, %rax
cmoval %r14d, %ecx
testl %ecx, %ecx
je 0x195ec1
cmpl $0x1, %ecx
je 0x195ec9
movq %rbx, %rdi
movl %ebp, %esi
callq 0x196a13
movl %eax, %ebp
testl %eax, %eax
jne 0x195e8b
jmp 0x195ec9
testl %ebp, %ebp
jne 0x195d78
movq %rbx, %rdi
movl %r12d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x196f14
cmpq %rcx, %rdx
jae 0x195eed
movq 0x10(%rbx), %rax
jmp 0x195f19
leaq 0x80(%rcx), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x200(,%rcx,4), %rsi
leaq 0x1c0273(%rip), %rdx    # 0x35617e
movl $0x202, %ecx            # imm = 0x202
callq 0x93472
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x195f78
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
movq 0x2a2021(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x14f0c2(%rip), %rsi    # 0x2e5013
leaq 0x1c03c4(%rip), %rdx    # 0x35631c
leaq 0x1c0735(%rip), %rcx    # 0x356694
leaq 0x1c0218(%rip), %r8     # 0x35617e
movl $0x1d0, %r9d            # imm = 0x1D0
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2a1fe9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x14f08a(%rip), %rsi    # 0x2e5013
leaq 0x1c038c(%rip), %rdx    # 0x35631c
leaq 0x1c06fd(%rip), %rcx    # 0x356694
leaq 0x1c01e0(%rip), %r8     # 0x35617e
movl $0x202, %r9d            # imm = 0x202
jmp 0x195f6c