// File: /workspace/github_cpp_makefile_star2_O1/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 0x153d5
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %r13d
movq %rdi, %r14
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movl 0x4(%rcx), %ecx
addl 0x4(%rdx), %ecx
cmpl %esi, %ecx
jbe 0x153d5
movq 0x38(%r14), %rsi
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x1a636
movq %r12, %rdi
movl %r13d, %esi
callq 0x1a788
movl %eax, %r12d
cmpl $0x1, %r15d
jne 0x150c1
leaq 0x28(%rsp), %rdi
callq 0x1abaa
jmp 0x150d1
addl %r13d, %r15d
leaq 0x28(%rsp), %rdi
movl %r15d, %esi
callq 0x1a788
movl %eax, %r13d
cmpl %eax, %r12d
setb %al
movl %eax, 0xc(%rsp)
jae 0x153c7
movl %r13d, 0x4(%rsp)
movq %r14, 0x10(%rsp)
movq 0x40(%r14), %rsi
movl 0xc(%rsi), %r9d
movl %r9d, %edx
imull %r12d, %edx
movl %edx, %r8d
shrl $0x5, %r8d
andl $0x1f, %edx
movl $0x20, %ecx
subl %edx, %ecx
xorl %edi, %edi
movl %r9d, %eax
subl %ecx, %eax
jae 0x1511c
movl %r9d, %eax
jmp 0x15137
movq (%rsi), %rcx
movl %r8d, %edi
movl (%rcx,%rdi,4), %edi
movl %edx, %ecx
shll %cl, %edi
shrl %cl, %edi
movl %eax, %ecx
shll %cl, %edi
incl %r8d
movl $0x20, %ecx
testl %eax, %eax
je 0x15152
subl %eax, %ecx
movq (%rsi), %rdx
movl %r8d, %esi
movl (%rdx,%rsi,4), %edx
shrl %cl, %edx
negb %al
movl %eax, %ecx
shll %cl, %edx
shrl %cl, %edx
orl %edx, %edi
movq (%r14), %rax
movq 0x28(%r14), %rsi
movl 0x820(%rax), %eax
movl 0x4(%rsi), %ecx
addl %eax, %ecx
cmpl %ecx, %edi
jae 0x153c7
movl %edi, %r15d
subl %eax, %r15d
jae 0x15195
movl %edi, 0x18(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x15370
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x153b4
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x1a636
movq %rbp, %rdi
movl %r15d, %esi
callq 0x1a788
movl %eax, %r15d
movq %rbp, %rdi
callq 0x1abaa
movl %eax, %ebp
cmpl %eax, %r15d
setb %sil
cmpb $0x0, 0x4a(%r14)
je 0x152c6
cmpl %ebp, %r15d
jae 0x1537f
movl %r12d, 0x8(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movl %ebp, %r14d
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rdi
movl 0xc(%rdi), %r9d
movl %r9d, %edx
imull %r15d, %edx
movl %edx, %r8d
shrl $0x5, %r8d
andl $0x1f, %edx
movl $0x20, %ecx
subl %edx, %ecx
movl %r9d, %eax
subl %ecx, %eax
jae 0x15216
movl %r9d, %eax
xorl %ebp, %ebp
jmp 0x15232
movq (%rdi), %rcx
movl %r8d, %r9d
movl (%rcx,%r9,4), %ebp
movl %edx, %ecx
shll %cl, %ebp
shrl %cl, %ebp
movl %eax, %ecx
shll %cl, %ebp
incl %r8d
movl $0x20, %ecx
testl %eax, %eax
je 0x1524d
subl %eax, %ecx
movq (%rdi), %rdx
movl %r8d, %edi
movl (%rdx,%rdi,4), %edx
shrl %cl, %edx
negb %al
movl %eax, %ecx
shll %cl, %edx
shrl %cl, %edx
orl %edx, %ebp
movq 0x10(%rsp), %rax
movq (%rax), %rax
cmpl 0x820(%rax), %ebp
jae 0x1538a
testb $0x1, %r12b
je 0x152a5
addl %r13d, %ebp
movl %r13d, (%rsp)
cmpl %r13d, %ebp
jbe 0x152a8
movl %r13d, %eax
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x1528c
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x15297
movq %rbx, %rdi
movq %rsp, %rdx
callq 0xbd24
movl (%rsp), %eax
incl %eax
movl %eax, (%rsp)
cmpl %ebp, %eax
jb 0x15276
jmp 0x152a8
movl %ebp, %r13d
xorb $0x1, %r12b
incl %r15d
movl %r14d, %ebp
cmpl %r14d, %r15d
setb %sil
jne 0x151e0
xorl %ebp, %ebp
jmp 0x1538f
cmpl %ebp, %r15d
jae 0x153a4
movq 0x30(%r14), %rsi
movl 0xc(%rsi), %r9d
movl %r9d, %edx
imull %r15d, %edx
movl %edx, %r8d
shrl $0x5, %r8d
andl $0x1f, %edx
movl $0x20, %ecx
subl %edx, %ecx
xorl %edi, %edi
movl %r9d, %eax
subl %ecx, %eax
jae 0x152fd
movl %r9d, %eax
jmp 0x15318
movq (%rsi), %rcx
movl %r8d, %edi
movl (%rcx,%rdi,4), %edi
movl %edx, %ecx
shll %cl, %edi
shrl %cl, %edi
movl %eax, %ecx
shll %cl, %edi
incl %r8d
movl $0x20, %ecx
testl %eax, %eax
je 0x15333
subl %eax, %ecx
movq (%rsi), %rdx
movl %r8d, %esi
movl (%rdx,%rsi,4), %edx
shrl %cl, %edx
negb %al
movl %eax, %ecx
shll %cl, %edx
shrl %cl, %edx
orl %edx, %edi
movq (%r14), %rax
cmpl 0x820(%rax), %edi
jae 0x15383
movl %edi, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x15357
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x15362
movq %rbx, %rdi
movq %rsp, %rdx
callq 0xbd24
incl %r15d
cmpl %r15d, %ebp
jne 0x152cf
jmp 0x153a4
movq %rbx, %rdi
leaq 0x18(%rsp), %rdx
callq 0xbd24
jmp 0x153b4
xorl %ebp, %ebp
jmp 0x1539e
movl $0x1, %ebp
jmp 0x153a6
movl $0x1, %ebp
movl 0x8(%rsp), %r12d
movl 0x4(%rsp), %r13d
movq 0x10(%rsp), %r14
testb $0x1, %sil
jne 0x153a6
xorl %ebp, %ebp
leaq 0x18(%rsp), %rdi
callq 0x1a642
testl %ebp, %ebp
jne 0x153c7
incl %r12d
cmpl %r13d, %r12d
setb %al
movl %eax, 0xc(%rsp)
jne 0x150ee
leaq 0x28(%rsp), %rdi
callq 0x1a642
movl 0xc(%rsp), %eax
andb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x153f0
jmp 0x153f0
jmp 0x153f0
jmp 0x153f7
jmp 0x153f7
movq %rax, %rbx
jmp 0x15404
jmp 0x153f7
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1a642
leaq 0x28(%rsp), %rdi
callq 0x1a642
movq %rbx, %rdi
callq 0x3460