// File: adamnovak[P]rlcsa/./docarray.h
// Function: std::vector<unsigned int, std::allocator<unsigned int>>* CSA::DocArray::documentListing<unsigned int>(std::pair<unsigned int, unsigned int>) const
std::vector<T>*
    documentListing(pair_type range) const
    {
      std::vector<T>* result = new std::vector<T>;
      DeltaVector::Iterator block_iter(*(this->leaf_ranges));

      // Process the part of the range before the first full block.
      pair_type first_block = block_iter.valueAfter(range.first);
      if(first_block.first > range.first)
      {
        usint temp = std::min(range.second, first_block.first - 1);
        this->processRange(pair_type(range.first, temp), *result);
        if(range.second <= temp) { return result; }
      }
      range.first = first_block.second;

      // Process the part of the range after the last full block.
      pair_type last_block = block_iter.valueBefore(range.second);
      pair_type next_block = block_iter.nextValue();
      if(range.second < next_block.first - 1)
      {
        this->processRange(pair_type(last_block.first, range.second), *result);
        if(first_block.second >= last_block.second) { return result; }
        last_block.second--;
      }
      range.second = last_block.second;

      // Process the full blocks.
      SuccinctVector::Iterator child_iter(*(this->first_children));
      usint prev_block = this->getNumberOfNodes(), run = 0;
      for(usint i = range.first; i <= range.second; )
      {
        usint next_leaf = i + 1;
        while(child_iter.isSet(i))  // Current block is the leftmost child of its parent.
        {
          pair_type parent = this->parentOf(i, child_iter);
          if(parent.second <= range.second + 1) // Range contains the subtree of the parent.
          {
            i = parent.first; next_leaf = parent.second;
          }
          else { break; }
        }
        if(i == prev_block + run) { run++; }
        else
        {
          if(this->addBlocks(prev_block, run, *result)) { delete result; return this->allDocuments<T>(); }
          prev_block = i; run = 1;
        }
        i = next_leaf;
      }
      if(this->addBlocks(prev_block, run, *result)) { delete result; return this->allDocuments<T>(); }

      return result;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0x18, %edi
callq 0x32e0
movq %rax, %rdi
movq %rdi, -0x120(%rbp)
callq 0x10bc0
movq -0x120(%rbp), %rcx
movq -0x118(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq 0x8(%rax), %rsi
leaq -0x98(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x2aaa0
movq -0x110(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x2ae20
movq %rax, -0x108(%rbp)
jmp 0x23bd8
movq -0x108(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x10(%rbp), %eax
jbe 0x23c98
leaq -0xc(%rbp), %rdi
movl -0xa0(%rbp), %eax
decl %eax
movl %eax, -0xb4(%rbp)
leaq -0xb4(%rbp), %rsi
callq 0x75b0
movq %rax, -0x128(%rbp)
jmp 0x23c1c
movq -0x128(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xb0(%rbp)
leaq -0xbc(%rbp), %rdi
leaq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x7710
jmp 0x23c44
movq -0x118(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0xbc(%rbp), %rsi
callq 0x24510
jmp 0x23c5d
movl -0xc(%rbp), %eax
cmpl -0xb0(%rbp), %eax
ja 0x23c96
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x24006
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x2401f
jmp 0x23c98
movl -0x9c(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %esi
leaq -0x98(%rbp), %rdi
callq 0x2ad10
movq %rax, -0x130(%rbp)
jmp 0x23cb9
movq -0x130(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x2af10
movq %rax, -0x138(%rbp)
jmp 0x23cdc
movq -0x138(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl -0xc(%rbp), %eax
movl -0xd0(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x23d60
leaq -0xc(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x7710
jmp 0x23d13
movq -0x118(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0xd8(%rbp), %rsi
callq 0x24510
jmp 0x23d2c
movl -0x9c(%rbp), %eax
cmpl -0xc4(%rbp), %eax
jb 0x23d51
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x24006
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
movq -0x118(%rbp), %rax
movl -0xc4(%rbp), %ecx
movl %ecx, -0xc(%rbp)
movq 0x10(%rax), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2c7d0
jmp 0x23d82
movq -0x118(%rbp), %rdi
callq 0x7970
movl %eax, -0x13c(%rbp)
jmp 0x23d96
movl -0x13c(%rbp), %eax
movl %eax, -0xec(%rbp)
movl $0x0, -0xf0(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
cmpl -0xc(%rbp), %eax
ja 0x23f5e
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf8(%rbp)
movl -0xf4(%rbp), %esi
leaq -0xe8(%rbp), %rdi
callq 0x2ce40
movb %al, -0x13d(%rbp)
jmp 0x23ded
movb -0x13d(%rbp), %al
testb $0x1, %al
jne 0x23dfc
jmp 0x23e80
movq -0x118(%rbp), %rdi
movl -0xf4(%rbp), %esi
leaq -0xe8(%rbp), %rdx
callq 0x26410
movq %rax, -0x148(%rbp)
jmp 0x23e1e
movq -0x148(%rbp), %rax
movq %rax, -0x100(%rbp)
movl -0xfc(%rbp), %eax
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
ja 0x23e79
movl -0x100(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0xfc(%rbp), %eax
movl %eax, -0xf8(%rbp)
jmp 0x23e7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x2c7f0
jmp 0x2401f
jmp 0x23e80
jmp 0x23dd3
movl -0xf4(%rbp), %eax
movl -0xec(%rbp), %ecx
addl -0xf0(%rbp), %ecx
cmpl %ecx, %eax
jne 0x23eaa
movl -0xf0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf0(%rbp)
jmp 0x23f4d
movq -0x118(%rbp), %rdi
movl -0xec(%rbp), %esi
movl -0xf0(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0x264a0
movb %al, -0x149(%rbp)
jmp 0x23ece
movb -0x149(%rbp), %al
testb $0x1, %al
jne 0x23eda
jmp 0x23f37
movq -0x20(%rbp), %rax
movq %rax, -0x158(%rbp)
cmpq $0x0, %rax
je 0x23f08
movq -0x158(%rbp), %rdi
callq 0x1c250
movq -0x158(%rbp), %rdi
movl $0x18, %esi
callq 0x32f0
movq -0x118(%rbp), %rdi
callq 0x26880
movq %rax, -0x160(%rbp)
jmp 0x23f1d
movq -0x160(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x23ffa
movl -0xf4(%rbp), %eax
movl %eax, -0xec(%rbp)
movl $0x1, -0xf0(%rbp)
movl -0xf8(%rbp), %eax
movl %eax, -0xf4(%rbp)
jmp 0x23db5
movq -0x118(%rbp), %rdi
movl -0xec(%rbp), %esi
movl -0xf0(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0x264a0
movb %al, -0x161(%rbp)
jmp 0x23f82
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x23f8e
jmp 0x23fe8
movq -0x20(%rbp), %rax
movq %rax, -0x170(%rbp)
cmpq $0x0, %rax
je 0x23fbc
movq -0x170(%rbp), %rdi
callq 0x1c250
movq -0x170(%rbp), %rdi
movl $0x18, %esi
callq 0x32f0
movq -0x118(%rbp), %rdi
callq 0x26880
movq %rax, -0x178(%rbp)
jmp 0x23fd1
movq -0x178(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x23ffa
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xc0(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x2c7f0
leaq -0x98(%rbp), %rdi
callq 0x2aad0
movq -0x8(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x98(%rbp), %rdi
callq 0x2aad0
movq -0xa8(%rbp), %rdi
callq 0x3570
nopw (%rax,%rax)