// File: cpottamus[P]btree_lab/btree_ds.cc
// Function: BTreeNode::Print(std::ostream&) const
ostream & BTreeNode::Print(ostream &os) const 
{
  os << "BTreeNode(info="<<info;
  if (info.nodetype!=BTREE_UNALLOCATED_BLOCK && info.nodetype!=BTREE_SUPERBLOCK) { 
    os <<", ";
    if (info.nodetype==BTREE_INTERIOR_NODE || info.nodetype==BTREE_ROOT_NODE) {
      SIZE_T ptr;
      KEY_T key;
      os << "pointers_and_values=(";
      if (info.numkeys>0) { // ==0 implies an empty root node
	for (SIZE_T i=0;i<info.numkeys;i++) {
	  GetPtr(i,ptr);
	  os<<ptr<<", ";
	  GetKey(i,key);
	  os<<key<<", ";
	}
	GetPtr(info.numkeys,ptr);
	os <<ptr;
      } 
      os << ")";
	
    }
    if (info.nodetype==BTREE_LEAF_NODE) { 
      KEY_T key;
      VALUE_T val;
      os << "keys_and_values=(";
      for (SIZE_T i=0;i<info.numkeys;i++) {
	if (i>0) { 
	  os<<", ";
	}
	GetKey(i,key);
	os<<key<<", ";
	GetVal(i,val);
	os<<val;
      }
      os <<")";
    }
  }
  os <<")";
  return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1210(%rip), %rsi      # 0x10b49
callq 0x31f0
movq -0xb0(%rbp), %rsi
movq %rax, %rdi
callq 0xfc50
movq -0xb0(%rbp), %rax
cmpl $0x0, (%rax)
je 0xfc24
movq -0xb0(%rbp), %rax
cmpl $0x1, (%rax)
je 0xfc24
movq -0x10(%rbp), %rdi
leaq 0xd0b(%rip), %rsi       # 0x10683
callq 0x31f0
movq -0xb0(%rbp), %rax
cmpl $0x3, (%rax)
je 0xf999
movq -0xb0(%rbp), %rax
cmpl $0x2, (%rax)
jne 0xfac4
leaq -0x40(%rbp), %rdi
callq 0x43e0
movq -0x10(%rbp), %rdi
leaq 0x11ac(%rip), %rsi      # 0x10b59
callq 0x31f0
jmp 0xf9b4
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jbe 0xfaa9
movl $0x0, -0x50(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x50(%rbp), %eax
cmpl 0x18(%rcx), %eax
jae 0xfa86
movq -0xb0(%rbp), %rdi
movl -0x50(%rbp), %esi
leaq -0x14(%rbp), %rdx
callq 0xf650
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3320
movq %rax, -0xb8(%rbp)
jmp 0xfa07
movq -0xb8(%rbp), %rdi
leaq 0xc6e(%rip), %rsi       # 0x10683
callq 0x31f0
jmp 0xfa1c
movq -0xb0(%rbp), %rdi
movl -0x50(%rbp), %esi
leaq -0x40(%rbp), %rdx
callq 0xf5d0
jmp 0xfa31
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4050
movq %rax, -0xc0(%rbp)
jmp 0xfa47
movq -0xc0(%rbp), %rdi
leaq 0xc2e(%rip), %rsi       # 0x10683
callq 0x31f0
jmp 0xfa5c
jmp 0xfa5e
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xf9cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x46e0
jmp 0xfc41
movq -0xb0(%rbp), %rdi
movl 0x18(%rdi), %esi
leaq -0x14(%rbp), %rdx
callq 0xf650
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3320
jmp 0xfaa7
jmp 0xfaa9
movq -0x10(%rbp), %rdi
leaq 0xca9(%rip), %rsi       # 0x1075d
callq 0x31f0
jmp 0xfabb
leaq -0x40(%rbp), %rdi
callq 0x46e0
movq -0xb0(%rbp), %rax
cmpl $0x4, (%rax)
jne 0xfc22
leaq -0x78(%rbp), %rdi
callq 0x43e0
leaq -0xa0(%rbp), %rdi
callq 0x43e0
jmp 0xfaeb
movq -0x10(%rbp), %rdi
leaq 0x1079(%rip), %rsi      # 0x10b6f
callq 0x31f0
jmp 0xfafd
movl $0x0, -0xa4(%rbp)
movq -0xb0(%rbp), %rcx
movl -0xa4(%rbp), %eax
cmpl 0x18(%rcx), %eax
jae 0xfbee
cmpl $0x0, -0xa4(%rbp)
jbe 0xfb68
movq -0x10(%rbp), %rdi
leaq 0xb52(%rip), %rsi       # 0x10683
callq 0x31f0
jmp 0xfb38
jmp 0xfb68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xfc17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x46e0
jmp 0xfc17
movq -0xb0(%rbp), %rdi
movl -0xa4(%rbp), %esi
leaq -0x78(%rbp), %rdx
callq 0xf5d0
jmp 0xfb80
movq -0x10(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4050
movq %rax, -0xc8(%rbp)
jmp 0xfb96
movq -0xc8(%rbp), %rdi
leaq 0xadf(%rip), %rsi       # 0x10683
callq 0x31f0
jmp 0xfbab
movq -0xb0(%rbp), %rdi
movl -0xa4(%rbp), %esi
leaq -0xa0(%rbp), %rdx
callq 0xf6a0
jmp 0xfbc6
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4050
jmp 0xfbd8
jmp 0xfbda
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0xfb07
movq -0x10(%rbp), %rdi
leaq 0xb64(%rip), %rsi       # 0x1075d
callq 0x31f0
jmp 0xfc00
leaq -0xa0(%rbp), %rdi
callq 0x46e0
leaq -0x78(%rbp), %rdi
callq 0x46e0
jmp 0xfc22
leaq -0x78(%rbp), %rdi
callq 0x46e0
jmp 0xfc41
jmp 0xfc24
movq -0x10(%rbp), %rdi
leaq 0xb2e(%rip), %rsi       # 0x1075d
callq 0x31f0
movq -0x10(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3400
nopw (%rax,%rax)