// File: /workspace/github_cpp_makefile_star2_O3/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), %rcx
movq %rax, (%rcx)
leaq 0x28(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq 0x3b91(%rip), %rbx      # 0x4fd0
movq 0x3b9a(%rip), %r12      # 0x4fe0
leaq 0x18(%rsp), %r13
leaq 0x1c59(%rip), %rbp      # 0x30ab
callq 0x1350
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x1c42(%rip), %rsi      # 0x30a8
callq 0x1100
movq %r12, %rdi
movq %r13, %rsi
callq 0x1110
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1050
testl %eax, %eax
je 0x15f3
movq %r13, %rdi
leaq 0x1c1a(%rip), %rsi      # 0x30ad
callq 0x1050
testl %eax, %eax
je 0x15f3
movq %r13, %rdi
leaq 0x1c38(%rip), %rsi      # 0x30e2
callq 0x1050
testl %eax, %eax
je 0x165c
movq %r13, %rdi
leaq 0x1c23(%rip), %rsi      # 0x30e4
callq 0x1050
testl %eax, %eax
je 0x165c
movq %r13, %rdi
leaq 0x1bc3(%rip), %rsi      # 0x309b
callq 0x1050
testl %eax, %eax
je 0x1682
movq %r13, %rdi
leaq 0x1c07(%rip), %rsi      # 0x30f6
callq 0x1050
testl %eax, %eax
je 0x1682
movq %r13, %rdi
leaq 0x1c2b(%rip), %rsi      # 0x3131
callq 0x1050
testl %eax, %eax
je 0x1725
movq %r13, %rdi
leaq 0x1c16(%rip), %rsi      # 0x3133
callq 0x1050
testl %eax, %eax
je 0x1725
movq %r13, %rdi
leaq 0x1b72(%rip), %rsi      # 0x30a6
callq 0x1050
testl %eax, %eax
je 0x17b5
movq %r13, %rdi
leaq 0x1c20(%rip), %rsi      # 0x316b
callq 0x1050
testl %eax, %eax
je 0x17b5
movq %r13, %rdi
leaq 0x1c5d(%rip), %rsi      # 0x31bf
callq 0x1050
testl %eax, %eax
je 0x18d7
movq %r13, %rdi
leaq 0x1c48(%rip), %rsi      # 0x31c1
callq 0x1050
testl %eax, %eax
je 0x18d7
movq %r13, %rdi
leaq 0x1c4e(%rip), %rsi      # 0x31de
callq 0x1050
testl %eax, %eax
je 0x1934
movq %r13, %rdi
leaq 0x1c39(%rip), %rsi      # 0x31e0
callq 0x1050
testl %eax, %eax
je 0x1934
movq %r13, %rdi
leaq 0x1c7b(%rip), %rsi      # 0x3239
callq 0x1050
testl %eax, %eax
je 0x19a2
movq %r13, %rdi
leaq 0x1c66(%rip), %rsi      # 0x323b
callq 0x1050
movl $0x2d, %edx
leaq 0x1c67(%rip), %rsi      # 0x324d
testl %eax, %eax
jne 0x16c7
jmp 0x19a2
movl $0x21, %edx
movq %rbx, %rdi
leaq 0x1aad(%rip), %rsi      # 0x30af
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl 0x14(%rsp), %r15d
movq 0x8(%rsp), %r14
movl $0x20, %edi
callq 0x10e0
movl %r15d, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movl $0x1, 0x18(%rax)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1aaa
movq %rax, 0x8(%rsp)
movl $0x10, %edx
leaq 0x1a77(%rip), %rsi      # 0x30d1
jmp 0x16c7
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x1a70
movq $0x0, 0x8(%rsp)
movl $0xf, %edx
leaq 0x1a66(%rip), %rsi      # 0x30e6
jmp 0x16c7
movl $0x23, %edx
movq %rbx, %rdi
leaq 0x1a67(%rip), %rsi      # 0x30f8
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl 0x14(%rsp), %edx
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x1cc0
movq %rax, 0x8(%rsp)
movl $0x14, %edx
leaq 0x1a55(%rip), %rsi      # 0x311c
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movq %rbx, %r14
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
jmp 0x1452
movl $0x21, %edx
movq %rbx, %rdi
leaq 0x1a01(%rip), %rsi      # 0x3135
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movl $0x13, %edx
movq %rbx, %rdi
leaq 0x1a02(%rip), %rsi      # 0x3157
callq 0x1100
movl 0x14(%rsp), %eax
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x178f
movl $0x80000000, %esi       # imm = 0x80000000
movl (%rcx), %edx
cmpl %eax, %edx
jle 0x177e
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x176d
jmp 0x1789
movq 0x10(%rcx), %rcx
cmpl %esi, %edx
cmovgl %edx, %esi
jmp 0x1777
movl %esi, %ecx
negl %ecx
jno 0x1791
movl %eax, %esi
movq %rbx, %rdi
callq 0x1170
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10d0
jmp 0x16e6
movl $0x12, %edx
movq %rbx, %rdi
leaq 0x19a9(%rip), %rsi      # 0x316d
callq 0x1100
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
leaq -0x4de(%rip), %rdx      # 0x12fc
callq 0x1f70
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movl $0x13, %edx
movq %rbx, %rdi
leaq 0x196b(%rip), %rsi      # 0x3180
callq 0x1100
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
leaq -0x52f(%rip), %rdx      # 0x12fc
callq 0x1fba
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movl $0x14, %edx
movq %rbx, %rdi
leaq 0x192e(%rip), %rsi      # 0x3194
callq 0x1100
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
leaq -0x580(%rip), %rdx      # 0x12fc
callq 0x2004
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movl $0x15, %edx
movq %rbx, %rdi
leaq 0x18f2(%rip), %rsi      # 0x31a9
callq 0x1100
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
leaq -0x5d1(%rip), %rdx      # 0x12fc
callq 0x2044
jmp 0x16cf
movl $0x15, %edx
movq %rbx, %rdi
leaq 0x18dd(%rip), %rsi      # 0x31c3
callq 0x1100
movq 0x8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x2690
movq %rbx, %rdi
movl %eax, %esi
callq 0x1170
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x18c3(%rip), %rsi      # 0x31d9
callq 0x1100
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10d0
jmp 0x16e6
movl $0x23, %edx
movq %rbx, %rdi
leaq 0x189f(%rip), %rsi      # 0x31e2
callq 0x1100
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1090
movq 0x8(%rsp), %rax
movl $0x25, %edx
testq %rax, %rax
je 0x1985
movl 0x14(%rsp), %ecx
movl (%rax), %esi
cmpl %ecx, %esi
je 0x1991
movl $0x8, %esi
jg 0x197c
movl $0x10, %esi
jge 0x1985
movq (%rax,%rsi), %rax
testq %rax, %rax
jne 0x1968
leaq 0x1887(%rip), %rsi      # 0x3213
jmp 0x16c7
movl $0xc, %edx
leaq 0x1869(%rip), %rsi      # 0x3206
jmp 0x16c7
movq 0x3627(%rip), %rbx      # 0x4fd0
leaq 0x188d(%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 0x35f5(%rip), %rdi      # 0x4fd0
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1a04
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x10f0
leaq 0x8(%rsp), %rdi
callq 0x1a52
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1a21
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1a40
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x10f0
leaq 0x8(%rsp), %rdi
callq 0x1a52
movq %rbx, %rdi
callq 0x1180