// File: /workspace/github_c_makefile_star2_O1/michaelforney[P]cproc/driver.c
// Function: main
int
main(int argc, char *argv[])
{
	enum stage last = LINK;
	enum filetype filetype = 0;
	char *arg, *end, *output = NULL, *arch, *qbearch;
	struct array inputs = {0}, *cmd;
	struct input *input;
	size_t i;

	argv0 = progname(argv[0], "cproc");

	arrayaddbuf(&stages[PREPROCESS].cmd, preprocesscmd, sizeof(preprocesscmd));
	arrayaddptr(&stages[COMPILE].cmd, compilecommand(argv[0]));
	arrayaddbuf(&stages[CODEGEN].cmd, codegencmd, sizeof(codegencmd));
	arrayaddbuf(&stages[ASSEMBLE].cmd, assemblecmd, sizeof(assemblecmd));
	arrayaddbuf(&stages[LINK].cmd, linkcmd, sizeof(linkcmd));

	if (hasprefix(target, "x86_64-") || hasprefix(target, "amd64-")) {
		arch = "x86_64-sysv";
		qbearch = "amd64_sysv";
	} else if (hasprefix(target, "aarch64-")) {
		arch = "aarch64";
		qbearch = "arm64";
	} else if (hasprefix(target, "riscv64-")) {
		arch = "riscv64";
		qbearch = "rv64";
	} else {
		fatal("unsupported target '%s'", target);
		return 1;  /* unreachable */
	}
	arrayaddptr(&stages[COMPILE].cmd, "-t");
	arrayaddptr(&stages[COMPILE].cmd, arch);
	arrayaddptr(&stages[CODEGEN].cmd, "-t");
	arrayaddptr(&stages[CODEGEN].cmd, qbearch);

	for (;;) {
		++argv, --argc;
		arg = *argv;
		if (!arg)
			break;
		if (arg[0] != '-' || arg[1] == '\0') {
			input = arrayadd(&inputs, sizeof(*input));
			input->name = arg;
			input->lib = false;
			input->filetype = filetype == NONE && arg[1] ? detectfiletype(arg) : filetype;
			switch (input->filetype) {
			case ASM:    input->stages =                                     1<<ASSEMBLE|1<<LINK; break;
			case ASMPP:  input->stages = 1<<PREPROCESS|                      1<<ASSEMBLE|1<<LINK; break;
			case C:      input->stages = 1<<PREPROCESS|1<<COMPILE|1<<CODEGEN|1<<ASSEMBLE|1<<LINK; break;
			case CHDR:   input->stages = 1<<PREPROCESS                                          ; break;
			case CPPOUT: input->stages =               1<<COMPILE|1<<CODEGEN|1<<ASSEMBLE|1<<LINK; break;
			case QBE:    input->stages =                          1<<CODEGEN|1<<ASSEMBLE|1<<LINK; break;
			case OBJ:    input->stages =                                                 1<<LINK; break;
			default:     usage("reading from standard input requires -x");
			}
			continue;
		}
		/* TODO: use a binary search for these long parameters */
		if (strcmp(arg, "-nostdlib") == 0) {
			flags.nostdlib = true;
		} else if (strcmp(arg, "-nostdinc") == 0) {
			arrayaddptr(&stages[PREPROCESS].cmd, arg);
		} else if (strcmp(arg, "-static") == 0) {
			arrayaddptr(&stages[LINK].cmd, arg);
		} else if (strcmp(arg, "-emit-qbe") == 0) {
			last = COMPILE;
		} else if (strcmp(arg, "-include") == 0 || strcmp(arg, "-idirafter") == 0 || strcmp(arg, "-isystem") == 0 || strcmp(arg, "-iquote") == 0) {
			if (!--argc)
				usage(NULL);
			arrayaddptr(&stages[PREPROCESS].cmd, arg);
			arrayaddptr(&stages[PREPROCESS].cmd, *++argv);
		} else if (strcmp(arg, "-pipe") == 0) {
			/* ignore */
		} else if (strncmp(arg, "-std=", 5) == 0) {
			/* pass through to the preprocessor, it may
			 * affect its default definitions */
			arrayaddptr(&stages[PREPROCESS].cmd, arg);
		} else if (strcmp(arg, "-pedantic") == 0) {
			/* ignore */
		} else if (strcmp(arg, "-pthread") == 0) {
			arrayaddptr(&stages[LINK].cmd, "-l");
			arrayaddptr(&stages[LINK].cmd, "pthread");
		} else if (strcmp(arg, "-dumpmachine") == 0) {
			/* print target and exit */
			puts(target);
			return 0;
		} else {
			if (arg[2] != '\0' && strchr("cESsv", arg[1]))
				usage(NULL);
			switch (arg[1]) {
			case 'c':
				last = ASSEMBLE;
				break;
			case 'D':
				arrayaddptr(&stages[PREPROCESS].cmd, "-D");
				arrayaddptr(&stages[PREPROCESS].cmd, nextarg(&argv));
				break;
			case 'E':
				last = PREPROCESS;
				break;
			case 'g':
				/* ignore */
				break;
			case 'I':
				arrayaddptr(&stages[PREPROCESS].cmd, "-I");
				arrayaddptr(&stages[PREPROCESS].cmd, nextarg(&argv));
				break;
			case 'L':
				arrayaddptr(&stages[LINK].cmd, "-L");
				arrayaddptr(&stages[LINK].cmd, nextarg(&argv));
				break;
			case 'l':
				input = arrayadd(&inputs, sizeof(*input));
				input->name = nextarg(&argv);
				input->lib = true;
				input->filetype = OBJ;
				input->stages = 1<<LINK;
				break;
			case 'M':
				if (strcmp(arg, "-M") == 0 || strcmp(arg, "-MM") == 0) {
					arrayaddptr(&stages[PREPROCESS].cmd, arg);
					last = PREPROCESS;
				} else if (strcmp(arg, "-MD") == 0 || strcmp(arg, "-MMD") == 0) {
					arrayaddptr(&stages[PREPROCESS].cmd, arg);
				} else if (strcmp(arg, "-MT") == 0 || strcmp(arg, "-MF") == 0) {
					if (!--argc)
						usage(NULL);
					arrayaddptr(&stages[PREPROCESS].cmd, arg);
					arrayaddptr(&stages[PREPROCESS].cmd, *++argv);
				} else {
					usage(NULL);
				}
				break;
			case 'O':
				/* ignore */
				break;
			case 'o':
				output = nextarg(&argv);
				break;
			case 'P':
				arrayaddptr(&stages[PREPROCESS].cmd, "-P");
				break;
			case 'S':
				last = CODEGEN;
				break;
			case 's':
				arrayaddptr(&stages[LINK].cmd, "-s");
				break;
			case 'U':
				arrayaddptr(&stages[PREPROCESS].cmd, "-U");
				arrayaddptr(&stages[PREPROCESS].cmd, nextarg(&argv));
				break;
			case 'v':
				flags.verbose = true;
				break;
			case 'W':
				if (arg[2] && arg[3] == ',') {
					switch (arg[2]) {
					case 'p': cmd = &stages[PREPROCESS].cmd; break;
					case 'a': cmd = &stages[ASSEMBLE].cmd; break;
					case 'l': cmd = &stages[LINK].cmd; break;
					default: usage(NULL);
					}
					for (arg += 4; arg; arg = end ? end + 1 : NULL) {
						end = strchr(arg, ',');
						if (end)
							*end = '\0';
						arrayaddptr(cmd, arg);
					}
				} else {
					/* ignore warning flag */
				}
				break;
			case 'x':
				arg = nextarg(&argv);
				if (strcmp(arg, "none") == 0)
					filetype = NONE;
				else if (strcmp(arg, "c") == 0)
					filetype = C;
				else if (strcmp(arg, "c-header") == 0)
					filetype = CHDR;
				else if (strcmp(arg, "cpp-output") == 0)
					filetype = CPPOUT;
				else if (strcmp(arg, "qbe") == 0)
					filetype = QBE;
				else if (strcmp(arg, "assembler") == 0)
					filetype = ASM;
				else if (strcmp(arg, "assembler-with-cpp") == 0)
					filetype = ASMPP;
				else
					usage("unknown language '%s'", arg);
				break;
			default:
				usage("unknown option '%s'", arg);
			}
		}
	}

	for (i = 0; i < LEN(stages); ++i)
		stages[i].cmdbase = stages[i].cmd.len;
	if (inputs.len == 0)
		usage(NULL);
	if (output) {
		if (strcmp(output, "-") == 0) {
			if (last >= ASSEMBLE)
				usage("cannot write object to stdout");
		} else if (last != LINK && inputs.len > sizeof(*input)) {
			usage("cannot specify -o with multiple input files without linking");
		}
	}
	arrayforeach (&inputs, input) {
		/* ignore the input if it doesn't participate in the last stage */
		if (!(input->stages & 1 << last))
			continue;
		/* only run up through the last stage */
		input->stages &= (1 << last + 1) - 1;
		buildobj(input, output);
	}
	if (last == LINK) {
		if (!output)
			output = "a.out";
		buildexe(inputs.val, inputs.len / sizeof(*input), output);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq %rsi, %rbx
movl %edi, %ebp
movq %rsi, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq (%rsi), %rdi
leaq 0x1be6(%rip), %rsi      # 0x40c8
callq 0x37eb
leaq 0x3d4a(%rip), %rcx      # 0x6238
movq %rax, (%rcx)
leaq 0x3c50(%rip), %rdi      # 0x6148
leaq 0x37c1(%rip), %rsi      # 0x5cc0
movl $0x78, %edx
callq 0x3897
movq (%rbx), %r14
leaq 0x1dfb(%rip), %rdi      # 0x430e
leaq 0x70(%rsp), %rsi
movl $0xffb, %ebx            # imm = 0xFFB
movl $0xffb, %edx            # imm = 0xFFB
callq 0x2090
cmpq $0xffb, %rax            # imm = 0xFFB
je 0x256b
movq %rax, %rbx
cmpq $-0x1, %rax
jne 0x2579
movq %r14, %rdi
callq 0x20c0
movq %rax, %rbx
cmpq $0xffc, %rax            # imm = 0xFFC
jb 0x2559
leaq 0x1dcb(%rip), %rdi      # 0x431d
xorl %eax, %eax
callq 0x36d8
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2160
jmp 0x2579
leaq 0x1dc0(%rip), %rdi      # 0x4332
xorl %eax, %eax
callq 0x36d8
movb $0x0, 0x74(%rsp,%rbx)
movl $0x6562712d, 0x70(%rsp,%rbx) # imm = 0x6562712D
leaq 0x70(%rsp), %rdi
callq 0x2220
movq %rax, %rbx
testq %rax, %rax
jne 0x25a6
leaq 0x1db9(%rip), %rdi      # 0x4358
xorl %eax, %eax
callq 0x36d8
leaq 0x3bcb(%rip), %r14      # 0x6178
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3884
leaq 0x3be9(%rip), %rbx      # 0x61a8
leaq 0x3772(%rip), %rsi      # 0x5d38
movl $0x8, %edx
movq %rbx, %rdi
callq 0x3897
leaq 0x3bfe(%rip), %rdi      # 0x61d8
leaq 0x375f(%rip), %rsi      # 0x5d40
movl $0x8, %edx
callq 0x3897
leaq 0x3c16(%rip), %rdi      # 0x6208
leaq 0x3757(%rip), %rsi      # 0x5d50
movl $0x28, %edx
callq 0x3897
leaq 0x1adb(%rip), %r15      # 0x40e5
movq %r14, %rdi
movq %r15, %rsi
callq 0x3884
leaq 0x1ab2(%rip), %rsi      # 0x40ce
movq %r14, %rdi
callq 0x3884
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3884
leaq 0x1aa4(%rip), %rsi      # 0x40da
movq %rbx, %rdi
callq 0x3884
movq 0x10(%rsp), %r12
leaq 0x8(%r12), %rax
movq 0x8(%r12), %rbx
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x2d53
movl $0x4, 0xc(%rsp)
movq $0x0, 0x28(%rsp)
movq %rbp, 0x30(%rsp)
xorl %r13d, %r13d
movq %rax, %rbp
cmpb $0x2d, (%rbx)
jne 0x2688
movsbl 0x1(%rbx), %r14d
testl %r14d, %r14d
jne 0x27b9
movl $0x18, %esi
leaq 0x40(%rsp), %rdi
callq 0x3810
movq %rax, %r14
movq %rbx, (%rax)
movb $0x0, 0x10(%rax)
movl %r15d, %eax
testl %r15d, %r15d
je 0x26e0
movl %eax, 0xc(%r14)
decl %eax
cmpl $0x7, %eax
jae 0x31f6
movl %eax, %eax
leaq 0x19eb(%rip), %rcx      # 0x40ac
movl (%rcx,%rax,4), %eax
movl %eax, 0x8(%r14)
leaq 0x8(%rbp), %rax
movq 0x8(%rbp), %rbx
incq %r13
movq %rbp, %r12
testq %rbx, %rbx
jne 0x2672
jmp 0x2d64
cmpb $0x0, 0x1(%rbx)
movl %r15d, %eax
je 0x26a9
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x20e0
testq %rax, %rax
je 0x2773
movq %rax, %rbx
incq %rbx
movq %rbx, %rdi
leaq 0x1e08(%rip), %rsi      # 0x4513
callq 0x2140
testl %eax, %eax
je 0x277d
movq %rbx, %rdi
leaq 0x1c96(%rip), %rsi      # 0x43b4
callq 0x2140
testl %eax, %eax
je 0x2787
movq %rbx, %rdi
leaq 0x1c85(%rip), %rsi      # 0x43b6
callq 0x2140
testl %eax, %eax
je 0x2791
movq %rbx, %rdi
leaq 0x19ee(%rip), %rsi      # 0x4132
callq 0x2140
testl %eax, %eax
je 0x279b
movq %rbx, %rdi
leaq 0x1ce5(%rip), %rsi      # 0x443c
callq 0x2140
testl %eax, %eax
je 0x27a5
movq %rbx, %rdi
leaq 0x1c4e(%rip), %rsi      # 0x43b8
callq 0x2140
testl %eax, %eax
je 0x27af
movl $0x6, %eax
jmp 0x26a9
movl $0x3, %eax
jmp 0x26a9
movl $0x4, %eax
jmp 0x26a9
movl $0x5, %eax
jmp 0x26a9
movl $0x7, %eax
jmp 0x26a9
movl $0x1, %eax
jmp 0x26a9
movl $0x2, %eax
jmp 0x26a9
movq %rbp, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x1948(%rip), %rsi      # 0x4110
callq 0x2140
movq 0x30(%rsp), %rbp
leal -0x1(%rbp), %ecx
subq %r13, %rcx
testl %eax, %eax
je 0x295f
movq %rcx, (%rsp)
movq %rbx, %rdi
leaq 0x192c(%rip), %rsi      # 0x411a
callq 0x2140
testl %eax, %eax
je 0x2c7b
movq %rbx, %rdi
leaq 0x191f(%rip), %rsi      # 0x4124
callq 0x2140
testl %eax, %eax
je 0x296d
movq %rbx, %rdi
leaq 0x1910(%rip), %rsi      # 0x412c
callq 0x2140
testl %eax, %eax
je 0x29b6
movq %rbx, %rdi
leaq 0x1903(%rip), %rsi      # 0x4136
callq 0x2140
testl %eax, %eax
je 0x2979
movq %rbx, %rdi
leaq 0x18f5(%rip), %rsi      # 0x413f
callq 0x2140
testl %eax, %eax
je 0x2979
movq %rbx, %rdi
leaq 0x18e9(%rip), %rsi      # 0x414a
callq 0x2140
testl %eax, %eax
je 0x2979
movq %rbx, %rdi
leaq 0x18db(%rip), %rsi      # 0x4153
callq 0x2140
testl %eax, %eax
je 0x2979
movq %rbx, %rdi
leaq 0x18cc(%rip), %rsi      # 0x415b
callq 0x2140
testl %eax, %eax
je 0x2c8a
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x18b6(%rip), %rsi      # 0x4161
callq 0x2060
testl %eax, %eax
je 0x2c7b
movq %rbx, %rdi
leaq 0x18a5(%rip), %rsi      # 0x4167
callq 0x2140
testl %eax, %eax
je 0x2c8a
movq %rbx, %rdi
leaq 0x1898(%rip), %rsi      # 0x4171
callq 0x2140
testl %eax, %eax
je 0x29c3
movq %rbx, %rdi
leaq 0x188d(%rip), %rsi      # 0x417d
callq 0x2140
testl %eax, %eax
je 0x31e8
cmpb $0x0, 0x2(%rbx)
je 0x2920
movl $0x6, %edx
leaq 0x187b(%rip), %rdi      # 0x418a
movl %r14d, %esi
callq 0x2130
testq %rax, %rax
jne 0x33c0
movzbl 0x1(%rbx), %eax
cmpl $0x66, %eax
jg 0x29e8
leal -0x44(%rax), %ecx
cmpl $0x13, %ecx
ja 0x2b39
leaq 0x16d0(%rip), %rdx      # 0x4010
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x37f8(%rip), %rbx      # 0x6148
movq %rbx, %rdi
leaq 0x1836(%rip), %rsi      # 0x4190
jmp 0x2bca
movb $0x1, 0x38cb(%rip)      # 0x6231
movl %ecx, %ebp
jmp 0x2c8e
leaq 0x3894(%rip), %rdi      # 0x6208
jmp 0x2c82
addl $-0x2, %ebp
cmpl %r13d, %ebp
je 0x33bb
subq %r13, %rbp
leaq 0x37b9(%rip), %r14      # 0x6148
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3884
leaq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0x3884
jmp 0x2c8e
movl $0x1, 0xc(%rsp)
jmp 0x2c8a
leaq 0x383e(%rip), %rbx      # 0x6208
movq %rbx, %rdi
leaq 0x17a6(%rip), %rsi      # 0x417a
callq 0x3884
movq %rbx, %rdi
leaq 0x178f(%rip), %rsi      # 0x4172
jmp 0x2c85
leal -0x6f(%rax), %ecx
cmpl $0x9, %ecx
ja 0x2a14
leaq 0x1669(%rip), %rdx      # 0x4060
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x10(%rsp), %rdi
callq 0x34d2
movq %rax, 0x28(%rsp)
jmp 0x2c8a
cmpl $0x6c, %eax
je 0x2b03
cmpl $0x67, %eax
je 0x2c8a
jmp 0x33d0
leaq 0x37d6(%rip), %rdi      # 0x6208
leaq 0x177b(%rip), %rsi      # 0x41b4
jmp 0x2c85
movb $0x1, 0x37ed(%rip)      # 0x6232
jmp 0x2c8a
leaq 0x10(%rsp), %rdi
callq 0x34d2
movq %rax, %rbx
movq %rax, %rdi
leaq 0x1759(%rip), %rsi      # 0x41ba
callq 0x2140
testl %eax, %eax
je 0x2cde
movq %rbx, %rdi
leaq 0x1a9b(%rip), %rsi      # 0x4513
callq 0x2140
testl %eax, %eax
je 0x2ce3
movq %rbx, %rdi
leaq 0x1730(%rip), %rsi      # 0x41bf
callq 0x2140
testl %eax, %eax
je 0x2ceb
movq %rbx, %rdi
leaq 0x1722(%rip), %rsi      # 0x41c8
callq 0x2140
testl %eax, %eax
je 0x2cf3
movq %rbx, %rdi
leaq 0x1675(%rip), %rsi      # 0x4132
callq 0x2140
testl %eax, %eax
je 0x2d3d
movq %rbx, %rdi
leaq 0x16ff(%rip), %rsi      # 0x41d3
callq 0x2140
testl %eax, %eax
je 0x2d48
movq %rbx, %rdi
leaq 0x16f2(%rip), %rsi      # 0x41dd
callq 0x2140
testl %eax, %eax
jne 0x33c7
movl $0x2, %r15d
jmp 0x2c8a
movl $0x18, %esi
leaq 0x40(%rsp), %rdi
callq 0x3810
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x34d2
movq %rax, (%rbx)
movb $0x1, 0x10(%rbx)
movabsq $0x600000010, %rax      # imm = 0x600000010
movq %rax, 0x8(%rbx)
jmp 0x2c8a
cmpl $0x63, %eax
jne 0x33d0
movl $0x3, 0xc(%rsp)
jmp 0x2c8a
leaq 0x35f2(%rip), %rbx      # 0x6148
movq %rbx, %rdi
leaq 0x1657(%rip), %rsi      # 0x41b7
jmp 0x2bca
movzbl 0x2(%rbx), %eax
testl %eax, %eax
je 0x2c8a
cmpb $0x2c, 0x3(%rbx)
jne 0x2c8a
leaq 0x35c9(%rip), %r14      # 0x6148
cmpl $0x70, %eax
je 0x2d02
cmpl $0x6c, %eax
je 0x2cfb
cmpl $0x61, %eax
jne 0x33c0
leaq 0x3637(%rip), %r14      # 0x61d8
jmp 0x2d02
leaq 0x359b(%rip), %rbx      # 0x6148
movq %rbx, %rdi
leaq 0x15dc(%rip), %rsi      # 0x4193
jmp 0x2bca
leaq 0x3648(%rip), %rbx      # 0x6208
movq %rbx, %rdi
leaq 0x15cc(%rip), %rsi      # 0x4196
callq 0x3884
leaq 0x10(%rsp), %rdi
callq 0x34d2
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x2c85
movq %rbx, %rdi
leaq 0x15ab(%rip), %rsi      # 0x4199
callq 0x2140
testl %eax, %eax
je 0x2cc5
movq %rbx, %rdi
leaq 0x1597(%rip), %rsi      # 0x419c
callq 0x2140
testl %eax, %eax
je 0x2cc5
movq %rbx, %rdi
leaq 0x1584(%rip), %rsi      # 0x41a0
callq 0x2140
testl %eax, %eax
je 0x2c7b
movq %rbx, %rdi
leaq 0x1575(%rip), %rsi      # 0x41a4
callq 0x2140
testl %eax, %eax
je 0x2c7b
movq %rbx, %rdi
leaq 0x1567(%rip), %rsi      # 0x41a9
callq 0x2140
testl %eax, %eax
je 0x2c62
movq %rbx, %rdi
leaq 0x1558(%rip), %rsi      # 0x41ad
callq 0x2140
testl %eax, %eax
jne 0x33c0
movq 0x30(%rsp), %rax
addl $-0x2, %eax
cmpl %r13d, %eax
je 0x33c0
movq %rax, %rbp
jmp 0x2985
leaq 0x34c6(%rip), %rdi      # 0x6148
movq %rbx, %rsi
callq 0x3884
movq (%rsp), %rbp
movq 0x10(%rsp), %r12
leaq 0x8(%r12), %rax
movq 0x8(%r12), %rbx
testq %rbx, %rbx
jne 0x266a
jmp 0x2d64
leaq 0x3496(%rip), %rdi      # 0x6148
leaq 0x14f8(%rip), %rsi      # 0x41b1
jmp 0x2c85
movl $0x2, 0xc(%rsp)
jmp 0x2c8a
leaq 0x347c(%rip), %rdi      # 0x6148
movq %rbx, %rsi
callq 0x3884
movl $0x0, 0xc(%rsp)
jmp 0x2c8a
xorl %r15d, %r15d
jmp 0x2c8a
movl $0x3, %r15d
jmp 0x2c8a
movl $0x4, %r15d
jmp 0x2c8a
movl $0x5, %r15d
jmp 0x2c8a
leaq 0x3506(%rip), %r14      # 0x6208
addq $0x4, %rbx
movq %rbx, %rdi
movl $0x2c, %esi
callq 0x20d0
movq %rax, %r13
testq %rax, %rax
je 0x2d20
movb $0x0, (%r13)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3884
leaq 0x1(%r13), %rbx
testq %r13, %r13
cmoveq %r13, %rbx
jne 0x2d06
jmp 0x2c8a
movl $0x7, %r15d
jmp 0x2c8a
movl $0x1, %r15d
jmp 0x2c8a
movl $0x4, 0xc(%rsp)
movq $0x0, 0x28(%rsp)
movq %rax, 0x10(%rsp)
xorl %eax, %eax
leaq 0x33ce(%rip), %r15      # 0x6140
movq 0x10(%rax,%r15), %rcx
movq %rcx, 0x20(%rax,%r15)
addq $0x30, %rax
cmpq $0xf0, %rax
jne 0x2d72
movq 0x48(%rsp), %rbx
testq %rbx, %rbx
je 0x3223
cmpq $0x0, 0x28(%rsp)
je 0x2ddd
leaq 0x1475(%rip), %rsi      # 0x421a
movq 0x28(%rsp), %rdi
callq 0x2140
testl %eax, %eax
je 0x2dd2
cmpl $0x4, 0xc(%rsp)
sete %al
cmpq $0x19, %rbx
setb %cl
orb %al, %cl
jne 0x2ddd
leaq 0x146d(%rip), %rdi      # 0x423a
jmp 0x3202
cmpl $0x3, 0xc(%rsp)
jae 0x33af
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %rbx
testq %rbx, %rbx
je 0x31ca
movl $0x1, %ebp
movl 0xc(%rsp), %ecx
shll %cl, %ebp
movl $0x2, %r12d
shll %cl, %r12d
decl %r12d
movl %ebp, 0x3c(%rsp)
movl %r12d, 0x38(%rsp)
movl 0x8(%r14), %eax
testl %ebp, %eax
je 0x31ad
andl %r12d, %eax
movl %eax, 0x8(%r14)
cmpl $0x6, 0xc(%r14)
je 0x31ad
testb $0x10, %al
jne 0x2e5c
movq 0x28(%rsp), %rbx
testq %rbx, %rbx
je 0x2eaa
movq %rbx, %rdi
leaq 0x13d4(%rip), %rsi      # 0x421a
callq 0x2140
testl %eax, %eax
movl $0x0, %r13d
cmovneq %rbx, %r13
jmp 0x2ee5
andl $-0x11, %eax
movl %eax, 0x8(%r14)
leaq 0x15a6(%rip), %rdi      # 0x4410
callq 0x2220
movq %rax, %r13
testq %rax, %rax
jne 0x2e85
leaq 0x14da(%rip), %rdi      # 0x4358
xorl %eax, %eax
callq 0x36d8
movq %r13, %rdi
callq 0x2190
movl %eax, %ebx
testl %eax, %eax
jns 0x2ea1
leaq 0x1588(%rip), %rdi      # 0x4422
xorl %eax, %eax
callq 0x36d8
movl %ebx, %edi
callq 0x2100
jmp 0x2ee5
testb $0x8, %al
jne 0x2ebb
testb $0x4, %al
jne 0x2ec7
testb $0x2, %al
jne 0x2ed3
xorl %r13d, %r13d
jmp 0x2ee5
movq (%r14), %rdi
leaq 0x1583(%rip), %rsi      # 0x4448
jmp 0x2edd
movq (%r14), %rdi
leaq 0x156b(%rip), %rsi      # 0x443c
jmp 0x2edd
movq (%r14), %rdi
leaq 0x1255(%rip), %rsi      # 0x4132
callq 0x34fa
movq %rax, %r13
movq (%r14), %rdi
leaq 0x132b(%rip), %rsi      # 0x421a
callq 0x2140
testl %eax, %eax
jne 0x2eff
movq $0x0, (%r14)
movq %r13, (%rsp)
movl 0x8(%r14), %ebx
testl %ebx, %ebx
movq %r14, 0x60(%rsp)
je 0x30b3
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
xorl %ebp, %ebp
leaq 0x3243(%rip), %r13      # 0x6168
xorl %r12d, %r12d
movl $0x1, %eax
movl %ebp, %ecx
shll %cl, %eax
btl %ebp, %ebx
jae 0x309f
movq %r12, 0x30(%rsp)
notl %eax
andl %eax, %ebx
leaq -0x20(%r13), %r12
movl %ebx, 0x8(%r14)
movq (%r14), %r14
movq -0x8(%r13), %rax
movq %rax, -0x18(%r13)
cmpq $0x0, (%rsp)
je 0x2f7c
testl %ebx, %ebx
jne 0x2f7c
movq %r12, %rdi
leaq 0x14dc(%rip), %rsi      # 0x4447
callq 0x3884
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x3884
testq %r14, %r14
je 0x2f93
cmpl $-0x1, 0x24(%rsp)
jne 0x2f93
movq %r12, %rdi
movq %r14, %rsi
callq 0x3884
movq %r12, %rdi
xorl %esi, %esi
callq 0x3884
leaq 0x70(%rsp), %rdi
callq 0x2030
testl %eax, %eax
je 0x2fb7
movl %eax, %edi
movq 0x30(%rsp), %r12
jmp 0x3093
movq %r12, 0x68(%rsp)
movl 0x24(%rsp), %esi
cmpl $-0x1, %esi
movq 0x30(%rsp), %r12
je 0x2fd6
leaq 0x70(%rsp), %rdi
xorl %edx, %edx
callq 0x2210
testl %ebx, %ebx
je 0x3035
leaq 0x1c(%rsp), %rdi
callq 0x2110
testl %eax, %eax
js 0x307e
movl 0x1c(%rsp), %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x20a0
testl %eax, %eax
js 0x305c
movl 0x20(%rsp), %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x20a0
testl %eax, %eax
js 0x305c
movl 0x20(%rsp), %esi
leaq 0x70(%rsp), %rdi
movl $0x1, %edx
callq 0x2210
testl %eax, %eax
jne 0x3063
movq %r13, %rdi
movq 0x68(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x360b
testl %eax, %eax
jne 0x3063
xorl %r14d, %r14d
testl %ebx, %ebx
je 0x3086
movl 0x1c(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x3073
callq 0x2040
movl (%rax), %eax
movl %eax, %r14d
testl %ebx, %ebx
je 0x3086
movl 0x1c(%rsp), %edi
callq 0x2100
movl 0x20(%rsp), %edi
callq 0x2100
jmp 0x3086
callq 0x2040
movl (%rax), %r14d
leaq 0x70(%rsp), %rdi
callq 0x20b0
movl %r14d, %edi
testl %edi, %edi
jne 0x30c7
incq %r12
movq 0x60(%rsp), %r14
movl 0x8(%r14), %ebx
addq $0x30, %r13
incl %ebp
testl %ebx, %ebx
jne 0x2f28
jmp 0x30b6
xorl %r12d, %r12d
movq (%rsp), %rax
movq %rax, (%r14)
movb $0x1, %r14b
leaq 0x70(%rsp), %r13
jmp 0x312b
movq -0x28(%r13), %rbx
movq -0x20(%r13), %rax
movq (%rax), %r13
callq 0x2230
leaq 0x134d(%rip), %rdi      # 0x442b
movq %rbx, %rsi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3650
movb $0x1, %r14b
leaq 0x70(%rsp), %r13
movl %r14d, %eax
xorl %r14d, %r14d
testb $0x1, %al
je 0x312b
testq %r12, %r12
je 0x312b
xorl %r14d, %r14d
movl 0x28(%r14,%r15), %edi
testl %edi, %edi
je 0x311b
movl $0xf, %esi
callq 0x2170
addq $0x30, %r14
cmpq $0xf0, %r14
jne 0x3108
xorl %r14d, %r14d
testq %r12, %r12
je 0x3199
movq %r13, %rdi
callq 0x2240
movl %eax, %ebp
testl %eax, %eax
jns 0x314c
leaq 0x12f9(%rip), %rdi      # 0x443e
xorl %eax, %eax
callq 0x36d8
xorl %eax, %eax
cmpl 0x28(%rax,%r15), %ebp
je 0x3165
addq $0x30, %rax
cmpq $0xf0, %rax
jne 0x314e
movb $0x1, %al
jmp 0x317e
decq %r12
movl $0x0, 0x28(%rax,%r15)
movq (%rax,%r15), %rbx
cmpq $0xf0, %rax
sete %al
testb %al, %al
jne 0x312b
movl 0x70(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x358a
testb %al, %al
jne 0x312b
jmp 0x30f6
testb $0x1, %r14b
movq 0x60(%rsp), %r14
movl 0x3c(%rsp), %ebp
movl 0x38(%rsp), %r12d
je 0x3209
addq $0x18, %r14
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %rbx
leaq (%rbx,%r13), %rax
cmpq %rax, %r14
jne 0x2e10
jmp 0x31cd
movq %r14, %r13
cmpl $0x4, 0xc(%rsp)
je 0x3228
xorl %eax, %eax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xea1(%rip), %rdi       # 0x4090
callq 0x2080
jmp 0x31d4
movq %rbp, 0x10(%rsp)
leaq 0xee6(%rip), %rdi       # 0x40e8
xorl %eax, %eax
callq 0x33e1
cmpq $0x0, (%rsp)
je 0x3219
movq (%rsp), %rdi
callq 0x2050
movl $0x1, %edi
callq 0x2200
callq 0x228b
movq 0x28(%rsp), %rax
testq %rax, %rax
leaq 0x103f(%rip), %r15      # 0x4276
cmovneq %rax, %r15
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
movq %rbx, %rax
mulq %rcx
movq %rdx, %r12
leaq 0x2fb3(%rip), %r14      # 0x6208
leaq 0x11eb(%rip), %rsi      # 0x4447
movq %r14, %rdi
callq 0x3884
movq %r14, %rdi
movq %r15, %rsi
callq 0x3884
cmpb $0x0, 0x2fbb(%rip)      # 0x6231
jne 0x3290
leaq 0x2f89(%rip), %rdi      # 0x6208
leaq 0x2afa(%rip), %rsi      # 0x5d80
movl $0x30, %edx
callq 0x3897
shrq $0x4, %r12
cmpq $0x18, %rbx
jb 0x32d2
leaq 0x10(%r13), %rbp
leaq 0x2f63(%rip), %r15      # 0x6208
movq %r12, %r14
cmpb $0x1, (%rbp)
jne 0x32bd
movq %r15, %rdi
leaq 0xec2(%rip), %rsi       # 0x417a
callq 0x3884
movq -0x10(%rbp), %rsi
movq %r15, %rdi
callq 0x3884
addq $0x18, %rbp
decq %r14
jne 0x32a8
cmpb $0x0, 0x2f58(%rip)      # 0x6231
jne 0x32f3
leaq 0x2f26(%rip), %rdi      # 0x6208
leaq 0x2ac7(%rip), %rsi      # 0x5db0
movl $0x30, %edx
callq 0x3897
leaq 0x2f0e(%rip), %r15      # 0x6208
movq %r15, %rdi
xorl %esi, %esi
callq 0x3884
leaq 0x1c(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x360b
testl %eax, %eax
je 0x334b
movq 0x2ee2(%rip), %r15      # 0x6200
movq 0x2ee3(%rip), %rax      # 0x6208
movq (%rax), %r14
callq 0x2040
movl (%rax), %edi
callq 0x2230
leaq 0x10f0(%rip), %rdi      # 0x442b
movq %r15, %rsi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x36d8
movl 0x1c(%rsp), %edi
leaq 0x70(%rsp), %rsi
xorl %edx, %edx
callq 0x21d0
testl %eax, %eax
jns 0x3372
movslq 0x1c(%rsp), %rsi
leaq 0x113e(%rip), %rdi      # 0x44a9
xorl %eax, %eax
callq 0x36d8
cmpq $0x18, %rbx
jb 0x3391
cmpl $0x6, 0xc(%r13)
je 0x3388
movq (%r13), %rdi
callq 0x2050
addq $0x18, %r13
decq %r12
jne 0x3378
movq 0x2e68(%rip), %rdi      # 0x6200
movl 0x1c(%rsp), %esi
movl 0x70(%rsp), %edx
callq 0x358a
xorb $0x1, %al
movzbl %al, %edi
callq 0x2200
leaq 0xe66(%rip), %rdi       # 0x421c
jmp 0x3202
callq 0x2260
xorl %edi, %edi
jmp 0x3202
leaq 0xe22(%rip), %rdi       # 0x41f0
jmp 0x33d7
leaq 0xe2f(%rip), %rdi       # 0x4206
movq %rbx, %rsi
xorl %eax, %eax
callq 0x33e1