// File: /workspace/github_cpp_makefile_star2_O1/ryanbarringtoncox[P]AVLTree/AVLTree.cpp
// Function: AVLTree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::visualPrint(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void AVLTree<T>::visualPrint(T def, T leftLeg, T rightLeg) {
	
	//make a Queue of globs, push in root at 0, 0
	list<Glob<T>*> q;
	int level=0; int spread=0;
	Glob<T>* root_glob = new Glob<T>(*root, level, spread);
	q.push_back (root_glob);
	
	//make 2d vector for glob coordinates, spread is width, level is depth
	int s; int l;
	TwoDArray<T>* tda = new TwoDArray<T>(8, 15, def);
	int spread_middle = 7;
	
	//begin level order traversal of AVLTree and insert into tda
	Node<T>* curr_node;
	while (!(q.empty())) {
		Glob<T>* curr_glob = q.front();
		curr_node = curr_glob->getNodePointer();
		if (curr_node->getLeftChild()!=0) {
			//get level, spread for left node and make a glob
			level = (curr_glob->getLevel())+2;
			spread = (curr_glob->getSpread())-2;
			Glob<T>* new_glob_left = new Glob<T>(*(curr_node->getLeftChild()), level, spread);
			q.push_back (new_glob_left);
			//insert left leg into tda
			tda->insert(level-1, spread_middle+spread+1, leftLeg);
		}
		if (curr_node->getRightChild()!=0) {
			level=(curr_glob->getLevel())+2;
			spread = (curr_glob->getSpread())+2;
			Glob<T>* new_glob_right = new Glob<T>(*(curr_node->getRightChild()), level, spread);
			q.push_back (new_glob_right);
			//insert right leg tda
			tda->insert(level-1, spread_middle+spread-1, rightLeg);			
		}		
		if (curr_node!=0) {
			l = curr_glob->getLevel();
			s = curr_glob->getSpread();
			tda->insert(l, spread_middle+s, curr_glob->getNodePointer()->getValue());
		}
		q.pop_front();	
	}
	tda->print();
	delete tda;
	delete root_glob;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rcx, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r13
movq %r13, 0x8(%r13)
movq %r13, (%r13)
movq $0x0, 0x10(%r13)
movl $0x10, %edi
callq 0x2140
movq (%r14), %rsi
movq %rax, 0x20(%rsp)
movq %rax, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7ed8
movl $0x18, %edi
callq 0x2140
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %rsp, %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
incq 0x10(%r14)
movl $0x40, %edi
callq 0x2140
movq %rax, %r15
leaq 0xa8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0x77b6
leaq 0x98(%rsp), %rcx
movq %r15, %rdi
movl $0x8, %esi
movl $0xf, %edx
callq 0x853c
movq %r15, 0x18(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x7353
movq 0xa8(%rsp), %rsi
incq %rsi
jmp 0x734e
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x7325
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2150
jmp 0x7325
movq %rax, %rbx
movl $0x40, %esi
movq %r15, %rdi
jmp 0x7655
jmp 0x7660
movq %rax, %rbx
movl $0x10, %esi
movq 0x20(%rsp), %rdi
jmp 0x7655
jmp 0x7660
callq 0x2150
movq (%rsp), %rax
movq %rsp, %rcx
cmpq %rcx, %rax
je 0x7580
movq 0x10(%rax), %rbx
movq %rbx, %rdi
callq 0x7ee4
movq (%rax), %r15
movq %r15, %rdi
callq 0x7d6e
cmpq $0x0, (%rax)
je 0x7438
movq %rbx, %rdi
callq 0x7ee8
movl %eax, %r12d
movq %rbx, %rdi
callq 0x7eec
movl %eax, %ebp
movl $0x10, %edi
callq 0x2140
movq %rax, %r14
movq %r15, %rdi
callq 0x7d6e
leal 0x2(%r12), %edx
leal -0x2(%rbp), %ecx
movq (%rax), %rsi
movq %r14, %rdi
callq 0x7ed8
movl $0x18, %edi
callq 0x2140
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %rsp, %rsi
callq 0x2050
incq 0x10(%rsp)
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x77b6
addl $0x6, %ebp
incl %r12d
movq 0x18(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x48(%rsp), %rcx
callq 0x8794
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x7438
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2150
movq %r15, %rdi
callq 0x7d7a
cmpq $0x0, (%rax)
je 0x74fe
movq %rbx, %rdi
callq 0x7ee8
movl %eax, %r12d
movq %rbx, %rdi
callq 0x7eec
movl %eax, %ebp
movl $0x10, %edi
callq 0x2140
movq %rax, %r14
movq %r15, %rdi
callq 0x7d7a
leal 0x2(%r12), %edx
leal 0x2(%rbp), %ecx
movq (%rax), %rsi
movq %r14, %rdi
callq 0x7ed8
movl $0x18, %edi
callq 0x2140
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %rsp, %rsi
callq 0x2050
incq 0x10(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x77b6
addl $0x8, %ebp
incl %r12d
movq 0x18(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x28(%rsp), %rcx
callq 0x8794
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x74fe
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x7ee8
movl %eax, %ebp
movq %rbx, %rdi
callq 0x7eec
movl %eax, %r14d
movq %rbx, %rdi
callq 0x7ee4
movq (%rax), %rsi
leaq 0x78(%rsp), %rdi
callq 0x7d2e
addl $0x7, %r14d
movq 0x18(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
leaq 0x78(%rsp), %rcx
callq 0x8794
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x7562
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2150
movq (%rsp), %rbx
decq 0x10(%rsp)
movq %rbx, %rdi
callq 0x21c0
movl $0x18, %esi
movq %rbx, %rdi
jmp 0x734e
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x8896
movq %rbx, %rdi
callq 0x876e
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2150
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x7ee2
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2150
movq (%rsp), %rdi
movq %rsp, %rax
cmpq %rax, %rdi
je 0x75e0
movq (%rdi), %rbx
movl $0x18, %esi
callq 0x2150
movq %rbx, %rdi
movq %rsp, %rax
cmpq %rax, %rbx
jne 0x75c8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7660
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x7663
movq 0x58(%rsp), %rsi
jmp 0x7643
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7663
movq 0x38(%rsp), %rsi
jmp 0x7643
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x7663
movq 0x88(%rsp), %rsi
incq %rsi
jmp 0x7655
jmp 0x764a
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
callq 0x2150
jmp 0x7663
jmp 0x7660
jmp 0x7660
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x7681
movq (%rdi), %r14
movl $0x18, %esi
callq 0x2150
movq %r14, %rdi
cmpq %r13, %r14
jne 0x766c
movq %rbx, %rdi
callq 0x21e0
nop