// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, 0x10(%rsp)
movl %ecx, 0x4(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, %r12
movq %rsi, %r14
shrq $0x20, %r14
movq 0x810(%rdi), %rdi
callq 0xc444
movq %rax, %r15
movq %rax, %r13
shrq $0x20, %r13
movq %r14, %rax
movq %r14, 0x8(%rsp)
subl %ebx, %eax
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0xfffffc00, %eax       # imm = 0xFFFFFC00
jae 0x804d
movq %r12, %rdi
callq 0x73ca
movq %rax, %rbp
cmpl %ebx, %r15d
jae 0x8029
movq 0x808(%r12), %rcx
movl %r13d, %eax
xorl %edx, %edx
divl 0x1008(%rcx)
movl 0xc08(%rcx,%rax,4), %eax
leaq (%rcx,%rax,4), %rax
addq $0x804, %rax            # imm = 0x804
movl (%rax), %edx
addq $0x4, %rax
cmpl %r13d, 0x4(%rcx,%rdx,8)
jb 0x7f70
movq (%rbp,%rdx,8), %rdi
subl (%rcx,%rdx,8), %r13d
movl %r13d, %esi
callq 0x1368a
movl %eax, %r13d
subl 0x820(%r12), %r13d
incl %r15d
cmpl %ebx, %r15d
jne 0x7f4c
movl %ebx, %r15d
jmp 0x8029
movq 0x808(%r12), %rcx
movl %r13d, %eax
xorl %edx, %edx
divl 0x1008(%rcx)
movl 0xc08(%rcx,%rax,4), %eax
leaq (%rcx,%rax,4), %rdx
addq $0x804, %rdx            # imm = 0x804
movl (%rdx), %eax
addq $0x4, %rdx
cmpl %r13d, 0x4(%rcx,%rax,8)
jb 0x7fce
movl %r15d, %ecx
subl %ebx, %ecx
movq 0x18(%rsp), %rdx
movb %al, (%rdx,%rcx)
cmpb $0x0, 0x4(%rsp)
je 0x8002
movl 0x820(%r12), %edx
addl %r13d, %edx
movq 0x10(%rsp), %rsi
movl %edx, (%rsi,%rcx,4)
movq (%rbp,%rax,8), %rdi
movq 0x808(%r12), %rcx
subl (%rcx,%rax,8), %r13d
movl %r13d, %esi
callq 0x1368a
movl %eax, %r13d
subl 0x820(%r12), %r13d
incl %r15d
cmpl 0x8(%rsp), %r15d
jbe 0x7fa9
movq %rbp, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7442
cmpl %ebx, %r15d
jae 0x80ea
leaq 0x20(%rsp), %rbp
movl 0x4(%r12), %eax
cmpl %r13d, %eax
jbe 0x80c8
movq 0x808(%r12), %rcx
movl %r13d, %eax
xorl %edx, %edx
divl 0x1008(%rcx)
movl 0xc08(%rcx,%rax,4), %eax
leaq (%rcx,%rax,4), %rax
addq $0x804, %rax            # imm = 0x804
movl (%rax), %r14d
addq $0x4, %rax
cmpl %r13d, 0x4(%rcx,%r14,8)
jb 0x8089
movq 0x8(%r12,%r14,8), %rsi
movq %rbp, %rdi
callq 0x13394
movq 0x808(%r12), %rax
subl (%rax,%r14,8), %r13d
movq %rbp, %rdi
movl %r13d, %esi
callq 0x1368a
movl %eax, %r13d
movq %rbp, %rdi
callq 0x1339a
jmp 0x80d3
addl 0x820(%r12), %eax
movl %eax, %r13d
subl 0x820(%r12), %r13d
incl %r15d
cmpl %ebx, %r15d
jne 0x805b
movl %ebx, %r15d
cmpl 0x8(%rsp), %r15d
ja 0x8199
leaq 0x20(%rsp), %rbp
movq 0x808(%r12), %rcx
movl %r13d, %eax
xorl %edx, %edx
divl 0x1008(%rcx)
movl 0xc08(%rcx,%rax,4), %eax
leaq (%rcx,%rax,4), %rax
addq $0x804, %rax            # imm = 0x804
movl (%rax), %r14d
addq $0x4, %rax
cmpl %r13d, 0x4(%rcx,%r14,8)
jb 0x811e
movl %r15d, %eax
subl %ebx, %eax
movq 0x18(%rsp), %rcx
movb %r14b, (%rcx,%rax)
cmpb $0x0, 0x4(%rsp)
je 0x8154
movl 0x820(%r12), %ecx
addl %r13d, %ecx
movq 0x10(%rsp), %rdx
movl %ecx, (%rdx,%rax,4)
movq 0x8(%r12,%r14,8), %rsi
movq %rbp, %rdi
callq 0x13394
movq 0x808(%r12), %rax
subl (%rax,%r14,8), %r13d
movq %rbp, %rdi
movl %r13d, %esi
callq 0x1368a
movl %eax, %r13d
movq %rbp, %rdi
callq 0x1339a
subl 0x820(%r12), %r13d
incl %r15d
cmpl 0x8(%rsp), %r15d
jbe 0x80fa
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x81ad
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x1339a
movq %rbx, %rdi
callq 0x3460