// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %eax, %eax
leaq 0x8(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x28(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq 0x3b91(%rip), %r15      # 0x4fd0
movq 0x3b9a(%rip), %r12      # 0x4fe0
leaq 0x18(%rsp), %r13
callq 0x1350
movl $0x2, %edx
movq %r15, %rdi
leaq 0x1c49(%rip), %rsi      # 0x30a8
callq 0x1100
movq %r12, %rdi
movq %r13, %rsi
callq 0x1110
movq %r13, %rdi
leaq 0x1c32(%rip), %rsi      # 0x30ab
callq 0x1050
testl %eax, %eax
je 0x15f0
movq %r13, %rdi
leaq 0x1c1d(%rip), %rsi      # 0x30ad
callq 0x1050
testl %eax, %eax
je 0x15f0
movq %r13, %rdi
leaq 0x1c3b(%rip), %rsi      # 0x30e2
callq 0x1050
testl %eax, %eax
je 0x1655
movq %r13, %rdi
leaq 0x1c26(%rip), %rsi      # 0x30e4
callq 0x1050
testl %eax, %eax
je 0x1655
movq %r13, %rdi
leaq 0x1bc6(%rip), %rsi      # 0x309b
callq 0x1050
testl %eax, %eax
je 0x1679
movq %r13, %rdi
leaq 0x1c0a(%rip), %rsi      # 0x30f6
callq 0x1050
testl %eax, %eax
je 0x1679
movq %r13, %rdi
leaq 0x1c2e(%rip), %rsi      # 0x3131
callq 0x1050
testl %eax, %eax
je 0x171a
movq %r13, %rdi
leaq 0x1c19(%rip), %rsi      # 0x3133
callq 0x1050
testl %eax, %eax
je 0x171a
movq %r13, %rdi
leaq 0x1b75(%rip), %rsi      # 0x30a6
callq 0x1050
testl %eax, %eax
je 0x1793
movq %r13, %rdi
leaq 0x1c23(%rip), %rsi      # 0x316b
callq 0x1050
testl %eax, %eax
je 0x1793
movq %r13, %rdi
leaq 0x1c60(%rip), %rsi      # 0x31bf
callq 0x1050
testl %eax, %eax
je 0x18ad
movq %r13, %rdi
leaq 0x1c4b(%rip), %rsi      # 0x31c1
callq 0x1050
testl %eax, %eax
je 0x18ad
movq %r13, %rdi
leaq 0x1c51(%rip), %rsi      # 0x31de
callq 0x1050
testl %eax, %eax
je 0x1908
movq %r13, %rdi
leaq 0x1c3c(%rip), %rsi      # 0x31e0
callq 0x1050
testl %eax, %eax
je 0x1908
movq %r13, %rdi
leaq 0x1c7e(%rip), %rsi      # 0x3239
callq 0x1050
testl %eax, %eax
je 0x1961
movq %r13, %rdi
leaq 0x1c69(%rip), %rsi      # 0x323b
callq 0x1050
movl $0x2d, %edx
leaq 0x1c6a(%rip), %rsi      # 0x324d
testl %eax, %eax
jne 0x16bc
jmp 0x1961
movl $0x21, %edx
movq %r15, %rdi
leaq 0x1ab0(%rip), %rsi      # 0x30af
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl 0x14(%rsp), %ebp
movq 0x8(%rsp), %r14
movl $0x20, %edi
callq 0x10e0
movl %ebp, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movl $0x1, 0x18(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1a6a
movq %rax, 0x8(%rsp)
movl $0x10, %edx
leaq 0x1a7e(%rip), %rsi      # 0x30d1
jmp 0x16bc
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a30
movq $0x0, 0x8(%rsp)
movl $0xf, %edx
leaq 0x1a6f(%rip), %rsi      # 0x30e6
jmp 0x16bc
movl $0x23, %edx
movq %r15, %rdi
leaq 0x1a70(%rip), %rsi      # 0x30f8
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl 0x14(%rsp), %edx
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cb8
movq %rax, 0x8(%rsp)
movl $0x14, %edx
leaq 0x1a60(%rip), %rsi      # 0x311c
movq %r15, %rdi
callq 0x1100
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movq %r15, %r14
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
jmp 0x144b
movl $0x21, %edx
movq %r15, %rdi
leaq 0x1a0c(%rip), %rsi      # 0x3135
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl $0x13, %edx
movq %r15, %rdi
leaq 0x1a0d(%rip), %rsi      # 0x3157
callq 0x1100
movl 0x14(%rsp), %r14d
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x1f86
movl %eax, %ecx
negl %ecx
cmovnol %eax, %r14d
movq %r15, %rdi
movl %r14d, %esi
callq 0x1170
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10d0
jmp 0x16db
movl $0x12, %edx
movq %r15, %rdi
leaq 0x19cb(%rip), %rsi      # 0x316d
callq 0x1100
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
leaq -0x4ba(%rip), %rdx      # 0x12fc
callq 0x1fa8
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movl $0x13, %edx
movq %r15, %rdi
leaq 0x198f(%rip), %rsi      # 0x3180
callq 0x1100
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
leaq -0x509(%rip), %rdx      # 0x12fc
callq 0x1fee
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movl $0x14, %edx
movq %r15, %rdi
leaq 0x1954(%rip), %rsi      # 0x3194
callq 0x1100
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
leaq -0x558(%rip), %rdx      # 0x12fc
callq 0x2034
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movl $0x15, %edx
movq %r15, %rdi
leaq 0x191a(%rip), %rsi      # 0x31a9
callq 0x1100
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
leaq -0x5a7(%rip), %rdx      # 0x12fc
callq 0x2074
jmp 0x16c4
movl $0x15, %edx
movq %r15, %rdi
leaq 0x1907(%rip), %rsi      # 0x31c3
callq 0x1100
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x26b4
movq %r15, %rdi
movl %eax, %esi
callq 0x1170
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x18ef(%rip), %rsi      # 0x31d9
callq 0x1100
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10d0
jmp 0x16db
movl $0x23, %edx
movq %r15, %rdi
leaq 0x18cb(%rip), %rsi      # 0x31e2
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl 0x14(%rsp), %edx
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x26e8
testb %al, %al
leaq 0x18d0(%rip), %rsi      # 0x3213
leaq 0x18bc(%rip), %rax      # 0x3206
cmovneq %rax, %rsi
movl $0x25, %edx
movl $0xc, %eax
cmovneq %rax, %rdx
jmp 0x16bc
movq 0x3668(%rip), %rbx      # 0x4fd0
leaq 0x18ce(%rip), %rsi      # 0x323d
movl $0xf, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x3636(%rip), %rdi      # 0x4fd0
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x19c3
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x10f0
leaq 0x8(%rsp), %rdi
callq 0x1a12
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19e0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x19ff
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x10f0
leaq 0x8(%rsp), %rdi
callq 0x1a12
movq %rbx, %rdi
callq 0x1180
nop