// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x5b83(%rip), %rdi      # 0xa170
leaq 0x2a26(%rip), %rsi      # 0x701a
callq 0x2340
cmpl $0x0, %eax
je 0x4618
leaq 0x2a1b(%rip), %rdi      # 0x7020
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
cmpl $0x1, -0x8(%rbp)
jle 0x4bba
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4bac
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x29e8(%rip), %rdi      # 0x7038
callq 0x10c0
cmpl $0x0, %eax
je 0x466f
movq -0x20(%rbp), %rsi
leaq 0x29da(%rip), %rdi      # 0x703f
callq 0x10c0
cmpl $0x0, %eax
jne 0x46dd
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x46be
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1140
movl %eax, -0x24(%rbp)
cmpl $0x1, -0x24(%rbp)
jge 0x46b4
leaq 0x29a0(%rip), %rdi      # 0x7041
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
movl -0x24(%rbp), %edi
callq 0x4bf0
jmp 0x46d8
leaq 0x29b7(%rip), %rdi      # 0x707c
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
jmp 0x4b9c
movq -0x20(%rbp), %rsi
leaq 0x29cf(%rip), %rdi      # 0x70b7
callq 0x10c0
cmpl $0x0, %eax
je 0x4707
movq -0x20(%rbp), %rsi
leaq 0x291b(%rip), %rdi      # 0x7018
callq 0x10c0
cmpl $0x0, %eax
jne 0x4775
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4756
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1140
movl %eax, -0x28(%rbp)
cmpl $0x1, -0x28(%rbp)
jge 0x474c
leaq 0x2908(%rip), %rdi      # 0x7041
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
movl -0x28(%rbp), %edi
callq 0x4cb0
jmp 0x4770
leaq 0x2961(%rip), %rdi      # 0x70be
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
jmp 0x4b9a
movq -0x20(%rbp), %rsi
leaq 0x2979(%rip), %rdi      # 0x70f9
callq 0x10c0
cmpl $0x0, %eax
je 0x479f
movq -0x20(%rbp), %rsi
leaq 0x2969(%rip), %rdi      # 0x70fe
callq 0x10c0
cmpl $0x0, %eax
jne 0x480d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x47ee
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1140
movl %eax, -0x2c(%rbp)
cmpl $0x1, -0x2c(%rbp)
jge 0x47e4
leaq 0x2870(%rip), %rdi      # 0x7041
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
movl -0x2c(%rbp), %edi
callq 0x4d50
jmp 0x4808
leaq 0x290b(%rip), %rdi      # 0x7100
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
jmp 0x4b98
movq -0x20(%rbp), %rsi
leaq 0x291f(%rip), %rdi      # 0x7137
callq 0x10c0
cmpl $0x0, %eax
je 0x4837
movq -0x20(%rbp), %rsi
leaq 0x2910(%rip), %rdi      # 0x713d
callq 0x10c0
cmpl $0x0, %eax
jne 0x4841
callq 0x5420
jmp 0x4b96
movq -0x20(%rbp), %rsi
leaq 0x28f3(%rip), %rdi      # 0x713f
callq 0x10c0
cmpl $0x0, %eax
je 0x486f
movq -0x20(%rbp), %rsi
leaq 0x298a(%rip), %rdi      # 0x71eb
callq 0x10c0
cmpl $0x0, %eax
jne 0x4917
leaq 0x2b50(%rip), %rax      # 0x73c6
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl -0x8(%rbp), %eax
jge 0x4909
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x28a4(%rip), %rdi      # 0x7145
callq 0x10c0
cmpl $0x0, %eax
je 0x48ef
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x2886(%rip), %rdi      # 0x7149
callq 0x10c0
cmpl $0x0, %eax
je 0x48ef
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x2867(%rip), %rdi      # 0x714c
callq 0x10c0
cmpl $0x0, %eax
jne 0x4907
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
jmp 0x4909
movq -0x38(%rbp), %rdi
callq 0x4db0
jmp 0x4b94
movq -0x20(%rbp), %rsi
leaq 0x282f(%rip), %rdi      # 0x7151
callq 0x10c0
cmpl $0x0, %eax
jne 0x496f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4950
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4ee0
jmp 0x496a
leaq 0x27ff(%rip), %rdi      # 0x7156
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
jmp 0x4b92
movq -0x20(%rbp), %rsi
leaq 0x281d(%rip), %rdi      # 0x7197
callq 0x10c0
cmpl $0x0, %eax
jne 0x49c7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x49a8
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x50b0
jmp 0x49c2
leaq 0x27ed(%rip), %rdi      # 0x719c
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
jmp 0x4b90
movq -0x20(%rbp), %rsi
leaq 0x2812(%rip), %rdi      # 0x71e4
callq 0x10c0
cmpl $0x0, %eax
jne 0x4ae3
movq $0x0, -0x40(%rbp)
movl $0x1, -0x4c(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl -0x8(%rbp), %eax
jge 0x4ade
cmpl $0x0, -0x4c(%rbp)
jne 0x4a38
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x27c1(%rip), %rdi      # 0x71dd
callq 0x10c0
cmpl $0x0, %eax
jne 0x4a36
movl $0x0, -0x4c(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4a38
movl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl -0x8(%rbp), %eax
jge 0x4ad2
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x4d(%rbp)
je 0x4a85
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
setne %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
testb $0x1, %al
jne 0x4a8e
jmp 0x4a9c
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x4a64
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x4ac8
movq -0x48(%rbp), %rsi
leaq 0x2730(%rip), %rdi      # 0x71e3
callq 0x1040
cmpl $0x0, %eax
jne 0x4ac8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4ad0
movq $0x0, -0x40(%rbp)
jmp 0x4ad2
movq -0x40(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x5180
jmp 0x4b8e
movq -0x20(%rbp), %rsi
leaq 0x26fa(%rip), %rdi      # 0x71e8
callq 0x10c0
cmpl $0x0, %eax
je 0x4b22
movq -0x20(%rbp), %rsi
leaq 0x26ea(%rip), %rdi      # 0x71ed
callq 0x10c0
cmpl $0x0, %eax
je 0x4b22
movq -0x20(%rbp), %rsi
leaq 0x26d7(%rip), %rdi      # 0x71ef
callq 0x10c0
cmpl $0x0, %eax
jne 0x4b29
callq 0x5600
jmp 0x4b8c
movq -0x20(%rbp), %rsi
leaq 0x26bd(%rip), %rdi      # 0x71f1
callq 0x10c0
cmpl $0x0, %eax
je 0x4b68
movq -0x20(%rbp), %rsi
leaq 0x26ad(%rip), %rdi      # 0x71f6
callq 0x10c0
cmpl $0x0, %eax
je 0x4b68
movq -0x20(%rbp), %rsi
leaq 0x269d(%rip), %rdi      # 0x71fb
callq 0x10c0
cmpl $0x0, %eax
jne 0x4b71
movl $0x0, -0x4(%rbp)
jmp 0x4be5
movq -0x20(%rbp), %rsi
leaq 0x2681(%rip), %rdi      # 0x71fd
movb $0x0, %al
callq 0x1090
movl $0x1, -0x4(%rbp)
jmp 0x4be5
jmp 0x4b8e
jmp 0x4b90
jmp 0x4b92
jmp 0x4b94
jmp 0x4b96
jmp 0x4b98
jmp 0x4b9a
jmp 0x4b9c
jmp 0x4b9e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4629
leaq 0x2483(%rip), %rdi      # 0x7036
movb $0x0, %al
callq 0x1090
callq 0x5600
leaq 0x2470(%rip), %rdi      # 0x7036
movb $0x0, %al
callq 0x1090
callq 0x5620
leaq 0x5597(%rip), %rdi      # 0xa170
callq 0x2310
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop