// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/main.cpp
// Function: main
int main(int argc, char** argv) {
	char exepath[1024];
	int c;
	int only_preprocess = 0;
	int disas_flag = 0;
	char oname_buf[2048], *oname = oname_buf;
	char *headers = 0;
	char *cppcmd = 0;
	const char *req_api = "350";
	char *systemhdr_dir = NULL;
	int abi = 350;

	set_compiler_default_options();

	while((c = getopt(argc, argv, "gWESD:A:a:f:i:H:o:P:")) != EOF) switch(c) {
		case 'a': abi = atoi(optarg); break;
		case 'A': req_api = optarg; break;
		case 'i': systemhdr_dir = optarg; break;
		case 'f': process_compiler_option(optarg); break;
		case 'o': oname = optarg; break;
		case 'H': headers = optarg; break;
		case 'P': cppcmd = optarg; break;
		case 'D': parse_macro(optarg); break;
		case 'E': only_preprocess = 1; break;
		case 'W': ccPrintAllErrors = 1; break;
		case 'S': disas_flag = 1; break;
		case 'g':
			add_macro("DEBUG", "1");
			ccSetOption(SCOPT_LINENUMBERS, 1);
			ccSetOption(SCOPT_CHECKBOUNDS, 1);
			break;
		default: return usage(argv[0]);
	}
	if(!argv[optind]) return usage(argv[0]);
	if(optind +1 != argc) {
		fprintf(stderr, "error: only one filename can be passed.\n"
				"arguments after first filename:\n");
		for(c=optind+1;c<argc;c++)
			fprintf(stderr, "%s\n", argv[c]);
		return usage(argv[0]);
	}
	char *filename = argv[optind];

	add_macro("__ASCC__", "3");
	add_macro("__ASCC_MINOR__", "5");

	// Editor/AGS.Editor/AGSEditor.cs
	add_macro("AGS_SUPPORTS_IFVER", "1");

	// FIXME: these should all be toggled by options
	//add_macro("STRICT", "1");
	add_macro("LRPRECEDENCE", "1");
	//add_macro("STRICT_STRINGS", "1");
	//add_macro("STRICT_AUDIO", "1");
	add_macro("NEW_DIALOGOPTS_API", "1");

        // Don't allow them to override imports in the room script
	// FIXME needs better check for whether it's a roomfile
        ccSetOption(SCOPT_NOIMPORTOVERRIDE, !!strstr(filename, "room") );

	if(abi < 271) {
		cc_set_max_command(SCMD_SHIFTRIGHT);
		ccSetOption(SCOPT_CHECKBOUNDS, 0);
		//ccSetOption(SCOPT_EXPLICITRET, 0);
	} else {
		add_macro("AGS_NEW_STRINGS", "1");
	}

	unsigned i;
	{
		int enable_api = 0;
		char abuf[16];
		snprintf(abuf, sizeof abuf, "%s000", req_api);
		add_macro("SCRIPT_API", abuf);
		for(i=0;apiv[i];++i) {
			char buf[64];
			// enable only requested and lower APIs
			if(!enable_api) {
				if(!strcmp(req_api, apiv[i]))
					enable_api = 1;
			} else
			// do not activate 3.x APIs for 2.x and vice versa
				if(req_api[0] != apiv[i][0])
					enable_api = 0;

			if(enable_api) {
				sprintf(buf, "SCRIPT_API_v%s", apiv[i]);
				add_macro(buf, "1");
				sprintf(buf, "SCRIPT_COMPAT_v%s", apiv[i]);
				add_macro(buf, "1");
			}
		}
	}

	FILE *f;
	char filename_wo_ext[2048];
	char *p = filename, *e = strrchr(filename, '.');
	char *q = filename_wo_ext;
	if(!e) return usage(argv[0]);
	while(p < e) *(q++) = *(p++);
	*q = 0;
	q = getbasename(filename_wo_ext);

	if(!opt_freestanding) {
		snprintf(oname_buf, sizeof oname_buf, "%s/agsdefns.sh", systemhdr_dir?systemhdr_dir:"systemhdrs");
		f = fopen(oname_buf, "r");
		if(!f && !systemhdr_dir && search_executable_dir(argv[0], exepath, sizeof exepath)) {
			snprintf(oname_buf, sizeof oname_buf, "%s/%s/agsdefns.sh", exepath, "systemhdrs");
			f = fopen(oname_buf, "r");
		}
		if(!f) fprintf(stderr, "warning: default header agsdefns.sh not found, you may want to set -i to the dir containing it!\n");
		else preproc_add(f, "_BuiltInScriptHeader.ash", !!cppcmd);
	}
	if(headers && !load_headers(headers, !!cppcmd)) return 1;

	if(oname == oname_buf) {
		if(only_preprocess)
			sprintf(oname, "%s.i", filename_wo_ext);
		else if(disas_flag)
			sprintf(oname, "%s.s", filename_wo_ext);
		else
			sprintf(oname, "%s.o", filename_wo_ext);
	}

	f = fopen(filename, "r");
	if(!f) {
		fprintf(stderr, "error opening %s\n", filename);
		return 1;
	}
	char *mem = slurp_file(f);
	if(only_preprocess) {
		char *outp;
		if(cppcmd) {
			outp = run_cpp(cppcmd, mem);
			if(!outp) return 1;
		} else {
			// FIXME, buf may be to small for elab. macro expansions
			outp = (char*)malloc(strlen(mem)*2+5000);
			cc_preprocess(mem, outp);
		}
		f = fopen(oname, "w");
		if(!f) {
			fprintf(stderr, "error opening %s\n", oname);
			return 1;
		}
		fwrite(outp, 1, strlen(outp), f);
		fclose(f);
		return ccError != 0;
	} else if(cppcmd) {
		char *outp = run_cpp(cppcmd, mem);
		if(!outp) return 1;
		free(mem);
		mem = outp;
	}
	ccScript* obj = ccCompileText(mem, q);
	if(!obj || (ccError != 0)) {
		std::cerr << ccErrorString;
		std::cerr << std::endl;
		return 1;
		//std::cout << ccErrorLine;
	} else {
		char *fn;
		if(disas_flag) fn = tempfile();
		else fn = strdup(oname);
		FileWriteStream fout;
		if(!fout.Open(fn)) {
			fprintf(stderr, "error opening %s\n", fn);
			return 1;
		}
		obj->Write(&fout);
		fout.Close();
		if(disas_flag) {
			char cmd[2048 + 64], *out_tmp = tempfile();
			sprintf(cmd, "agsdisas %s %s", fn, out_tmp);
			int status = system(cmd);
			if(status == -1 || !WIFEXITED(status)) {
				fprintf(stderr, "agsdisas failed! : ");
				perror("");
				return 1;
			}
			if(rename(out_tmp, oname) == -1) {
				perror("rename");
				return 1;
			}
			unlink(fn);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2458, %rsp           # imm = 0x2458
movq %rsi, %r13
movl %edi, %r14d
leaq 0x1669d(%rip), %rdi     # 0x1a234
callq 0x16b68
movq $0x0, 0x18(%rsp)
movl $0x4, %edi
xorl %esi, %esi
callq 0x14089
movl $0x1, %edi
movl $0x1, %esi
callq 0x14089
movl $0x20, %edi
xorl %esi, %esi
callq 0x14089
movl $0x40, %edi
movl $0x1, %esi
callq 0x14089
movl $0x80, %edi
movl $0x1, %esi
callq 0x14089
leaq 0xc50(%rsp), %rax
movq %rax, 0x40(%rsp)
movl $0x15e, 0x10(%rsp)      # imm = 0x15E
leaq 0x16450(%rip), %rax     # 0x1a056
movq %rax, 0x8(%rsp)
leaq 0x16448(%rip), %rbx     # 0x1a05a
leaq 0x163eb(%rip), %rbp     # 0x1a004
movq 0x21388(%rip), %r12     # 0x24fa8
leaq 0x195c1(%rip), %rax     # 0x1d1e8
movq %rax, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x0, 0x4(%rsp)
xorl %eax, %eax
movq %r13, 0x28(%rsp)
movl %eax, %r15d
movl %r14d, %edi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x30f0
cmpl $0x56, %eax
jg 0x3c95
cmpl $0x4f, %eax
jg 0x3d22
leal -0x41(%rax), %ecx
cmpl $0x7, %ecx
ja 0x3e7d
movslq (%rbp,%rcx,4), %rcx
addq %rbp, %rcx
movl $0x1, %eax
jmpq *%rcx
movq (%r12), %rax
movq %rax, 0x8(%rsp)
movl %r15d, %eax
jmp 0x3c4d
leal -0x66(%rax), %ecx
cmpl $0x9, %ecx
ja 0x3cfb
leaq 0x16380(%rip), %rdx     # 0x1a024
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %rbp, %r13
movq (%r12), %r12
movq %r12, %rdi
movl $0x3d, %esi
callq 0x3180
testq %rax, %rax
je 0x3df7
movq %rax, %rbp
movb $0x0, (%rax)
movq %r12, %rdi
callq 0x13fc8
testl %eax, %eax
je 0x3e41
movl %eax, %ebx
incq %rbp
movq %rbp, %rdi
callq 0x34c0
movl %ebx, %edi
movl %eax, %esi
callq 0x14089
jmp 0x3e5f
cmpl $0x57, %eax
je 0x3de2
cmpl $0x61, %eax
jne 0x436a
movq (%r12), %rdi
callq 0x34c0
movl %eax, 0x10(%rsp)
movl %r15d, %eax
jmp 0x3c4d
cmpl $0x50, %eax
je 0x3dd1
cmpl $0x53, %eax
jne 0x436a
movl $0x1, 0x4(%rsp)
movl %r15d, %eax
jmp 0x3c4d
movq (%r12), %rax
movq %rax, 0x40(%rsp)
movl %r15d, %eax
jmp 0x3c4d
leaq 0x16313(%rip), %rdi     # 0x1a06f
leaq 0x18369(%rip), %rsi     # 0x1c0cc
callq 0x45e8
movl $0x4, %edi
movl $0x1, %esi
callq 0x14089
movl $0x100, %edi            # imm = 0x100
movl $0x1, %esi
callq 0x14089
movl %r15d, %eax
jmp 0x3c4d
movq (%r12), %rax
movq %rax, 0x38(%rsp)
movl %r15d, %eax
jmp 0x3c4d
movq (%r12), %r12
movq %r12, %rdi
movl $0x3d, %esi
callq 0x3180
testq %rax, %rax
je 0x3e1a
movq %rax, %rsi
incq %rsi
movb $0x0, (%rax)
jmp 0x3e1c
movq (%r12), %rax
movq %rax, 0x20(%rsp)
movl %r15d, %eax
jmp 0x3c4d
movq (%r12), %rax
movq %rax, 0x18(%rsp)
movl %r15d, %eax
jmp 0x3c4d
leaq 0x218d3(%rip), %rax     # 0x256bc
movl $0x1, (%rax)
movl %r15d, %eax
jmp 0x3c4d
leaq 0x1647d(%rip), %rdi     # 0x1a27b
movq %r12, %rsi
callq 0x3450
testl %eax, %eax
jne 0x45d8
movb $0x1, 0x21577(%rip)     # 0x2538c
movl %r15d, %eax
jmp 0x3e69
xorl %esi, %esi
testq %rsi, %rsi
leaq 0x193c2(%rip), %rax     # 0x1d1e8
cmoveq %rax, %rsi
movq %r12, %rdi
callq 0x45e8
movl %r15d, %eax
movq 0x2116c(%rip), %r12     # 0x24fa8
jmp 0x3c4d
leaq 0x16433(%rip), %rdi     # 0x1a27b
movq %r12, %rsi
callq 0x3450
testl %eax, %eax
jne 0x45e0
movb $0x1, 0x2152d(%rip)     # 0x2538c
movl %r15d, %eax
leaq 0x161f1(%rip), %rbx     # 0x1a05a
movq %r13, %rbp
movq 0x28(%rsp), %r13
movq 0x21130(%rip), %r12     # 0x24fa8
jmp 0x3c4d
cmpl $-0x1, %eax
jne 0x436a
movq 0x2113b(%rip), %rax     # 0x24fc8
movslq (%rax), %rax
movq (%r13,%rax,8), %r12
testq %r12, %r12
je 0x436a
incl %eax
cmpl %r14d, %eax
jne 0x43ed
leaq 0x1620e(%rip), %rdi     # 0x1a0be
leaq 0x16210(%rip), %rsi     # 0x1a0c7
callq 0x45e8
leaq 0x16206(%rip), %rdi     # 0x1a0c9
leaq 0x168f6(%rip), %rsi     # 0x1a7c0
callq 0x45e8
leaq 0x16202(%rip), %rdi     # 0x1a0d8
leaq 0x181ef(%rip), %rbx     # 0x1c0cc
movq %rbx, %rsi
callq 0x45e8
leaq 0x161ff(%rip), %rdi     # 0x1a0eb
movq %rbx, %rsi
callq 0x45e8
leaq 0x161fd(%rip), %rdi     # 0x1a0f8
movq %rbx, %rsi
callq 0x45e8
leaq 0x16201(%rip), %rsi     # 0x1a10b
movq %r12, %rdi
callq 0x30e0
xorl %esi, %esi
testq %rax, %rax
setne %sil
movl $0x20, %edi
callq 0x14089
cmpl $0x10e, 0x10(%rsp)      # imm = 0x10E
movq %r12, 0x10(%rsp)
jg 0x3f4c
movl $0x2c, %edi
callq 0x47c8
movl $0x100, %edi            # imm = 0x100
xorl %esi, %esi
callq 0x14089
jmp 0x3f5f
leaq 0x161bd(%rip), %rdi     # 0x1a110
leaq 0x18172(%rip), %rsi     # 0x1c0cc
callq 0x45e8
leaq 0x161ba(%rip), %rdx     # 0x1a120
leaq 0x450(%rsp), %rbx
movl $0x10, %esi
movq %rbx, %rdi
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x34f0
leaq 0x1619d(%rip), %rdi     # 0x1a126
movq %rbx, %rsi
callq 0x45e8
movb $0x1, %r12b
leaq 0x20b75(%rip), %rbp     # 0x24b10
xorl %r14d, %r14d
testb $0x1, %r12b
je 0x3fb6
movq (%r14,%rbp), %rsi
movq 0x8(%rsp), %rdi
callq 0x3450
testl %eax, %eax
jmp 0x3fc3
movq 0x8(%rsp), %rax
movb (%rax), %al
movq (%r14,%rbp), %rcx
cmpb (%rcx), %al
setne %r12b
testb %r12b, %r12b
jne 0x4023
movq (%r14,%rbp), %rbx
leaq 0x1450(%rsp), %r13
movq %r13, %rdi
leaq 0x1614f(%rip), %rsi     # 0x1a131
movq %rbx, %rdx
xorl %eax, %eax
callq 0x30d0
movq %r13, %rdi
leaq 0x180d6(%rip), %rsi     # 0x1c0cc
callq 0x45e8
movq %r13, %rdi
leaq 0x1613b(%rip), %rsi     # 0x1a140
movq %rbx, %rdx
xorl %eax, %eax
callq 0x30d0
movq %r13, %rdi
movq 0x28(%rsp), %r13
leaq 0x180ae(%rip), %rsi     # 0x1c0cc
callq 0x45e8
addq $0x8, %r14
cmpq $0x40, %r14
jne 0x3f9e
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x3360
testq %rax, %rax
je 0x436a
cmpq %rax, %rbx
movq 0x20(%rsp), %r14
leaq 0x450(%rsp), %rcx
jae 0x407f
subq %rbx, %rax
xorl %ecx, %ecx
movb (%rbx,%rcx), %dl
movb %dl, 0x450(%rsp,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x4063
addq %rsp, %rcx
addq $0x450, %rcx            # imm = 0x450
movb $0x0, (%rcx)
leaq 0x450(%rsp), %rdi
callq 0x4666
movq %rax, 0x8(%rsp)
cmpb $0x0, 0x212f1(%rip)     # 0x2538c
jne 0x4206
movq 0x38(%rsp), %r12
testq %r12, %r12
leaq 0x160a2(%rip), %rcx     # 0x1a152
cmovneq %r12, %rcx
leaq 0x160a5(%rip), %rdx     # 0x1a160
leaq 0xc50(%rsp), %rbx
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdi
xorl %eax, %eax
callq 0x34f0
leaq 0x192f0(%rip), %rsi     # 0x1d3c9
movq %rbx, %rdi
callq 0x33b0
orq %rax, %r12
jne 0x41e3
movq (%r13), %r14
leaq 0x1863f(%rip), %rdx     # 0x1c734
leaq 0x50(%rsp), %r12
movl $0x400, %ebx            # imm = 0x400
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x34f0
movq %r12, %rdi
movl $0x1, %esi
callq 0x3530
testl %eax, %eax
je 0x418d
leaq 0x166a9(%rip), %rdi     # 0x1a7d2
callq 0x33e0
movq %rax, %r13
leaq 0x1669f(%rip), %rbp     # 0x1a7d7
movq %r12, %rdi
movzbl (%r13), %eax
testl %eax, %eax
je 0x4158
cmpl $0x3a, %eax
je 0x4158
incq %r13
movb %al, (%rdi)
incq %rdi
decq %rbx
jne 0x413b
xorl %ebx, %ebx
movq %rbx, %rsi
movq %rbp, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x34f0
movq %r12, %rdi
movl $0x1, %esi
callq 0x3530
testl %eax, %eax
je 0x418d
xorl %eax, %eax
cmpb $0x3a, (%r13)
sete %al
addq %rax, %r13
movl $0x400, %ebx            # imm = 0x400
jmp 0x4138
leaq 0x50(%rsp), %rdi
leaq 0x1450(%rsp), %rsi
callq 0x3160
testq %rax, %rax
je 0x41dc
leaq 0x18589(%rip), %rdx     # 0x1c734
leaq 0x50(%rsp), %rbx
leaq 0x1450(%rsp), %rcx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
xorl %eax, %eax
callq 0x34f0
movq %rbx, %rdi
movl $0x1, %esi
callq 0x3530
testl %eax, %eax
je 0x447a
xorl %eax, %eax
movq 0x20(%rsp), %r14
testq %rax, %rax
je 0x4580
xorl %edx, %edx
cmpq $0x0, 0x18(%rsp)
setne %dl
leaq 0x15fd2(%rip), %rsi     # 0x1a1d0
movq %rax, %rdi
callq 0x4696
testq %r14, %r14
je 0x42a1
xorl %ebp, %ebp
cmpq $0x0, 0x18(%rsp)
setne %bpl
leaq 0x191a7(%rip), %rbx     # 0x1d3c9
cmpb $0x0, (%r14)
je 0x42a1
movq %r14, %r12
movq %r14, %rdi
movl $0x3a, %esi
callq 0x3180
movq %rax, %r13
testq %rax, %rax
je 0x4245
movb $0x0, (%r13)
movq %r12, %r14
movq %r12, %rdi
movq %rbx, %rsi
callq 0x33b0
testq %rax, %rax
je 0x4289
movq %rax, %r12
movq %r14, %rdi
callq 0x4666
movq %r12, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0x4696
leaq 0x1(%r13), %rax
xorl %ecx, %ecx
testq %r13, %r13
sete %cl
cmovneq %rax, %r14
leal (%rcx,%rcx,2), %eax
testl %eax, %eax
je 0x4222
jmp 0x4298
movq %r14, %rdi
callq 0x37b4
movl $0x1, %eax
jmp 0x4283
cmpl $0x1, %eax
je 0x45b1
leaq 0xc50(%rsp), %rax
movq 0x40(%rsp), %r12
cmpq %rax, %r12
jne 0x42ea
cmpl $0x0, 0x4(%rsp)
leaq 0x15f34(%rip), %rax     # 0x1a1f3
leaq 0x15f28(%rip), %rcx     # 0x1a1ee
cmoveq %rax, %rcx
testl %r15d, %r15d
leaq 0x15f15(%rip), %rsi     # 0x1a1e9
cmoveq %rcx, %rsi
leaq 0x450(%rsp), %rdx
movq %r12, %rdi
xorl %eax, %eax
callq 0x30d0
leaq 0x190d8(%rip), %rsi     # 0x1d3c9
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x33b0
testq %rax, %rax
je 0x456a
movq %rax, %rdi
callq 0x3b16
movq %rax, %rbx
testl %r15d, %r15d
je 0x4336
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x4378
movq %rbx, %rsi
callq 0x46f7
movq %rax, %r14
testq %rax, %rax
jne 0x439b
jmp 0x45ac
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x440b
movq %rbx, %rsi
callq 0x46f7
movq %rax, %r14
testq %rax, %rax
je 0x43fd
movq %rbx, %rdi
callq 0x33c0
xorl %eax, %eax
movq %r14, %rbx
jmp 0x4402
movq (%r13), %rdi
callq 0x35e0
jmp 0x45ac
movq %rbx, %rdi
callq 0x31a0
leaq 0x1388(,%rax,2), %rdi
callq 0x3440
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x179a3
leaq 0x186ac(%rip), %rsi     # 0x1ca4e
movq %r12, %rdi
callq 0x33b0
testq %rax, %rax
je 0x4591
movq %rax, %rbx
movq %r14, %rdi
callq 0x31a0
movl $0x1, %esi
movq %r14, %rdi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x35c0
movq %rbx, %rdi
callq 0x3300
leaq 0x212e0(%rip), %rcx     # 0x256c0
xorl %eax, %eax
cmpl $0x0, (%rcx)
setne %al
jmp 0x45b1
movl %r14d, %edi
movq %r13, %rsi
callq 0x371d
jmp 0x45ac
movl $0x1, %eax
testq %r14, %r14
je 0x45b1
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x16b70
testq %rax, %rax
je 0x4441
movq %rax, %r14
leaq 0x21299(%rip), %rax     # 0x256c0
cmpl $0x0, (%rax)
jne 0x4441
cmpl $0x0, 0x4(%rsp)
je 0x44d8
callq 0x3aec
jmp 0x44e0
leaq 0x21280(%rip), %rax     # 0x256c8
movq (%rax), %rax
testq %rax, %rax
je 0x4459
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x20b88(%rip), %rbx     # 0x24fe8
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x31e0
jmp 0x45ac
leaq 0x50(%rsp), %rdi
movl $0x2f, %esi
callq 0x3360
testq %rax, %rax
movq 0x20(%rsp), %r14
je 0x458a
movb $0x0, (%rax)
leaq 0x15cbc(%rip), %rdx     # 0x1a15d
leaq 0x15caa(%rip), %r8      # 0x1a152
leaq 0xc50(%rsp), %rbx
leaq 0x50(%rsp), %rcx
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdi
xorl %eax, %eax
callq 0x34f0
leaq 0x18efe(%rip), %rsi     # 0x1d3c9
movq %rbx, %rdi
callq 0x33b0
jmp 0x41e3
movq %r12, %rdi
callq 0x3590
movq %rax, %rbx
leaq 0x1632f(%rip), %rsi     # 0x1a819
movq %rax, %rdi
callq 0x33b0
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x456a
leaq 0x48(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x149cc
movq (%r15), %rdi
callq 0x3300
cmpl $0x0, 0x4(%rsp)
je 0x4566
callq 0x3aec
movq %rax, %r14
leaq 0x15ce0(%rip), %rsi     # 0x1a20a
leaq 0x1450(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x30d0
movq %r15, %rdi
callq 0x32b0
testb $0x7f, %al
jne 0x45c3
movq %r14, %rdi
movq %r12, %rsi
callq 0x3220
cmpl $-0x1, %eax
je 0x45ca
movq %rbx, %rdi
callq 0x31c0
xorl %eax, %eax
jmp 0x45b1
movq 0x20a4f(%rip), %rax     # 0x24fc0
movq (%rax), %rdi
leaq 0x15c7d(%rip), %rsi     # 0x1a1f8
movq %rbx, %rdx
jmp 0x45a5
callq 0x3792
jmp 0x4206
xorl %eax, %eax
jmp 0x41e3
movq 0x20a28(%rip), %rax     # 0x24fc0
movq (%rax), %rdi
leaq 0x15c56(%rip), %rsi     # 0x1a1f8
movq %r12, %rdx
xorl %eax, %eax
callq 0x3480
movl $0x1, %eax
addq $0x2458, %rsp           # imm = 0x2458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x37e1
jmp 0x45ac
leaq 0x15c5c(%rip), %rdi     # 0x1a22d
callq 0x32a0
jmp 0x45ac
movq %r12, %rdi
callq 0x36f9
movq %r12, %rdi
callq 0x36d5