// File: adamnovak[P]rlcsa/rlcsa.cpp
// Function: CSA::RLCSA::displayUnsafe(std::pair<unsigned int, unsigned int>, unsigned char*, bool, unsigned int*) const
void
RLCSA::displayUnsafe(pair_type range, uchar* data, bool get_ranks, usint* ranks) const
{
  pair_type res = this->sa_samples->inverseSA(range.first);
  usint i = res.first, pos = res.second;

  if(length(range) >= 1024)
  {
    PsiVector::Iterator** iters = this->getIterators();
    for(; i < range.first; i++)
    {
      pos = this->psi(pos, iters) - this->number_of_sequences;
    }
    for(; i <= range.second; i++)
    {
      usint c = this->getCharacter(pos);
      data[i - range.first] = c;
      if(get_ranks) { ranks[i - range.first] = pos + this->number_of_sequences; }
      pos = this->psiUnsafe(pos, c, *(iters[c])) - this->number_of_sequences;
    }
    this->deleteIterators(iters);
  }
  else
  {
    for(; i < range.first; i++)
    {
      pos = this->psi(pos) - this->number_of_sequences;
    }
    for(; i <= range.second; i++)
    {
      usint c = this->getCharacter(pos);
      data[i - range.first] = c;
      if(get_ranks) { ranks[i - range.first] = pos + this->number_of_sequences; }
      pos = this->psiUnsafe(pos, c) - this->number_of_sequences;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %cl, %al
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq 0x810(%rax), %rdi
movl -0x8(%rbp), %esi
callq 0x14b50
movq %rax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0xdc40
cmpl $0x400, %eax            # imm = 0x400
jb 0xa7b2
movq -0x58(%rbp), %rdi
callq 0x9860
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0xa71f
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
movq -0x48(%rbp), %rdx
callq 0xe1a0
movq -0x58(%rbp), %rcx
subl 0x820(%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa6ef
jmp 0xa721
movl -0x34(%rbp), %eax
cmpl -0x4(%rbp), %eax
ja 0xa7a0
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0xe0c0
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
subl -0x8(%rbp), %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
testb $0x1, -0x19(%rbp)
je 0xa76e
movq -0x58(%rbp), %rax
movl -0x38(%rbp), %edx
addl 0x820(%rax), %edx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
subl -0x8(%rbp), %ecx
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
movl -0x4c(%rbp), %edx
movq -0x48(%rbp), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
callq 0xe210
movq -0x58(%rbp), %rcx
subl 0x820(%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa721
movq -0x58(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x9930
jmp 0xa858
jmp 0xa7b4
movl -0x34(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0xa7e0
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0xde60
movq -0x58(%rbp), %rcx
subl 0x820(%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa7b4
jmp 0xa7e2
movl -0x34(%rbp), %eax
cmpl -0x4(%rbp), %eax
ja 0xa856
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0xe0c0
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
subl -0x8(%rbp), %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
testb $0x1, -0x19(%rbp)
je 0xa82f
movq -0x58(%rbp), %rax
movl -0x38(%rbp), %edx
addl 0x820(%rax), %edx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
subl -0x8(%rbp), %ecx
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %esi
movl -0x50(%rbp), %edx
callq 0xe0f0
movq -0x58(%rbp), %rcx
subl 0x820(%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa7e2
jmp 0xa858
addq $0x60, %rsp
popq %rbp
retq
nop