// File: /workspace/github_cpp_makefile_star2_O2/ambersun1234[P]AVL_Tree/src/avl_tree.cpp
// Function: main
int main( int argc , const char *argv[] ) {
	AVLTree< int > myAVLTree;
	string command;
	int input;

	while ( true ) {
		menu();
		cout << "> ";
		cin >> command;

		if ( command == "a" || command == "A" ) { // done
			cout << "please enter the number for add: ";
			cin >> input;
			if ( myAVLTree.insertHelper( input ) ) cout << "add successfully" << endl;
			else cout << "add failed" << endl;
		}
		else if ( command == "c" || command == "C" ) {
			myAVLTree.clearTreeHelper();
			cout << "clear tree done" << endl;
		}
		else if ( command == "r" || command == "R" ) {
			cout << "please enter the number to remove: ";
			cin >> input;
			if ( myAVLTree.removeHelper( input ) ) cout << "removed successfully" << endl;
			else cout << "removed failed" << endl;
		}
		else if ( command == "f" || command == "F" ) {
			cout << "please enter the number to find: ";
			cin >> input;
			cout << "the predecessor is " << myAVLTree.findPredecessorHelper( input ) << endl;
		}
		else if ( command == "t" || command == "T" ) { // done
			cout << "inorder traversal:";
			myAVLTree.inorderTraversalHelper( display );
			cout << endl;
			cout << "preorder traversal:";
			myAVLTree.preorderTraversalHelper( display );
			cout << endl;
			cout << "postorder traversal:";
			myAVLTree.postorderTraversalHelper( display );
			cout << endl;
			cout << "levelorder traversal:";
			myAVLTree.levelorderTraversalHelper( display );
			cout << endl;
		}
		else if ( command == "n" || command == "N" ) { // done
			cout << "the AVL Tree contain " << myAVLTree.getNumberOfNodesHelper() << " nodes" << endl;
		}
		else if ( command == "s" || command == "S" ) { // done
			cout << "please enter the number to search: ";
			cin >> input;
			if ( myAVLTree.searchHelper( input ) ) cout << "target found" << endl;
			else cout << "failed to find target in the AVL Tree" << endl;
		}
		else if ( command == "x" || command == "X" ) {
			cout << "see you~~ bye~~" << endl;
			break;
		}
		else {
			cout << "input error , please enter the command again." << endl;
		}
		cout << endl;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x10(%rsp), %rax
andq $0x0, (%rax)
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x4c32(%rip), %r14      # 0x5fd0
leaq 0x1ce7(%rip), %r15      # 0x308c
movq 0x4c34(%rip), %r12      # 0x5fe0
leaq 0x18(%rsp), %r13
leaq 0x1cd7(%rip), %rbp      # 0x308f
callq 0x1324
movq %r14, %rdi
movq %r15, %rsi
callq 0x10d0
movq %r12, %rdi
movq %r13, %rsi
callq 0x1110
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1781
testb %al, %al
jne 0x13f5
movq %r13, %rdi
leaq 0x1ca5(%rip), %rsi      # 0x3091
callq 0x1781
testb %al, %al
je 0x1450
movq %r14, %rdi
leaq 0x1c94(%rip), %rsi      # 0x3093
callq 0x10d0
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10a0
movl 0xc(%rsp), %esi
leaq 0x10(%rsp), %rdi
callq 0x178e
testb %al, %al
leaq 0x1c9e(%rip), %rsi      # 0x30c6
leaq 0x1c86(%rip), %rax      # 0x30b5
cmovneq %rax, %rsi
movq %r14, %rdi
callq 0x10d0
movq %rax, %rdi
callq 0x1080
movq %r14, %rdi
callq 0x1080
jmp 0x13b8
movq %r13, %rdi
leaq 0x1c77(%rip), %rsi      # 0x30d1
callq 0x1781
testb %al, %al
jne 0x1476
movq %r13, %rdi
leaq 0x1c66(%rip), %rsi      # 0x30d3
callq 0x1781
testb %al, %al
je 0x148c
leaq 0x10(%rsp), %rdi
callq 0x17cc
movq %r14, %rdi
leaq 0x1c4b(%rip), %rsi      # 0x30d5
jmp 0x1436
movq %r13, %rdi
leaq 0x1be9(%rip), %rsi      # 0x307f
callq 0x1781
testb %al, %al
jne 0x14b2
movq %r13, %rdi
leaq 0x1c3c(%rip), %rsi      # 0x30e5
callq 0x1781
testb %al, %al
je 0x14f1
movq %r14, %rdi
leaq 0x1c2b(%rip), %rsi      # 0x30e7
callq 0x10d0
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10a0
movl 0xc(%rsp), %esi
leaq 0x10(%rsp), %rdi
callq 0x17de
testb %al, %al
leaq 0x1c3b(%rip), %rsi      # 0x3120
leaq 0x1c1f(%rip), %rax      # 0x310b
jmp 0x142f
movq %r13, %rdi
leaq 0x1c34(%rip), %rsi      # 0x312f
callq 0x1781
testb %al, %al
jne 0x1517
movq %r13, %rdi
leaq 0x1c23(%rip), %rsi      # 0x3131
callq 0x1781
testb %al, %al
je 0x1562
movq %r14, %rdi
leaq 0x1c12(%rip), %rsi      # 0x3133
callq 0x10d0
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10a0
movq %r14, %rdi
leaq 0x1c18(%rip), %rsi      # 0x3155
callq 0x10d0
movq %rax, %rbx
movl 0xc(%rsp), %esi
leaq 0x10(%rsp), %rdi
callq 0x17f4
movq %rbx, %rdi
movl %eax, %esi
callq 0x1170
jmp 0x143b
movq %r13, %rdi
leaq 0x1b1e(%rip), %rsi      # 0x308a
callq 0x1781
testb %al, %al
jne 0x158c
movq %r13, %rdi
leaq 0x1bea(%rip), %rsi      # 0x3169
callq 0x1781
testb %al, %al
je 0x162c
movq %r14, %rdi
leaq 0x1bd5(%rip), %rsi      # 0x316b
callq 0x10d0
leaq 0x10(%rsp), %rdi
leaq -0x2bb(%rip), %rsi      # 0x12ec
callq 0x180a
movq %r14, %rdi
callq 0x1080
movq %r14, %rdi
leaq 0x1bc0(%rip), %rsi      # 0x317e
callq 0x10d0
leaq 0x10(%rsp), %rdi
leaq -0x2e3(%rip), %rsi      # 0x12ec
callq 0x1816
movq %r14, %rdi
callq 0x1080
movq %r14, %rdi
leaq 0x1bac(%rip), %rsi      # 0x3192
callq 0x10d0
leaq 0x10(%rsp), %rdi
leaq -0x30b(%rip), %rsi      # 0x12ec
callq 0x1822
movq %r14, %rdi
callq 0x1080
movq %r14, %rdi
leaq 0x1b99(%rip), %rsi      # 0x31a7
callq 0x10d0
leaq 0x10(%rsp), %rdi
leaq -0x333(%rip), %rsi      # 0x12ec
callq 0x182e
movq %r14, %rax
jmp 0x143b
movq %r13, %rdi
leaq 0x1b87(%rip), %rsi      # 0x31bd
callq 0x1781
testb %al, %al
jne 0x1652
movq %r13, %rdi
leaq 0x1b76(%rip), %rsi      # 0x31bf
callq 0x1781
testb %al, %al
je 0x1687
movq %r14, %rdi
leaq 0x1b65(%rip), %rsi      # 0x31c1
callq 0x10d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x183a
movq %rbx, %rdi
movl %eax, %esi
callq 0x1170
movq %rax, %rdi
leaq 0x1b55(%rip), %rsi      # 0x31d7
jmp 0x1436
movq %r13, %rdi
leaq 0x1b4b(%rip), %rsi      # 0x31dc
callq 0x1781
testb %al, %al
jne 0x16ad
movq %r13, %rdi
leaq 0x1b3a(%rip), %rsi      # 0x31de
callq 0x1781
testb %al, %al
je 0x16ec
movq %r14, %rdi
leaq 0x1b29(%rip), %rsi      # 0x31e0
callq 0x10d0
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10a0
movl 0xc(%rsp), %esi
leaq 0x10(%rsp), %rdi
callq 0x1842
testb %al, %al
leaq 0x1b31(%rip), %rsi      # 0x3211
leaq 0x1b1d(%rip), %rax      # 0x3204
jmp 0x142f
movq %r13, %rdi
leaq 0x1b41(%rip), %rsi      # 0x3237
callq 0x1781
testb %al, %al
jne 0x1720
movq %r13, %rdi
leaq 0x1b30(%rip), %rsi      # 0x3239
callq 0x1781
movq %r14, %rdi
leaq 0x1b33(%rip), %rsi      # 0x324b
testb %al, %al
je 0x1436
movq 0x48a9(%rip), %rdi      # 0x5fd0
leaq 0x1b0d(%rip), %rsi      # 0x323b
callq 0x10d0
movq %rax, %rdi
callq 0x1080
leaq 0x18(%rsp), %rdi
callq 0x1070
leaq 0x10(%rsp), %rdi
callq 0x184c
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1762
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1070
leaq 0x10(%rsp), %rdi
callq 0x184c
movq %rbx, %rdi
callq 0x1180