// File: /workspace/github_cpp_makefile_star2_O3/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 0x155fc
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 0x155fc
movq 0x38(%r14), %rsi
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x1ab50
movq %r12, %rdi
movl %r13d, %esi
callq 0x1aca2
movl %eax, %ebp
cmpl $0x1, %r15d
jne 0x1530e
leaq 0x28(%rsp), %rdi
callq 0x1b0cc
jmp 0x1531e
addl %r13d, %r15d
leaq 0x28(%rsp), %rdi
movl %r15d, %esi
callq 0x1aca2
movl %eax, %r12d
cmpl %eax, %ebp
jae 0x155da
movb $0x1, %al
movl %eax, 0xc(%rsp)
leaq 0x18(%rsp), %r13
movl %r12d, 0x10(%rsp)
movq 0x40(%r14), %rsi
movl 0xc(%rsi), %r9d
movl %r9d, %edx
imull %ebp, %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 0x15366
movl %r9d, %eax
jmp 0x15381
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 0x1539c
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 0x155ee
movl %edi, %r15d
subl %eax, %r15d
jae 0x153df
movl %edi, 0x18(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x155bb
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x155c6
movq %r13, %rdi
callq 0x1ab50
movq %r13, %rdi
movl %r15d, %esi
callq 0x1aca2
movl %eax, %r15d
movq %r13, %rdi
callq 0x1b0cc
movl %eax, 0x8(%rsp)
movl %ebp, 0x14(%rsp)
cmpb $0x0, 0x4a(%r14)
je 0x154f4
cmpl 0x8(%rsp), %r15d
jae 0x155a3
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x30(%r14), %rsi
movl 0xc(%rsi), %r8d
movl %r8d, %edx
imull %r15d, %edx
movl %edx, %edi
shrl $0x5, %edi
andl $0x1f, %edx
movl $0x20, %ecx
subl %edx, %ecx
movl %r8d, %eax
subl %ecx, %eax
jae 0x1544d
movl %r8d, %eax
xorl %ebp, %ebp
jmp 0x15468
movq (%rsi), %rcx
movl %edi, %r8d
movl (%rcx,%r8,4), %ebp
movl %edx, %ecx
shll %cl, %ebp
shrl %cl, %ebp
movl %eax, %ecx
shll %cl, %ebp
incl %edi
movl $0x20, %ecx
testl %eax, %eax
je 0x15482
subl %eax, %ecx
movq (%rsi), %rdx
movl %edi, %esi
movl (%rdx,%rsi,4), %edx
shrl %cl, %edx
negb %al
movl %eax, %ecx
shll %cl, %edx
shrl %cl, %edx
orl %edx, %ebp
movq (%r14), %rax
cmpl 0x820(%rax), %ebp
jae 0x155e4
testb $0x1, %r12b
je 0x154da
addl %r13d, %ebp
movl %r13d, 0x4(%rsp)
cmpl %r13d, %ebp
jbe 0x154dd
movl %r13d, %eax
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x154bd
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x154ca
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0xbe04
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %ebp, %eax
jb 0x154a7
jmp 0x154dd
movl %ebp, %r13d
xorb $0x1, %r12b
incl %r15d
cmpl 0x8(%rsp), %r15d
jne 0x15421
jmp 0x155a3
cmpl 0x8(%rsp), %r15d
jae 0x155a3
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 0x1552d
movl %r9d, %eax
jmp 0x15548
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 0x15563
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 0x155e4
movl %edi, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x15588
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x15595
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0xbe04
incl %r15d
cmpl %r15d, 0x8(%rsp)
jne 0x154ff
leaq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x1ab5c
movl 0x14(%rsp), %ebp
movl 0x10(%rsp), %r12d
jmp 0x155c6
movq %rbx, %rdi
movq %r13, %rdx
callq 0xbe04
incl %ebp
cmpl %r12d, %ebp
setb %al
movl %eax, 0xc(%rsp)
jne 0x15339
jmp 0x155ee
movl $0x0, 0xc(%rsp)
jmp 0x155ee
leaq 0x18(%rsp), %rdi
callq 0x1ab5c
leaq 0x28(%rsp), %rdi
callq 0x1ab5c
movl 0xc(%rsp), %eax
andb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15617
jmp 0x15617
jmp 0x15617
jmp 0x1561e
jmp 0x1561e
movq %rax, %rbx
jmp 0x1562b
jmp 0x1561e
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1ab5c
leaq 0x28(%rsp), %rdi
callq 0x1ab5c
movq %rbx, %rdi
callq 0x3460
nop