// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movl %edi, %ebp
leaq 0x166ae(%rip), %rdi     # 0x1a234
callq 0x16924
movq $0x0, 0x8(%rsp)
movl $0x4, %edi
xorl %esi, %esi
callq 0x13f11
movl $0x1, %edi
movl $0x1, %esi
callq 0x13f11
movl $0x20, %edi
xorl %esi, %esi
callq 0x13f11
movl $0x40, %edi
movl $0x1, %esi
callq 0x13f11
movl $0x80, %edi
movl $0x1, %esi
callq 0x13f11
leaq 0xc50(%rsp), %rax
movq %rax, 0x28(%rsp)
movl $0x15e, 0x1c(%rsp)      # imm = 0x15E
leaq 0x16461(%rip), %rax     # 0x1a056
movq %rax, 0x10(%rsp)
leaq 0x16459(%rip), %r15     # 0x1a05a
leaq 0x163fc(%rip), %r14     # 0x1a004
leaq 0x195d9(%rip), %rbx     # 0x1d1e8
movq $0x0, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x4(%rsp)
xorl %eax, %eax
movl %eax, %r13d
movl %ebp, %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x30f0
cmpl $0x56, %eax
jg 0x3c77
cmpl $0x4f, %eax
jg 0x3d10
leal -0x41(%rax), %ecx
cmpl $0x7, %ecx
ja 0x3e84
movslq (%r14,%rcx,4), %rcx
addq %r14, %rcx
movl $0x1, %eax
jmpq *%rcx
movq 0x2133e(%rip), %rax     # 0x24fa8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl %r13d, %eax
jmp 0x3c2b
leal -0x66(%rax), %ecx
cmpl $0x9, %ecx
ja 0x3ce3
leaq 0x1639e(%rip), %rdx     # 0x1a024
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %r12, %r15
movq 0x2130f(%rip), %rax     # 0x24fa8
movq (%rax), %r14
movq %r14, %rdi
movl $0x3d, %esi
callq 0x3180
testq %rax, %rax
je 0x3e03
movq %rax, %r12
movb $0x0, (%rax)
movq %r14, %rdi
callq 0x13e50
testl %eax, %eax
je 0x3e46
movl %eax, %ebx
incq %r12
movq %r12, %rdi
callq 0x34c0
movl %ebx, %edi
movl %eax, %esi
callq 0x13f11
jmp 0x3e64
cmpl $0x57, %eax
je 0x3dee
cmpl $0x61, %eax
jne 0x444b
movq 0x212ac(%rip), %rax     # 0x24fa8
movq (%rax), %rdi
callq 0x34c0
movl %eax, 0x1c(%rsp)
movl %r13d, %eax
jmp 0x3c2b
cmpl $0x50, %eax
je 0x3dd7
cmpl $0x53, %eax
jne 0x444b
movl $0x1, 0x4(%rsp)
movl %r13d, %eax
jmp 0x3c2b
movq 0x2126f(%rip), %rax     # 0x24fa8
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movl %r13d, %eax
jmp 0x3c2b
leaq 0x1631f(%rip), %rdi     # 0x1a06f
leaq 0x18375(%rip), %rsi     # 0x1c0cc
callq 0x45cb
movl $0x4, %edi
movl $0x1, %esi
callq 0x13f11
movl $0x100, %edi            # imm = 0x100
movl $0x1, %esi
callq 0x13f11
movl %r13d, %eax
jmp 0x3c2b
movq 0x2121f(%rip), %rax     # 0x24fa8
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movl %r13d, %eax
jmp 0x3c2b
movq 0x21208(%rip), %rax     # 0x24fa8
movq (%rax), %r14
movq %r14, %rdi
movl $0x3d, %esi
callq 0x3180
testq %rax, %rax
je 0x3e26
movq %rax, %rsi
incq %rsi
movb $0x0, (%rax)
jmp 0x3e28
movq 0x211e1(%rip), %rax     # 0x24fa8
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movl %r13d, %eax
jmp 0x3c2b
movq 0x211ca(%rip), %rax     # 0x24fa8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl %r13d, %eax
jmp 0x3c2b
leaq 0x218c7(%rip), %rax     # 0x256bc
movl $0x1, (%rax)
movl %r13d, %eax
jmp 0x3c2b
leaq 0x16471(%rip), %rdi     # 0x1a27b
movq %r14, %rsi
callq 0x3450
testl %eax, %eax
jne 0x45bb
movb $0x1, 0x2156b(%rip)     # 0x2538c
movl %r13d, %eax
jmp 0x3e6e
xorl %esi, %esi
testq %rsi, %rsi
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x45cb
movl %r13d, %eax
leaq 0x161c3(%rip), %r14     # 0x1a004
jmp 0x3c2b
leaq 0x1642e(%rip), %rdi     # 0x1a27b
movq %r14, %rsi
callq 0x3450
testl %eax, %eax
jne 0x45c3
movb $0x1, 0x21528(%rip)     # 0x2538c
movl %r13d, %eax
leaq 0x1937a(%rip), %rbx     # 0x1d1e8
movq %r15, %r12
leaq 0x161e2(%rip), %r15     # 0x1a05a
leaq 0x16185(%rip), %r14     # 0x1a004
jmp 0x3c2b
cmpl $-0x1, %eax
jne 0x444b
movq 0x21134(%rip), %rax     # 0x24fc8
movslq (%rax), %rax
movq (%r12,%rax,8), %rbx
testq %rbx, %rbx
je 0x444b
incl %eax
cmpl %ebp, %eax
jne 0x4466
leaq 0x16209(%rip), %rdi     # 0x1a0be
leaq 0x1620b(%rip), %rsi     # 0x1a0c7
callq 0x45cb
leaq 0x16201(%rip), %rdi     # 0x1a0c9
leaq 0x168f1(%rip), %rsi     # 0x1a7c0
callq 0x45cb
leaq 0x161fd(%rip), %rdi     # 0x1a0d8
movq %rbx, 0x20(%rsp)
leaq 0x181e5(%rip), %rbx     # 0x1c0cc
movq %rbx, %rsi
callq 0x45cb
leaq 0x161f5(%rip), %rdi     # 0x1a0eb
movq %rbx, %rsi
callq 0x45cb
leaq 0x161f3(%rip), %rdi     # 0x1a0f8
movq %rbx, %rsi
callq 0x45cb
leaq 0x161f7(%rip), %rsi     # 0x1a10b
movq 0x20(%rsp), %rdi
callq 0x30e0
xorl %esi, %esi
testq %rax, %rax
setne %sil
movl $0x20, %edi
callq 0x13f11
cmpl $0x10e, 0x1c(%rsp)      # imm = 0x10E
movq %r12, 0x30(%rsp)
jg 0x3f58
movl $0x2c, %edi
callq 0x47a8
movl $0x100, %edi            # imm = 0x100
xorl %esi, %esi
callq 0x13f11
jmp 0x3f6b
leaq 0x161b1(%rip), %rdi     # 0x1a110
leaq 0x18166(%rip), %rsi     # 0x1c0cc
callq 0x45cb
leaq 0x161ae(%rip), %rdx     # 0x1a120
leaq 0x450(%rsp), %rbx
movl $0x10, %esi
movq %rbx, %rdi
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x34f0
leaq 0x16191(%rip), %rdi     # 0x1a126
movq %rbx, %rsi
callq 0x45cb
leaq 0x20b6c(%rip), %rbx     # 0x24b10
leaq 0x1450(%rsp), %rbp
leaq 0x18119(%rip), %r14     # 0x1c0cc
xorl %r12d, %r12d
xorl %eax, %eax
testl %eax, %eax
jne 0x3fd5
movq (%r12,%rbx), %r15
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x3450
testl %eax, %eax
je 0x3fe5
xorl %eax, %eax
jmp 0x4028
movq 0x10(%rsp), %rax
movb (%rax), %al
movq (%r12,%rbx), %r15
cmpb (%r15), %al
jne 0x3fd1
movq %rbp, %rdi
leaq 0x16142(%rip), %rsi     # 0x1a131
movq %r15, %rdx
xorl %eax, %eax
callq 0x30d0
movq %rbp, %rdi
movq %r14, %rsi
callq 0x45cb
movq %rbp, %rdi
leaq 0x16132(%rip), %rsi     # 0x1a140
movq %r15, %rdx
xorl %eax, %eax
callq 0x30d0
movq %rbp, %rdi
movq %r14, %rsi
callq 0x45cb
movl $0x1, %eax
addq $0x8, %r12
cmpq $0x40, %r12
jne 0x3fb8
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x3360
testq %rax, %rax
je 0x4475
cmpq %rax, %rbx
movq 0x8(%rsp), %rbp
movq 0x30(%rsp), %r14
leaq 0x450(%rsp), %rcx
jae 0x4085
subq %rbx, %rax
xorl %ecx, %ecx
movb (%rbx,%rcx), %dl
movb %dl, 0x450(%rsp,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x4069
addq %rsp, %rcx
addq $0x450, %rcx            # imm = 0x450
movb $0x0, (%rcx)
leaq 0x450(%rsp), %rdi
callq 0x4649
movq %rax, 0x10(%rsp)
cmpb $0x0, 0x212eb(%rip)     # 0x2538c
jne 0x425e
movq 0x38(%rsp), %r15
testq %r15, %r15
leaq 0x1609c(%rip), %rcx     # 0x1a152
cmovneq %r15, %rcx
leaq 0x1609f(%rip), %rdx     # 0x1a160
leaq 0xc50(%rsp), %rbx
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdi
xorl %eax, %eax
callq 0x34f0
leaq 0x192e4(%rip), %rsi     # 0x1d3c3
movq %rbx, %rdi
callq 0x33b0
orq %rax, %r15
jne 0x423e
movq (%r14), %r14
leaq 0x1863a(%rip), %rdx     # 0x1c734
leaq 0x50(%rsp), %r15
movl $0x400, %ebx            # imm = 0x400
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x34f0
movq %r15, %rdi
movl $0x1, %esi
callq 0x3530
testl %eax, %eax
je 0x4192
leaq 0x166a4(%rip), %rdi     # 0x1a7d2
callq 0x33e0
movq %rax, %r12
leaq 0x1669a(%rip), %rbp     # 0x1a7d7
movq %r15, %rdi
movzbl (%r12), %eax
testl %eax, %eax
je 0x415d
cmpl $0x3a, %eax
je 0x415d
incq %r12
movb %al, (%rdi)
incq %rdi
decq %rbx
jne 0x4140
xorl %ebx, %ebx
movq %rbx, %rsi
movq %rbp, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x34f0
movq %r15, %rdi
movl $0x1, %esi
callq 0x3530
testl %eax, %eax
je 0x4192
xorl %eax, %eax
cmpb $0x3a, (%r12)
sete %al
addq %rax, %r12
movl $0x400, %ebx            # imm = 0x400
jmp 0x413d
leaq 0x50(%rsp), %rdi
leaq 0x1450(%rsp), %rsi
callq 0x3160
testq %rax, %rax
je 0x4554
leaq 0x18580(%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
jne 0x4554
leaq 0x50(%rsp), %rdi
movl $0x2f, %esi
callq 0x3360
testq %rax, %rax
movq 0x8(%rsp), %rbp
je 0x4559
movb $0x0, (%rax)
leaq 0x15f51(%rip), %rdx     # 0x1a15d
leaq 0x15f3f(%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 0x1918d(%rip), %rsi     # 0x1d3c3
movq %rbx, %rdi
callq 0x33b0
testq %rax, %rax
je 0x4559
xorl %edx, %edx
testq %rbp, %rbp
setne %dl
leaq 0x15f7a(%rip), %rsi     # 0x1a1d0
movq %rax, %rdi
callq 0x4679
movq %rbp, 0x8(%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x42d2
xorl %ebx, %ebx
cmpq $0x0, 0x8(%rsp)
setne %bl
leaq 0x19144(%rip), %r14     # 0x1d3c3
cmpb $0x0, (%rdi)
je 0x42d2
movq %rdi, %rbp
movl $0x3a, %esi
callq 0x3180
movq %rax, %r15
testq %rax, %rax
je 0x429d
movb $0x0, (%r15)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x33b0
testq %rax, %rax
je 0x4595
movq %rax, %r12
movq %rbp, %rdi
callq 0x4649
movq %r12, %rdi
movq %rax, %rsi
movl %ebx, %edx
callq 0x4679
leaq 0x1(%r15), %rdi
testq %r15, %r15
jne 0x427f
leaq 0xc50(%rsp), %rax
movq 0x28(%rsp), %r15
cmpq %rax, %r15
jne 0x431b
cmpl $0x0, 0x4(%rsp)
leaq 0x15f03(%rip), %rax     # 0x1a1f3
leaq 0x15ef7(%rip), %rcx     # 0x1a1ee
cmoveq %rax, %rcx
testl %r13d, %r13d
leaq 0x15ee4(%rip), %rsi     # 0x1a1e9
cmoveq %rcx, %rsi
leaq 0x450(%rsp), %rdx
movq %r15, %rdi
xorl %eax, %eax
callq 0x30d0
leaq 0x190a1(%rip), %rsi     # 0x1d3c3
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x33b0
testq %rax, %rax
je 0x453e
movq %rax, %rdi
callq 0x3b06
movq %rax, %rbx
testl %r13d, %r13d
je 0x436f
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x43d6
movq %rbx, %rsi
callq 0x46da
movq %rax, %r14
testq %rax, %rax
jne 0x43f9
jmp 0x457e
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4398
movq %rbx, %rsi
callq 0x46da
testq %rax, %rax
je 0x457e
movq %rax, %r14
movq %rbx, %rdi
callq 0x33c0
movq %r14, %rbx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x1692c
testq %rax, %rax
je 0x4451
movq %rax, %r14
leaq 0x21308(%rip), %rax     # 0x256c0
cmpl $0x0, (%rax)
jne 0x4451
cmpl $0x0, 0x4(%rsp)
je 0x44aa
callq 0x3adc
jmp 0x44b2
movq %rbx, %rdi
callq 0x31a0
leaq 0x1388(,%rax,2), %rdi
callq 0x3440
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1773d
leaq 0x1864e(%rip), %rsi     # 0x1ca4e
movq %r15, %rdi
callq 0x33b0
testq %rax, %rax
je 0x4563
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 0x21282(%rip), %rcx     # 0x256c0
xorl %eax, %eax
cmpl $0x0, (%rcx)
setne %al
jmp 0x4583
movq (%r12), %rdi
jmp 0x447d
leaq 0x21270(%rip), %rax     # 0x256c8
movq (%rax), %rax
testq %rax, %rax
je 0x4487
movq 0x18(%rax), %rsi
jmp 0x448e
movl %ebp, %edi
movq %r12, %rsi
callq 0x371d
jmp 0x457e
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x35e0
jmp 0x457e
leaq 0x18d5a(%rip), %rsi     # 0x1d1e8
movq 0x20b53(%rip), %rbx     # 0x24fe8
movq %rbx, %rdi
callq 0x32f0
movq %rbx, %rdi
callq 0x31e0
jmp 0x457e
movq %r15, %rdi
callq 0x3590
movq %rax, %rbx
leaq 0x1635d(%rip), %rsi     # 0x1a819
movq %rax, %rdi
callq 0x33b0
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x453e
leaq 0x48(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x14846
movq (%r15), %rdi
callq 0x3300
cmpl $0x0, 0x4(%rsp)
je 0x453a
callq 0x3adc
movq %rax, %r14
leaq 0x15d0e(%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 0x459f
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x3220
cmpl $-0x1, %eax
je 0x45ad
movq %rbx, %rdi
callq 0x31c0
xorl %eax, %eax
jmp 0x4583
movq 0x20a7b(%rip), %rax     # 0x24fc0
movq (%rax), %rdi
leaq 0x15ca9(%rip), %rsi     # 0x1a1f8
movq %rbx, %rdx
jmp 0x4577
movq 0x8(%rsp), %rbp
callq 0x3792
jmp 0x425e
movq 0x20a56(%rip), %rax     # 0x24fc0
movq (%rax), %rdi
leaq 0x15c84(%rip), %rsi     # 0x1a1f8
movq %r15, %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
movq %rbp, %rdi
callq 0x37b4
jmp 0x457e
callq 0x37e1
leaq 0x18c3d(%rip), %rdi     # 0x1d1e8
jmp 0x45b4
leaq 0x15c79(%rip), %rdi     # 0x1a22d
callq 0x32a0
jmp 0x457e
movq %r14, %rdi
callq 0x36f9
movq %r14, %rdi
callq 0x36d5