// File: adamnovak[P]rlcsa/docarray.cpp
// Function: CSA::STNode::verifyTree()
bool
STNode::verifyTree()
{
  if(this->child == 0) { return true; }

  usint expect = this->range.first, last = 0;
  for(STNode* temp = this->child; temp != 0; temp = temp->sibling)
  {
    if(!(temp->verifyTree())) { return false; }
    if(temp->range.first != expect)
    {
      std::cerr << "Error: node " << *this << ", expected " << expect << ", got " << *temp << std::endl;
      std::cerr << "Children:";
      for(temp = this->child; temp != 0; temp = temp->sibling) { std::cerr << " " << *temp; }
      std::cerr << std::endl;
      if(this->parent) { std::cerr << "Parent: " << *(this->parent) << std::endl; }
      return false;
    }
    expect = temp->range.second + 1;
    last = temp->range.second;
  }
  if(last != this->range.second)
  {
    std::cerr << "Error: node " << *this << ", children end at " << last << std::endl;
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, 0x18(%rax)
jne 0x1f344
movb $0x1, -0x1(%rbp)
jmp 0x1f523
movq -0x28(%rbp), %rax
movl 0x4(%rax), %ecx
movl %ecx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1f4c5
movq -0x20(%rbp), %rdi
callq 0x1f320
testb $0x1, %al
jne 0x1f37e
movb $0x0, -0x1(%rbp)
jmp 0x1f523
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x1f49d
movq 0x26c5b(%rip), %rdi     # 0x45ff0
leaq 0x15558(%rip), %rsi     # 0x348f4
callq 0x32c0
movq -0x28(%rbp), %rsi
movq %rax, %rdi
callq 0x1f530
movq %rax, %rdi
leaq 0x1554a(%rip), %rsi     # 0x34901
callq 0x32c0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x3420
movq %rax, %rdi
leaq 0x1553c(%rip), %rsi     # 0x3490d
callq 0x32c0
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x1f530
movq %rax, %rdi
movq 0x26bc4(%rip), %rsi     # 0x45fb0
callq 0x3330
movq 0x26bf8(%rip), %rdi     # 0x45ff0
leaq 0x15515(%rip), %rsi     # 0x34914
callq 0x32c0
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1f444
movq 0x26bd2(%rip), %rdi     # 0x45ff0
leaq 0x154a1(%rip), %rsi     # 0x348c6
callq 0x32c0
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x1f530
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x1f410
movq 0x26ba5(%rip), %rdi     # 0x45ff0
movq 0x26b5e(%rip), %rsi     # 0x45fb0
callq 0x3330
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1f494
movq 0x26b87(%rip), %rdi     # 0x45ff0
leaq 0x154ae(%rip), %rsi     # 0x3491e
callq 0x32c0
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1f530
movq %rax, %rdi
movq 0x26b21(%rip), %rsi     # 0x45fb0
callq 0x3330
movb $0x0, -0x1(%rbp)
jmp 0x1f523
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x1f35d
movq -0x28(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x8(%rcx), %eax
je 0x1f51f
movq 0x26b18(%rip), %rdi     # 0x45ff0
leaq 0x15415(%rip), %rsi     # 0x348f4
callq 0x32c0
movq -0x28(%rbp), %rsi
movq %rax, %rdi
callq 0x1f530
movq %rax, %rdi
leaq 0x1542d(%rip), %rsi     # 0x34927
callq 0x32c0
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x3420
movq %rax, %rdi
movq 0x26a9c(%rip), %rsi     # 0x45fb0
callq 0x3330
movb $0x0, -0x1(%rbp)
jmp 0x1f523
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nop