// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]rbtree/test/test.c
// Function: main
int main(int argc, char **argv)
{
	if (asc16_load(&asc16, "ASC16")) {
		printf("Failed to read \"ASC16\"\n");
		return EXIT_FAILURE;
	}

	if (argc > 1) {
		int i;
		char *cmd;
		for (i = 1; i < argc; i++) {
			cmd = argv[i];
			if (strcmp("insert", cmd) == 0 || strcmp("i", cmd) == 0) {
				i++;
				if (i < argc) {
					int v = atoi(argv[i]);
					if (v < 1) {
						printf("Invalid value, the value(s) should be a positive integer.\n");
						return EXIT_FAILURE;
					}
					else {
						insert(v);
					}
				}
				else {
					printf("Invalid arguments, usage: rbtree [insert 1] [insert 2]...\n");
					return EXIT_FAILURE;
				}
			}
			else if (strcmp("delete", cmd) == 0 || strcmp("d", cmd) == 0) {
				i++;
				if (i < argc) {
					int v = atoi(argv[i]);
					if (v < 1) {
						printf("Invalid value, the value(s) should be a positive integer.\n");
						return EXIT_FAILURE;
					}
					else {
						delete(v);
					}
				}
				else {
					printf("Invalid arguments, usage: rbtree [delete 1] [delete 2]...\n");
					return EXIT_FAILURE;
				}
			}
			else if (strcmp("find", cmd) == 0 || strcmp("f", cmd) == 0) {
				i++;
				if (i < argc) {
					int v = atoi(argv[i]);
					if (v < 1) {
						printf("Invalid value, the value(s) should be a positive integer.\n");
						return EXIT_FAILURE;
					}
					else {
						lookup(v);
					}
				}
				else {
					printf("Invalid arguments, usage: rbtree [find 1] [find 2]...\n");
					return EXIT_FAILURE;
				}
			}
			else if (strcmp("clear", cmd) == 0 || strcmp("c", cmd) == 0) {
				do_clean();
			}
			else if (strcmp("print", cmd) == 0 || strcmp("p", cmd) == 0) {
				const char *opt = "";
				if ((i + 1) < argc) {
					if (strcmp("pre", argv[i + 1]) == 0 ||
						strcmp("in", argv[i + 1]) == 0 ||
						strcmp("post", argv[i + 1]) == 0) {
						opt = argv[++i];
					}
				}
				do_print(opt);
			}
			else if (strcmp("load", cmd) == 0) {
				i++;
				if (i < argc) {
					do_load(argv[i]);
				}
				else {
					printf("Invalid arguments, usage: rbtree [load <path>] [load <path>]...\n");
					return EXIT_FAILURE;
				}
			}
			else if (strcmp("save", cmd) == 0) {
				i++;
				if (i < argc) {
					do_save(argv[i]);
				}
				else {
					printf("Invalid arguments, usage: rbtree [save <path>] [save <path>]...\n");
					return EXIT_FAILURE;
				}
			}
			else if (strcmp("bmp", cmd) == 0) {
				const char *path = NULL, *p;
				int nil = 1;

				if ((i + 1) < argc) {
					if (nil == 0) {
						if (strcmp("nonil", argv[i + 1]) == 0) {
							nil = 0;
							i++;
						}
					}
					if ((i + 1) < argc) {
						path = argv[i + 1];
						p = path;
						while (*p && (*p) != '.')
							p++;
						if (*p == '.' && strcasecmp(".bmp", p) == 0)
							i++;
						else
							path = NULL;
					}
					do_bmp(path, nil);
				}
			}
			else if (strcmp("help", cmd) == 0 || strcmp("?", cmd) == 0 || strcmp("h", cmd) == 0) {
				help();
			}
			else if (strcmp("quit", cmd) == 0 || strcmp("exit", cmd) == 0 || strcmp("q", cmd) == 0) {
				return EXIT_SUCCESS;
			}
			else {
				printf("wrong command \"%s\". use \"help\" to print help.\n", cmd);
				return EXIT_FAILURE;
			}
		}
		printf("\n");
	}

	help();
	printf("\n");

	run();

	asc16_free(&asc16);

	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movq %rsi, %r14
movl %edi, %ebp
leaq 0x537f(%rip), %rdi      # 0x8170
leaq 0x2232(%rip), %rsi      # 0x502a
callq 0x19ea
testl %eax, %eax
je 0x2e17
leaq 0x2601(%rip), %rdi      # 0x5409
callq 0x1070
movl $0x1, %ebx
jmp 0x36c4
cmpl $0x2, %ebp
jl 0x318b
movl $0x1, %r13d
xorl %ebx, %ebx
movb $0x1, %r15b
movslq %r13d, %rax
movq (%r14,%rax,8), %r12
leaq 0x21f7(%rip), %rdi      # 0x5030
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2fab
leaq 0x21e7(%rip), %rdi      # 0x5037
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2fab
leaq 0x21d2(%rip), %rdi      # 0x5039
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2fd4
leaq 0x21aa(%rip), %rdi      # 0x5028
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2fd4
leaq 0x21ab(%rip), %rdi      # 0x5040
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2ffd
leaq 0x2199(%rip), %rdi      # 0x5045
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2ffd
leaq 0x2184(%rip), %rdi      # 0x5047
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x3055
leaq 0x2173(%rip), %rdi      # 0x504d
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x3055
leaq 0x215e(%rip), %rdi      # 0x504f
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x305c
leaq 0x2171(%rip), %rdi      # 0x5079
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x305c
leaq 0x2142(%rip), %rdi      # 0x5061
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x30c5
leaq 0x2130(%rip), %rdi      # 0x5066
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x30e2
leaq 0x2125(%rip), %rdi      # 0x5072
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x30ff
leaq 0x2112(%rip), %rdi      # 0x5076
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2f9a
leaq 0x2104(%rip), %rdi      # 0x507b
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x2f9a
leaq 0x20f3(%rip), %rdi      # 0x507d
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
jne 0x36f0
leaq 0x24db(%rip), %rdi      # 0x547c
callq 0x1070
jmp 0x3040
incl %r13d
cmpl %ebp, %r13d
jge 0x315e
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x1150
movl %eax, %r12d
testl %eax, %eax
jle 0x3026
movl %r12d, %edi
callq 0x374d
jmp 0x3037
incl %r13d
cmpl %ebp, %r13d
jge 0x3167
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x1150
movl %eax, %r12d
testl %eax, %eax
jle 0x3026
movl %r12d, %edi
callq 0x37c8
jmp 0x3037
incl %r13d
cmpl %ebp, %r13d
jge 0x3170
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x1150
movl %eax, %r12d
testl %eax, %eax
jle 0x3026
movl %r12d, %edi
callq 0x382d
jmp 0x3037
leaq 0x23a2(%rip), %rdi      # 0x53cf
callq 0x1070
movl $0x1, %ebx
testl %r12d, %r12d
jle 0x3181
incl %r13d
cmpl %ebp, %r13d
setl %r15b
jl 0x2e2b
jmp 0x3152
callq 0x3caf
jmp 0x3040
leal 0x1(%r13), %r15d
cmpl %ebp, %r15d
jge 0x30b4
movslq %r15d, %rax
movq (%r14,%rax,8), %r12
leaq 0x1fe2(%rip), %rdi      # 0x5055
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x30ac
leaq 0x1fd3(%rip), %rdi      # 0x5059
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x30ac
leaq 0x1fc3(%rip), %rdi      # 0x505c
movq %r12, %rsi
callq 0x10d0
leaq 0x217c(%rip), %rdi      # 0x5224
testl %eax, %eax
jne 0x30bb
movl %r15d, %r13d
movq %r12, %rdi
jmp 0x30bb
leaq 0x2169(%rip), %rdi      # 0x5224
callq 0x385d
jmp 0x3040
incl %r13d
cmpl %ebp, %r13d
jge 0x36d8
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x3930
jmp 0x3040
incl %r13d
cmpl %ebp, %r13d
jge 0x36e4
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x3aaa
jmp 0x3040
leal 0x1(%r13), %r15d
cmpl %ebp, %r15d
jge 0x3040
movslq %r15d, %rax
movq (%r14,%rax,8), %r12
movq %r12, %rsi
movzbl (%rsi), %eax
testl %eax, %eax
je 0x3137
cmpl $0x2e, %eax
je 0x3127
incq %rsi
jmp 0x3116
leaq 0x1f43(%rip), %rdi      # 0x5071
callq 0x1050
testl %eax, %eax
je 0x313d
movl %r13d, %r15d
xorl %r12d, %r12d
movq %r12, %rdi
movl $0x1, %esi
callq 0x3b54
movl %r15d, %r13d
jmp 0x3040
movl $0xa, %edi
callq 0x1040
jmp 0x3181
leaq 0x2230(%rip), %rdi      # 0x5395
jmp 0x3177
leaq 0x21ed(%rip), %rdi      # 0x535b
jmp 0x3177
leaq 0x21ae(%rip), %rdi      # 0x5325
callq 0x1070
movl $0x1, %ebx
testb $0x1, %r15b
jne 0x36c4
leaq 0x22ea(%rip), %rdi      # 0x547c
callq 0x1070
movl $0xa, %edi
callq 0x1040
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x20a8(%rip), %r15      # 0x525b
leaq 0x4(%rsp), %r12
leaq 0x20(%rsp), %r13
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
movq %r12, %rdi
movl $0x8, %esi
callq 0x3dae
testl %eax, %eax
je 0x31bd
cmpl $0x8, %eax
jne 0x31e2
movb $0x0, 0xb(%rsp)
movl 0x4(%rsp), %eax
movl $0x65736e69, %ecx       # imm = 0x65736E69
xorl %ecx, %eax
movl 0x7(%rsp), %ecx
movl $0x747265, %edx         # imm = 0x747265
xorl %edx, %ecx
orl %eax, %ecx
je 0x3372
cmpw $0x69, 0x4(%rsp)
je 0x3372
movl 0x4(%rsp), %eax
movl $0x656c6564, %ecx       # imm = 0x656C6564
xorl %ecx, %eax
movl 0x7(%rsp), %ecx
movl $0x657465, %edx         # imm = 0x657465
xorl %edx, %ecx
orl %eax, %ecx
je 0x33ff
cmpw $0x64, 0x4(%rsp)
je 0x33ff
movl 0x4(%rsp), %eax
movl $0x646e6966, %ecx       # imm = 0x646E6966
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x3457
cmpw $0x66, 0x4(%rsp)
je 0x3457
movl 0x4(%rsp), %eax
movl $0x61656c63, %ecx       # imm = 0x61656C63
xorl %ecx, %eax
movzwl 0x8(%rsp), %ecx
xorl $0x72, %ecx
orl %eax, %ecx
je 0x33be
cmpw $0x63, 0x4(%rsp)
je 0x33be
movl 0x4(%rsp), %eax
movl $0x6e697270, %ecx       # imm = 0x6E697270
xorl %ecx, %eax
movzwl 0x8(%rsp), %ecx
xorl $0x74, %ecx
orl %eax, %ecx
je 0x33e4
cmpw $0x70, 0x4(%rsp)
je 0x33e4
movl 0x4(%rsp), %eax
movl $0x64616f6c, %ecx       # imm = 0x64616F6C
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x34c9
movl 0x4(%rsp), %eax
movl $0x65766173, %ecx       # imm = 0x65766173
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x34f9
cmpl $0x706d62, 0x4(%rsp)    # imm = 0x706D62
je 0x3566
movl 0x4(%rsp), %eax
movl $0x706c6568, %ecx       # imm = 0x706C6568
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x3542
cmpw $0x3f, 0x4(%rsp)
je 0x3542
cmpw $0x68, 0x4(%rsp)
je 0x3542
movl 0x4(%rsp), %eax
movl $0x74697571, %ecx       # imm = 0x74697571
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x3688
movl 0x4(%rsp), %eax
movl $0x74697865, %ecx       # imm = 0x74697865
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x3688
cmpw $0x71, 0x4(%rsp)
je 0x3688
callq 0x10e0
cmpl $0xa, %eax
je 0x3361
cmpl $-0x1, %eax
jne 0x3352
leaq 0x23d0(%rip), %rdi      # 0x5738
callq 0x1070
jmp 0x31bd
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3e89
testl %eax, %eax
jne 0x346d
movl 0x10(%rsp), %ebx
testq %rbx, %rbx
je 0x34b8
testl %ebx, %ebx
jle 0x343e
movq 0x18(%rsp), %r14
xorl %ebp, %ebp
movl (%r14,%rbp,4), %edi
callq 0x374d
incq %rbp
cmpq %rbp, %rbx
jne 0x33a8
jmp 0x343e
callq 0x10e0
cmpl $0xa, %eax
je 0x33cd
cmpl $-0x1, %eax
jne 0x33be
callq 0x3caf
jmp 0x31bd
movb $0x0, 0x27(%rsp)
movq %r13, %rdi
callq 0x385d
movq %r13, %rdi
movl $0x8, %esi
callq 0x3dae
cmpl $0x8, %eax
je 0x33d7
testl %eax, %eax
jne 0x33dc
jmp 0x31bd
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3e89
testl %eax, %eax
jne 0x346d
movl 0x10(%rsp), %ebx
testq %rbx, %rbx
je 0x34b8
testl %ebx, %ebx
jle 0x343e
movq 0x18(%rsp), %r14
xorl %ebp, %ebp
movl (%r14,%rbp,4), %edi
callq 0x37c8
incq %rbp
cmpq %rbp, %rbx
jne 0x342d
movl 0x4d3c(%rip), %esi      # 0x8180
leaq 0x1e03(%rip), %rdi      # 0x524e
xorl %eax, %eax
callq 0x10b0
jmp 0x31bd
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3e89
testl %eax, %eax
je 0x347e
leaq 0x230d(%rip), %rdi      # 0x5781
callq 0x1070
jmp 0x31bd
movl 0x10(%rsp), %ebx
testq %rbx, %rbx
je 0x34b8
leaq 0x233d(%rip), %rdi      # 0x57cb
callq 0x1070
testl %ebx, %ebx
jle 0x31bd
movq 0x18(%rsp), %r14
xorl %ebp, %ebp
movl (%r14,%rbp,4), %edi
callq 0x382d
incq %rbp
cmpq %rbp, %rbx
jne 0x34a2
jmp 0x31bd
leaq 0x22ff(%rip), %rdi      # 0x57be
callq 0x1070
jmp 0x31bd
xorl %ebx, %ebx
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3dae
cmpl $0x1000, %eax           # imm = 0x1000
je 0x34e5
testl %eax, %eax
jne 0x34ed
jmp 0x3529
movb $0x0, 0x101f(%rsp)
movq %r13, %rdi
callq 0x3930
decl %ebx
jmp 0x34cb
xorl %ebx, %ebx
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3dae
cmpl $0x1000, %eax           # imm = 0x1000
je 0x3515
testl %eax, %eax
jne 0x351d
jmp 0x3529
movb $0x0, 0x101f(%rsp)
movq %r13, %rdi
callq 0x3aaa
decl %ebx
jmp 0x34fb
testl %ebx, %ebx
jne 0x31bd
leaq 0x2229(%rip), %rdi      # 0x5761
callq 0x1070
jmp 0x31bd
leaq 0x1f33(%rip), %rdi      # 0x547c
callq 0x1070
callq 0x10e0
cmpl $-0x1, %eax
je 0x31bd
cmpl $0xa, %eax
jne 0x354e
jmp 0x31bd
movl $0x0, 0xc(%rsp)
xorl %ebx, %ebx
movl $0x696e6f6e, %r14d      # imm = 0x696E6F6E
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3dae
movl %eax, %ebp
cmpl $0x1000, %eax           # imm = 0x1000
je 0x3595
testl %ebp, %ebp
jne 0x359d
jmp 0x3667
movb $0x0, 0x101f(%rsp)
testl %ebx, %ebx
jne 0x35be
movl 0x20(%rsp), %eax
xorl %r14d, %eax
movzwl 0x24(%rsp), %ecx
xorl $0x6c, %ecx
movl $0x1, %ebx
orl %eax, %ecx
je 0x3576
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r13, %rsi
movzbl (%rsi), %r14d
testl %r14d, %r14d
je 0x35ea
cmpl $0x2e, %r14d
je 0x35d5
incq %rsi
jmp 0x35c1
leaq 0x1a95(%rip), %rdi      # 0x5071
callq 0x1050
testl %eax, %eax
jne 0x3647
testb %r14b, %r14b
jne 0x3607
cmpl $0xffc, %ebp            # imm = 0xFFC
jge 0x3621
movq %r13, %rdi
callq 0x10a0
movl $0x706d622e, 0x20(%rsp,%rax) # imm = 0x706D622E
movb $0x0, 0x24(%rsp,%rax)
xorl %esi, %esi
cmpl $0x1, %ebx
setne %sil
movq %r13, %rdi
callq 0x3b54
incl 0xc(%rsp)
jmp 0x3570
leaq 0x1c5f(%rip), %rdi      # 0x5287
movq %r13, %rsi
xorl %eax, %eax
callq 0x10b0
movl 0xc(%rsp), %ebp
callq 0x10e0
cmpl $-0x1, %eax
je 0x366b
cmpl $0xa, %eax
jne 0x3636
jmp 0x366b
leaq 0x1c10(%rip), %rdi      # 0x525e
movq %r13, %rsi
xorl %eax, %eax
callq 0x10b0
callq 0x10e0
cmpl $-0x1, %eax
je 0x3667
cmpl $0xa, %eax
jne 0x3658
movl 0xc(%rsp), %ebp
testl %ebp, %ebp
jne 0x31bd
xorl %esi, %esi
cmpl $0x1, %ebx
setne %sil
xorl %edi, %edi
callq 0x3b54
jmp 0x31bd
callq 0x10e0
cmpl $-0x1, %eax
je 0x3697
cmpl $0xa, %eax
jne 0x3688
movq 0x18(%rsp), %rdi
callq 0x1030
leaq 0x4a28(%rip), %rdi      # 0x80d0
leaq 0x656(%rip), %rsi       # 0x3d05
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x17b4
leaq 0x4ab1(%rip), %rdi      # 0x8170
callq 0x19dc
movl %ebx, %eax
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c06(%rip), %rdi      # 0x52e5
jmp 0x3177
leaq 0x1bba(%rip), %rdi      # 0x52a5
jmp 0x3177
leaq 0x1988(%rip), %rdi      # 0x507f
movq %r12, %rsi
callq 0x10d0
xorl %ebx, %ebx
testl %eax, %eax
je 0x3181
leaq 0x1974(%rip), %rdi      # 0x5084
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x3181
leaq 0x1962(%rip), %rdi      # 0x5089
movq %r12, %rsi
callq 0x10d0
testl %eax, %eax
je 0x3181
leaq 0x194d(%rip), %rdi      # 0x508b
movq %r12, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x317c