// File: adamnovak[P]rlcsa/docarray.cpp
// Function: CSA::DocArray::reportSize(bool) const
usint
DocArray::reportSize(bool print) const
{
  usint bytes = sizeof(*this);

  usint tree_bytes = this->leaf_ranges->reportSize() +
    this->first_children->reportSize() +
    this->parents->reportSize() +
    this->next_leaves->reportSize();
  if(print)
  {
    std::cout << "Tree:            " << (tree_bytes / (double)MEGABYTE) << " MB" << std::endl;
  }

  usint rule_bytes = 0, block_bytes = 0;
  if(this->hasGrammar())
  {
    rule_bytes = this->rule_borders->reportSize() + this->rules->reportSize();
    block_bytes = this->block_borders->reportSize() + this->blocks->reportSize();
  }
  if(print && this->hasGrammar())
  {
    std::cout << "Rules:           " << (rule_bytes / (double)MEGABYTE) << " MB" << std::endl;
    std::cout << "Blocks:          " << (block_bytes / (double)MEGABYTE) << " MB" << std::endl;
  }

  bytes += tree_bytes + rule_bytes + block_bytes;
  if(print)
  {
    std::cout << "Total size:      " << (bytes / (double)MEGABYTE) << " MB" << std::endl;
    std::cout << std::endl;
  }

  return bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x50, -0x10(%rbp)
movq 0x8(%rax), %rdi
callq 0x2aa70
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, -0x30(%rbp)
movq 0x10(%rax), %rdi
callq 0x2c7a0
movl -0x30(%rbp), %ecx
movl %eax, %edx
movq -0x28(%rbp), %rax
addl %edx, %ecx
movl %ecx, -0x2c(%rbp)
movq 0x18(%rax), %rdi
callq 0x28d70
movl -0x2c(%rbp), %ecx
movl %eax, %edx
movq -0x28(%rbp), %rax
addl %edx, %ecx
movl %ecx, -0x20(%rbp)
movq 0x20(%rax), %rdi
callq 0x28d70
movl %eax, %ecx
movl -0x20(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x14(%rbp)
testb $0x1, -0x9(%rbp)
je 0x22f49
movq 0x230cd(%rip), %rdi     # 0x45fd0
leaq 0x11be4(%rip), %rsi     # 0x34aee
callq 0x32c0
movq %rax, %rdi
movl -0x14(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x1146e(%rip), %xmm1    # 0x34390
divsd %xmm1, %xmm0
callq 0x35b0
movq %rax, %rdi
leaq 0x11648(%rip), %rsi     # 0x3457d
callq 0x32c0
movq %rax, %rdi
movq 0x2306c(%rip), %rsi     # 0x45fb0
callq 0x3330
movq -0x28(%rbp), %rdi
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
callq 0x79d0
testb $0x1, %al
jne 0x22f66
jmp 0x22fb8
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2c7a0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, -0x38(%rbp)
movq 0x30(%rax), %rdi
callq 0x28d70
movl -0x38(%rbp), %ecx
movl %eax, %edx
movq -0x28(%rbp), %rax
addl %edx, %ecx
movl %ecx, -0x18(%rbp)
movq 0x38(%rax), %rdi
callq 0x2c7a0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, -0x34(%rbp)
movq 0x40(%rax), %rdi
callq 0x28d70
movl %eax, %ecx
movl -0x34(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
testb $0x1, -0x9(%rbp)
je 0x2306f
movq -0x28(%rbp), %rdi
callq 0x79d0
testb $0x1, %al
jne 0x22fd4
jmp 0x2306f
movq 0x22ff5(%rip), %rdi     # 0x45fd0
movq %rdi, -0x40(%rbp)
leaq 0x11b1a(%rip), %rsi     # 0x34b00
callq 0x32c0
movq %rax, %rdi
movl -0x18(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x1139a(%rip), %xmm1    # 0x34398
mulsd %xmm1, %xmm0
callq 0x35b0
movq %rax, %rdi
leaq 0x1156c(%rip), %rsi     # 0x3457d
callq 0x32c0
movq %rax, %rdi
movq 0x22f90(%rip), %rsi     # 0x45fb0
callq 0x3330
movq -0x40(%rbp), %rdi
leaq 0x11ae2(%rip), %rsi     # 0x34b12
callq 0x32c0
movq %rax, %rdi
movl -0x1c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x11348(%rip), %xmm1    # 0x34390
divsd %xmm1, %xmm0
callq 0x35b0
movq %rax, %rdi
leaq 0x11522(%rip), %rsi     # 0x3457d
callq 0x32c0
movq %rax, %rdi
movq 0x22f46(%rip), %rsi     # 0x45fb0
callq 0x3330
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
testb $0x1, -0x9(%rbp)
je 0x230e4
movq 0x22f45(%rip), %rdi     # 0x45fd0
leaq 0x11513(%rip), %rsi     # 0x345a5
callq 0x32c0
movq %rax, %rdi
movl -0x10(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x112e6(%rip), %xmm1    # 0x34390
divsd %xmm1, %xmm0
callq 0x35b0
movq %rax, %rdi
leaq 0x114c0(%rip), %rsi     # 0x3457d
callq 0x32c0
movq %rax, %rdi
movq 0x22ee4(%rip), %rsi     # 0x45fb0
callq 0x3330
movq 0x22ef8(%rip), %rdi     # 0x45fd0
movq 0x22ed1(%rip), %rsi     # 0x45fb0
callq 0x3330
movl -0x10(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)