// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movl %edi, %ebp
leaq 0x51ab(%rip), %rdi      # 0x8180
leaq 0x207e(%rip), %rsi      # 0x505a
callq 0x1b7a
testl %eax, %eax
je 0x2ffb
leaq 0x244a(%rip), %rdi      # 0x5436
callq 0x1070
movl $0x1, %ebx
jmp 0x386d
cmpl $0x2, %ebp
jl 0x3335
movl $0x1, %r12d
leaq 0x204f(%rip), %r14      # 0x5060
movslq %r12d, %rax
movq (%rbx,%rax,8), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x3175
movzbl (%r13), %r15d
movl %r15d, %eax
subl $0x69, %eax
jne 0x303d
movzbl 0x1(%r13), %eax
negl %eax
testl %eax, %eax
je 0x3175
leaq 0x201b(%rip), %rdi      # 0x5069
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x31a1
movl %r15d, %eax
subl $0x64, %eax
jne 0x306b
movzbl 0x1(%r13), %eax
negl %eax
testl %eax, %eax
je 0x31a1
leaq 0x1ff4(%rip), %rdi      # 0x5070
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x31cd
movl %r15d, %eax
subl $0x66, %eax
jne 0x3099
movzbl 0x1(%r13), %eax
negl %eax
testl %eax, %eax
je 0x31cd
leaq 0x1fcd(%rip), %rdi      # 0x5077
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x31f6
movl %r15d, %eax
subl $0x63, %eax
jne 0x30c7
movzbl 0x1(%r13), %eax
negl %eax
testl %eax, %eax
je 0x31f6
leaq 0x1fa7(%rip), %rdi      # 0x507f
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x31fd
movl %r15d, %eax
subl $0x70, %eax
jne 0x30f5
movzbl 0x1(%r13), %eax
negl %eax
testl %eax, %eax
je 0x31fd
leaq 0x1f88(%rip), %rdi      # 0x508e
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x327f
leaq 0x1f76(%rip), %rdi      # 0x5093
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x3299
leaq 0x1f6b(%rip), %rdi      # 0x509f
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x32b3
leaq 0x1f58(%rip), %rdi      # 0x50a3
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x32ef
cmpl $0x3f, %r15d
jne 0x32d8
cmpb $0x0, 0x1(%r13)
je 0x32ef
jmp 0x38c9
incl %r12d
cmpl %ebp, %r12d
jge 0x388d
movslq %r12d, %rax
movq (%rbx,%rax,8), %rdi
callq 0x1160
testl %eax, %eax
jle 0x3881
movl %eax, %edi
callq 0x3922
jmp 0x326e
incl %r12d
cmpl %ebp, %r12d
jge 0x3899
movslq %r12d, %rax
movq (%rbx,%rax,8), %rdi
callq 0x1160
testl %eax, %eax
jle 0x3881
movl %eax, %edi
callq 0x3990
jmp 0x326e
incl %r12d
cmpl %ebp, %r12d
jge 0x38a5
movslq %r12d, %rax
movq (%rbx,%rax,8), %rdi
callq 0x1160
testl %eax, %eax
jle 0x3881
movl %eax, %edi
callq 0x39f5
jmp 0x326e
callq 0x3e7a
jmp 0x326e
leal 0x1(%r12), %r15d
cmpl %ebp, %r15d
jge 0x3262
movslq %r15d, %rax
movq (%rbx,%rax,8), %r13
leaq 0x1e70(%rip), %rdi      # 0x5085
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x325a
movzbl (%r13), %eax
subl $0x69, %eax
jne 0x323a
movzbl 0x1(%r13), %eax
subl $0x6e, %eax
jne 0x323a
movzbl 0x2(%r13), %eax
negl %eax
testl %eax, %eax
je 0x325a
leaq 0x1e42(%rip), %rdi      # 0x5089
movq %r13, %rsi
callq 0x10e0
leaq 0x1ffb(%rip), %rdi      # 0x5251
testl %eax, %eax
jne 0x3269
movl %r15d, %r12d
movq %r13, %rdi
jmp 0x3269
leaq 0x1fe8(%rip), %rdi      # 0x5251
callq 0x3a25
incl %r12d
cmpl %ebp, %r12d
jl 0x3011
jmp 0x332b
incl %r12d
cmpl %ebp, %r12d
jge 0x38b1
movslq %r12d, %rax
movq (%rbx,%rax,8), %rdi
callq 0x3b09
jmp 0x326e
incl %r12d
cmpl %ebp, %r12d
jge 0x38bd
movslq %r12d, %rax
movq (%rbx,%rax,8), %rdi
callq 0x3c71
jmp 0x326e
leal 0x1(%r12), %r15d
cmpl %ebp, %r15d
jge 0x326e
movslq %r15d, %rax
movq (%rbx,%rax,8), %r13
movq %r13, %rsi
movzbl (%rsi), %eax
testl %eax, %eax
je 0x3310
cmpl $0x2e, %eax
je 0x3300
incq %rsi
jmp 0x32c7
movl %r15d, %eax
subl $0x68, %eax
jne 0x32e5
movzbl 0x1(%r13), %eax
negl %eax
testl %eax, %eax
jne 0x38c9
leaq 0x21b3(%rip), %rdi      # 0x54a9
callq 0x1070
jmp 0x326e
leaq 0x1d97(%rip), %rdi      # 0x509e
callq 0x1050
testl %eax, %eax
je 0x3316
movl %r12d, %r15d
xorl %r13d, %r13d
movq %r13, %rdi
movl $0x1, %esi
callq 0x3d1f
movl %r15d, %r12d
jmp 0x326e
movl $0xa, %edi
callq 0x1040
leaq 0x216d(%rip), %rdi      # 0x54a9
callq 0x1070
movl $0xa, %edi
callq 0x1040
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x1f2b(%rip), %r15      # 0x5288
leaq 0x4(%rsp), %r12
leaq 0x20(%rsp), %r13
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
movq %r12, %rdi
movl $0x8, %esi
callq 0x3f79
testl %eax, %eax
je 0x3367
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 0x3512
cmpw $0x69, 0x4(%rsp)
je 0x3512
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 0x35a1
cmpw $0x64, 0x4(%rsp)
je 0x35a1
movl 0x4(%rsp), %eax
movl $0x646e6966, %ecx       # imm = 0x646E6966
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x35fb
cmpw $0x66, 0x4(%rsp)
je 0x35fb
movl 0x4(%rsp), %eax
movl $0x61656c63, %ecx       # imm = 0x61656C63
xorl %ecx, %eax
movzwl 0x8(%rsp), %ecx
xorl $0x72, %ecx
orl %eax, %ecx
je 0x3560
cmpw $0x63, 0x4(%rsp)
je 0x3560
movl 0x4(%rsp), %eax
movl $0x6e697270, %ecx       # imm = 0x6E697270
xorl %ecx, %eax
movzwl 0x8(%rsp), %ecx
xorl $0x74, %ecx
orl %eax, %ecx
je 0x3586
cmpw $0x70, 0x4(%rsp)
je 0x3586
movl 0x4(%rsp), %eax
movl $0x64616f6c, %ecx       # imm = 0x64616F6C
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x366f
movl 0x4(%rsp), %eax
movl $0x65766173, %ecx       # imm = 0x65766173
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x36a1
cmpl $0x706d62, 0x4(%rsp)    # imm = 0x706D62
je 0x3711
movl 0x4(%rsp), %eax
movl $0x706c6568, %ecx       # imm = 0x706C6568
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x36ed
cmpw $0x3f, 0x4(%rsp)
je 0x36ed
cmpw $0x68, 0x4(%rsp)
je 0x36ed
movl 0x4(%rsp), %eax
movl $0x74697571, %ecx       # imm = 0x74697571
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x3831
movl 0x4(%rsp), %eax
movl $0x74697865, %ecx       # imm = 0x74697865
xorl %ecx, %eax
movzbl 0x8(%rsp), %ecx
orl %eax, %ecx
je 0x3831
cmpw $0x71, 0x4(%rsp)
je 0x3831
callq 0x10f0
cmpl $0xa, %eax
je 0x3501
cmpl $-0x1, %eax
jne 0x34f2
leaq 0x225d(%rip), %rdi      # 0x5765
callq 0x1070
jmp 0x3367
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x4052
testl %eax, %eax
jne 0x3611
movl 0x10(%rsp), %r14d
testq %r14, %r14
je 0x365e
testl %r14d, %r14d
jle 0x35e2
movq 0x18(%rsp), %rbp
xorl %ebx, %ebx
movl (%rbp,%rbx,4), %edi
callq 0x3922
incq %rbx
cmpq %rbx, %r14
jne 0x354a
jmp 0x35e2
callq 0x10f0
cmpl $0xa, %eax
je 0x356f
cmpl $-0x1, %eax
jne 0x3560
callq 0x3e7a
jmp 0x3367
movb $0x0, 0x27(%rsp)
movq %r13, %rdi
callq 0x3a25
movq %r13, %rdi
movl $0x8, %esi
callq 0x3f79
cmpl $0x8, %eax
je 0x3579
testl %eax, %eax
jne 0x357e
jmp 0x3367
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x4052
testl %eax, %eax
jne 0x3611
movl 0x10(%rsp), %r14d
testq %r14, %r14
je 0x365e
testl %r14d, %r14d
jle 0x35e2
movq 0x18(%rsp), %rbp
xorl %ebx, %ebx
movl (%rbp,%rbx,4), %edi
callq 0x3990
incq %rbx
cmpq %rbx, %r14
jne 0x35d1
movl 0x4ba8(%rip), %esi      # 0x8190
leaq 0x1c8c(%rip), %rdi      # 0x527b
xorl %eax, %eax
callq 0x10b0
jmp 0x3367
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x4052
testl %eax, %eax
je 0x3622
leaq 0x2196(%rip), %rdi      # 0x57ae
callq 0x1070
jmp 0x3367
movl 0x10(%rsp), %r14d
testq %r14, %r14
je 0x365e
leaq 0x21c5(%rip), %rdi      # 0x57f8
callq 0x1070
testl %r14d, %r14d
jle 0x3367
movq 0x18(%rsp), %rbp
xorl %ebx, %ebx
movl (%rbp,%rbx,4), %edi
callq 0x39f5
incq %rbx
cmpq %rbx, %r14
jne 0x3648
jmp 0x3367
leaq 0x2186(%rip), %rdi      # 0x57eb
callq 0x1070
jmp 0x3367
xorl %r14d, %r14d
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3f79
cmpl $0x1000, %eax           # imm = 0x1000
je 0x368c
testl %eax, %eax
jne 0x3694
jmp 0x36d3
movb $0x0, 0x101f(%rsp)
movq %r13, %rdi
callq 0x3b09
decl %r14d
jmp 0x3672
xorl %r14d, %r14d
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3f79
cmpl $0x1000, %eax           # imm = 0x1000
je 0x36be
testl %eax, %eax
jne 0x36c6
jmp 0x36d3
movb $0x0, 0x101f(%rsp)
movq %r13, %rdi
callq 0x3c71
decl %r14d
jmp 0x36a4
testl %r14d, %r14d
jne 0x3367
leaq 0x20ab(%rip), %rdi      # 0x578e
callq 0x1070
jmp 0x3367
leaq 0x1db5(%rip), %rdi      # 0x54a9
callq 0x1070
callq 0x10f0
cmpl $-0x1, %eax
je 0x3367
cmpl $0xa, %eax
jne 0x36f9
jmp 0x3367
movl $0x0, 0xc(%rsp)
xorl %r14d, %r14d
movl $0x696e6f6e, %ebx       # imm = 0x696E6F6E
leaq 0x1976(%rip), %rbp      # 0x509e
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3f79
cmpl $0x1000, %eax           # imm = 0x1000
je 0x3745
testl %eax, %eax
jne 0x374d
jmp 0x380f
movb $0x0, 0x101f(%rsp)
testl %r14d, %r14d
jne 0x3770
movl 0x20(%rsp), %ecx
xorl %ebx, %ecx
movzwl 0x24(%rsp), %edx
xorl $0x6c, %edx
movl $0x1, %r14d
orl %ecx, %edx
je 0x3728
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r13, %rsi
movzbl (%rsi), %ecx
testl %ecx, %ecx
je 0x3792
cmpl $0x2e, %ecx
je 0x3784
incq %rsi
jmp 0x3773
movq %rbp, %rdi
callq 0x1050
testl %eax, %eax
je 0x37ae
jmp 0x37c9
cmpl $0xffc, %eax            # imm = 0xFFC
jge 0x37ef
movq %r13, %rdi
callq 0x10a0
movl $0x706d622e, 0x20(%rsp,%rax) # imm = 0x706D622E
movb $0x0, 0x24(%rsp,%rax)
xorl %esi, %esi
cmpl $0x1, %r14d
setne %sil
movq %r13, %rdi
callq 0x3d1f
incl 0xc(%rsp)
jmp 0x3728
leaq 0x1abb(%rip), %rdi      # 0x528b
movq %r13, %rsi
xorl %eax, %eax
callq 0x10b0
movl 0xc(%rsp), %ebx
callq 0x10f0
cmpl $-0x1, %eax
je 0x3813
cmpl $0xa, %eax
jne 0x37de
jmp 0x3813
leaq 0x1abe(%rip), %rdi      # 0x52b4
movq %r13, %rsi
xorl %eax, %eax
callq 0x10b0
callq 0x10f0
cmpl $-0x1, %eax
je 0x380f
cmpl $0xa, %eax
jne 0x3800
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
jne 0x3367
xorl %esi, %esi
cmpl $0x1, %r14d
setne %sil
xorl %edi, %edi
callq 0x3d1f
jmp 0x3367
callq 0x10f0
cmpl $-0x1, %eax
je 0x3840
cmpl $0xa, %eax
jne 0x3831
movq 0x18(%rsp), %rdi
callq 0x1030
leaq 0x4887(%rip), %rdi      # 0x80d8
leaq 0x678(%rip), %rsi       # 0x3ed0
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x19cb
leaq 0x4918(%rip), %rdi      # 0x8180
callq 0x1b6c
movl %ebx, %eax
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b74(%rip), %rdi      # 0x53fc
jmp 0x2fec
leaq 0x1b2e(%rip), %rdi      # 0x53c2
jmp 0x2fec
leaq 0x1ae8(%rip), %rdi      # 0x5388
jmp 0x2fec
leaq 0x1aa6(%rip), %rdi      # 0x5352
jmp 0x2fec
leaq 0x1a5a(%rip), %rdi      # 0x5312
jmp 0x2fec
leaq 0x1a0e(%rip), %rdi      # 0x52d2
jmp 0x2fec
leaq 0x17dc(%rip), %rdi      # 0x50ac
movq %r13, %rsi
callq 0x10e0
xorl %ebx, %ebx
testl %eax, %eax
je 0x386d
leaq 0x17cc(%rip), %rdi      # 0x50b1
movq %r13, %rsi
callq 0x10e0
testl %eax, %eax
je 0x386d
subl $0x71, %r15d
jne 0x3900
movzbl 0x1(%r13), %r15d
negl %r15d
testl %r15d, %r15d
je 0x386d
leaq 0x17a5(%rip), %rdi      # 0x50b8
movq %r13, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x2ff1