// File: /workspace/github_cpp_makefile_star2_O2/adamnovak[P]rlcsa/./docarray.h
// Function: bool CSA::DocArray::addBlocks<unsigned int>(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int>>&) const
bool
    addBlocks(usint first, usint number, std::vector<T>& result) const
    {
      if(first >= this->getNumberOfNodes() || number == 0) { return false; }

      SuccinctVector::Iterator iter(*(this->block_borders));
      usint from = iter.select(first);
      usint to = (number == 1 ? iter.selectNext() : iter.select(first + number));

      for(usint i = from; i < to; i++)
      {
        usint val = this->blocks->readItemConst(i);
        if(val >= this->maxInteger()) { return true; }  // Block contains all documents.
        if(val < this->getNumberOfDocuments()) // Value is a document id.
        {
          this->addItem(val, result);
        }
        else  // Value is a rule id.
        {
          val -= this->getNumberOfDocuments();
          SuccinctVector::Iterator rule_iter(*(this->rule_borders));
          usint rfrom = rule_iter.select(val);
          usint rto = rule_iter.selectNext();

          if(this->usesRLE())
          {
            usint run_start = 0;
            bool want_run_length = false;
            for(usint j = rfrom; j < rto; j++)
            {
              val = this->rules->readItemConst(j);
              if(val >= this->getNumberOfDocuments()) { return true; }  // Rule covers all documents.
              else if(want_run_length) { this->addRun(run_start, val, result); want_run_length = false; }
              else { run_start = val; want_run_length = true; }
            }
          }
          else
          {
            for(usint j = rfrom; j < rto; j++)
            {
              val = this->rules->readItemConst(j);
              if(val >= this->getNumberOfDocuments()) { return true; }  // Rule covers all documents.
              else { this->addItem(val, result); }
            }
          }
        }
      }

      return false;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %eax, %eax
testl %edx, %edx
je 0x1196c
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movl 0x4(%rcx), %ecx
addl 0x4(%rdx), %ecx
cmpl %esi, %ecx
jbe 0x1196c
movq 0x38(%r14), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x14ae6
movq %r12, %rdi
movl %r15d, %esi
callq 0x14bd6
movl %eax, %r12d
cmpl $0x1, %ebp
jne 0x11835
leaq 0x18(%rsp), %rdi
callq 0x14d6a
movl %eax, 0xc(%rsp)
jmp 0x11848
addl %r15d, %ebp
leaq 0x18(%rsp), %rdi
movl %ebp, %esi
callq 0x14bd6
movl %eax, 0xc(%rsp)
leaq 0x28(%rsp), %r15
cmpl 0xc(%rsp), %r12d
setb %al
movl %eax, 0x14(%rsp)
jae 0x1195e
movq 0x40(%r14), %rdi
movl %r12d, %esi
callq 0x9b42
movq (%r14), %rcx
movq 0x28(%r14), %rsi
movl 0x820(%rcx), %ecx
movl 0x4(%rsi), %edx
addl %ecx, %edx
cmpl %edx, %eax
jae 0x1195e
movl %eax, %ebp
subl %ecx, %ebp
jae 0x1189d
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq 0x119ea
jmp 0x1194c
movq %r15, %rdi
callq 0x14ae6
movq %r15, %rdi
movl %ebp, %esi
callq 0x14bd6
movl %eax, %r13d
movq %r15, %rdi
callq 0x14d6a
movl %eax, %r15d
movl %r12d, 0x10(%rsp)
cmpb $0x0, 0x4a(%r14)
je 0x1190c
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpl %r15d, %r13d
jae 0x1193a
movq 0x30(%r14), %rdi
movl %r13d, %esi
callq 0x9b42
movq (%r14), %rcx
cmpl 0x820(%rcx), %eax
jae 0x11954
testb $0x1, %r12b
je 0x11901
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %edx
movq %rbx, %rcx
callq 0x11a00
jmp 0x11903
movl %eax, %ebp
xorb $0x1, %r12b
incl %r13d
jmp 0x118ce
cmpl %r15d, %r13d
jae 0x1193a
movq 0x30(%r14), %rdi
movl %r13d, %esi
callq 0x9b42
movq (%r14), %rcx
cmpl 0x820(%rcx), %eax
jae 0x11954
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq 0x119ea
incl %r13d
jmp 0x1190c
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x14aee
movl 0x10(%rsp), %r12d
incl %r12d
jmp 0x1184d
leaq 0x28(%rsp), %rdi
callq 0x14aee
leaq 0x18(%rsp), %rdi
callq 0x14aee
movl 0x14(%rsp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11985
jmp 0x11985
jmp 0x1198c
jmp 0x1198c
jmp 0x11985
movq %rax, %rbx
jmp 0x11999
jmp 0x1198c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x14aee
leaq 0x18(%rsp), %rdi
callq 0x14aee
movq %rbx, %rdi
callq 0x3430
nop