// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: app_main
int app_main(int argc, char const * const argv[])
{
	char quitflag;
	int grpstoadd = 0;
	char const ** grps = NULL;
	int i, j;

#ifdef HAVE_STARTWIN
	char cmdsetup = 0;
    struct startwin_settings settings;
    int startretval = STARTWIN_RUN;
#endif

	pathsearchmode = PATHSEARCH_SYSTEM;		// unrestrict findfrompath so that full access to the filesystem can be had

	OSD_RegisterFunction("restartvid","restartvid: reinitialise the video mode",osdcmd_restartvid);
	OSD_RegisterFunction("vidmode","vidmode [xdim ydim] [bpp] [fullscreen]: immediately change the video mode",osdcmd_vidmode);
	OSD_RegisterFunction("mapversion","mapversion [ver]: change the map version for save (min 5, max 8)", osdcmd_mapversion);
	OSD_RegisterFunction("showspriteextents","showspriteextents [state]: show floor/wall sprite extents and "
		"walldist clipping boundary (0 = off, 1 = extents, 2 = +clip)", osdcmd_showspriteextents);

	wm_setapptitle("BUILD by Ken Silverman");

#ifdef RENDERTYPEWIN
	win_allowbackgroundidle(1);
#endif

	editstatus = 1;
	boardfilename[0] = 0;
	for (i=1; i<argc; i++) {
		if (argv[i][0] == '-') {
			if (!strcmp(argv[i], "-g") || !strcmp(argv[i], "-grp")) {
				i++;
				if (grpstoadd == 0) grps = (char const **)malloc(sizeof(char const *) * argc);
				grps[grpstoadd++] = argv[i];
			}
			else if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "--help") || !strcmp(argv[i], "-?")) {
				char *s =
					"BUILD by Ken Silverman\n"
					"Syntax: build [options] mapname\n"
					"Options:\n"
					"\t-grp name.ext\tUse an extra GRP or ZIP file.\n"
					"\t-g name.ext\tSame as above.\n"
#ifdef HAVE_STARTWIN
					"\t-setup\tDisplays the configuration dialogue box before entering the editor.\n"
#endif
					;
#ifdef HAVE_STARTWIN
				wm_msgbox("BUILD by Ken Silverman","%s",s);
#else
				puts(s);
#endif
				return 0;
			}
#ifdef HAVE_STARTWIN
			else if (!strcmp(argv[i], "-setup")) cmdsetup = 1;
#endif
			continue;
		}
		if (!boardfilename[0]) {
			strncpy(boardfilename, argv[i], BMAX_PATH-4-1);
			boardfilename[BMAX_PATH-4-1] = 0;
		}
	}
	if (boardfilename[0] == 0) {
		Bstrcpy(boardfilename,"newboard.map");
	} else if (Bstrrchr(boardfilename,'.') == 0) {
		Bstrcat(boardfilename, ".map");
	}
	//Bcanonicalisefilename(boardfilename,0);

	if ((i = ExtInit()) < 0) return -1;

#ifdef HAVE_STARTWIN
    memset(&settings, 0, sizeof(settings));
    settings.fullscreen = fullscreen;
    settings.xdim2d = xdim2d;
    settings.ydim2d = ydim2d;
    settings.xdim3d = xdimgame;
    settings.ydim3d = ydimgame;
    settings.bpp3d = bppgame;
    settings.forcesetup = forcesetup;

    if (i || forcesetup || cmdsetup) {
        if (quitevent) return 0;

        startretval = startwin_run(&settings);
        if (startretval == STARTWIN_CANCEL)
            return 0;
    }

    fullscreen = settings.fullscreen;
    xdim2d = settings.xdim2d;
    ydim2d = settings.ydim2d;
    xdimgame = settings.xdim3d;
    ydimgame = settings.ydim3d;
    bppgame = settings.bpp3d;
    forcesetup = settings.forcesetup;
#endif

	if (grps && grpstoadd > 0) {
		for (i=0;i<grpstoadd;i++) {
			buildprintf("Adding %s\n",grps[i]);
			initgroupfile(grps[i]);
		}
		free((void *)grps);
	}

	buildsetlogfile("build.log");

	inittimer(TIMERINTSPERSECOND, keytimerstuff);
	initinput();
	initmouse();

	loadpics("tiles000.art",1048576);
	loadnames();

	Bstrcpy(kensig,"BUILD by Ken Silverman");
	initcrc();

	if (!loaddefinitionsfile(defsfilename)) buildputs("Definitions file loaded.\n");

	if (setgamemode(fullscreen,xdimgame,ydimgame,bppgame) < 0)
	{
		ExtUnInit();
		uninitengine();
		buildprintf("%d * %d not supported in this graphics mode\n",xdim,ydim);
		exit(0);
	}
	setbrightness(brightness,palette,0);

	int dark = INT_MAX;
	int light = 0;
	for(i=0;i<256;i++)
	{
		j = ((int)palette[i*3])+((int)palette[i*3+1])+((int)palette[i*3+2]);
		if (j > light) { light = j; whitecol = i; }
		if (j < dark) { dark = j; blackcol = i; }
	}

	for(i=0;i<MAXSECTORS;i++) sector[i].extra = -1;
	for(i=0;i<MAXWALLS;i++) wall[i].extra = -1;
	for(i=0;i<MAXSPRITES;i++) sprite[i].extra = -1;

	wm_setwindowtitle("(new board)");

	ExtPreLoadMap();
	j = pathsearchmode == PATHSEARCH_GAME && grponlymode ? KOPEN4LOAD_ANYGRP : KOPEN4LOAD_ANY;
	i = loadboard(boardfilename,j,&posx,&posy,&posz,&ang,&cursectnum);
	if (i == -2) i = loadoldboard(boardfilename,j,&posx,&posy,&posz,&ang,&cursectnum);
	if (i < 0)
	{
		initspritelists();
		posx = 32768;
		posy = 32768;
		posz = 0;
		ang = 1536;
		numsectors = 0;
		numwalls = 0;
		cursectnum = -1;
		overheadeditor();
		keystatus[buildkeys[14]] = 0;
	}
	else
	{
		ExtLoadMap(boardfilename);
	}

	updatenumsprites();

	startposx = posx;
	startposy = posy;
	startposz = posz;
	startang = ang;
	startsectnum = cursectnum;

	totalclock = 0;

	quitflag = 0;
	while (quitflag == 0)
	{
		if (handleevents()) {
			if (quitevent) {
				keystatus[1] = 1;
				quitevent = 0;
			}
		}

		OSD_DispatchQueued();

		ExtPreCheckKeys();

		drawrooms(posx,posy,posz,ang,horiz,cursectnum);
		ExtAnalyzeSprites();
		drawmasks();

		ExtCheckKeys();

		nextpage();
		synctics = totalclock-lockclock;
		lockclock += synctics;

		if (keystatus[1] > 0)
		{
			keystatus[1] = 0;
			printmessage256("Really want to quit?");
			showframe();

			synctics = totalclock-lockclock;
			lockclock += synctics;

			while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]) == 0)
			{
				if (handleevents()) {
					if (quitevent) {
						quitflag = 1;
						break;
					}
				}

				if (keystatus[0x15] != 0) {
					keystatus[0x15] = 0;
					quitflag = 1; break;
				}
			}
		}
	}

	if (asksave)
	{
		printmessage256("Save changes?");
		showframe();

		while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]) == 0)
		{
			if (handleevents()) if (quitevent) break;	// like saying no

			if (keystatus[0x15] != 0) {
				char *filename;
				int bad;

				keystatus[0x15] = 0;

				filename = boardfilename;
				if (pathsearchmode == PATHSEARCH_GAME) {
					filename = findfilename(filename);
				}

				fixspritesectors();   //Do this before saving!
				updatesector(startposx,startposy,&startsectnum);
				ExtPreSaveMap();
				if (mapversion < 7) {
					bad = saveoldboard(filename,&startposx,&startposy,&startposz,&startang,&startsectnum);
				} else {
					bad = saveboard(filename,&startposx,&startposy,&startposz,&startang,&startsectnum);
				}
				if (!bad) {
					ExtSaveMap(filename);
				}
				break;
			}
		}
	}

	clearfilenames();
	ExtUnInit();
	uninitengine();

	buildprintf("Memory status: %d(%d) bytes\n",cachesize,artsize);
	buildprintf("%s\n",kensig);
	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movl %edi, %ebp
leaq 0x1a36d7(%rip), %rax    # 0x1ad700
movl $0x1, (%rax)
leaq 0x5f16a(%rip), %rdi     # 0x691a0
leaq 0x5f16e(%rip), %rsi     # 0x691ab
leaq 0x89b(%rip), %rdx       # 0xa8df
callq 0x42c61
leaq 0x5f183(%rip), %rdi     # 0x691d3
leaq 0x5f184(%rip), %rsi     # 0x691db
leaq 0x8d4(%rip), %rdx       # 0xa932
callq 0x42c61
leaq 0x5f1bb(%rip), %rdi     # 0x69225
leaq 0x5f1bf(%rip), %rsi     # 0x69230
leaq 0x9ca(%rip), %rdx       # 0xaa42
callq 0x42c61
leaq 0x5f1ed(%rip), %rdi     # 0x69271
leaq 0x5f1f8(%rip), %rsi     # 0x69283
leaq 0xa1a(%rip), %rdx       # 0xaaac
callq 0x42c61
leaq 0x5f260(%rip), %rdi     # 0x692fe
callq 0x62296
leaq 0x1a7992(%rip), %rax    # 0x1b1a3c
movw $0x1, (%rax)
movb $0x0, 0x11c87a(%rip)    # 0x126930
movslq %ebp, %rax
shlq $0x3, %rax
movq %rax, 0x30(%rsp)
pushq $0x1
popq %rbx
xorl %r12d, %r12d
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
cmpl %ebp, %ebx
jge 0xa1ce
movslq %ebx, %rax
movq (%r14,%rax,8), %r13
cmpb $0x2d, (%r13)
jne 0xa175
cmpb $0x67, 0x1(%r13)
jne 0xa100
cmpb $0x0, 0x2(%r13)
je 0xa19b
movq %r13, %rdi
leaq 0x5f20b(%rip), %rsi     # 0x69315
callq 0x68d0
testl %eax, %eax
je 0xa19b
movq %r13, %rdi
leaq 0x5f1fa(%rip), %rsi     # 0x6931b
callq 0x68d0
testl %eax, %eax
je 0xa206
movq %r13, %rdi
leaq 0x5f1e2(%rip), %rsi     # 0x6931a
callq 0x68d0
testl %eax, %eax
je 0xa206
cmpb $0x3f, 0x1(%r13)
jne 0xa157
cmpb $0x0, 0x2(%r13)
je 0xa206
movq %r13, %rdi
leaq 0x5f296(%rip), %rsi     # 0x693f7
callq 0x68d0
testl %eax, %eax
movzbl %r15b, %r15d
pushq $0x1
popq %rax
cmovel %eax, %r15d
jmp 0xa1c7
cmpb $0x0, 0x11c7b4(%rip)    # 0x126930
jne 0xa1c7
movl $0x3fb, %edx            # imm = 0x3FB
leaq 0x11c7a6(%rip), %rdi    # 0x126930
movq %r13, %rsi
callq 0x6190
movb $0x0, 0x11cb92(%rip)    # 0x126d2b
jmp 0xa1c7
testl %r12d, %r12d
jne 0xa1af
movq 0x30(%rsp), %rdi
callq 0x69a0
movq %rax, 0x8(%rsp)
incl %ebx
movslq %ebx, %rax
movq (%r14,%rax,8), %rax
movslq %r12d, %rcx
incl %r12d
movq 0x8(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incl %ebx
jmp 0xa0d4
cmpb $0x0, 0x11c75b(%rip)    # 0x126930
je 0xa229
leaq 0x11c752(%rip), %r14    # 0x126930
pushq $0x2e
popq %rsi
movq %r14, %rdi
callq 0x69e0
testq %rax, %rax
jne 0xa24b
movq %r14, %rdi
callq 0x6420
movl $0x70616d2e, (%rax,%r14) # imm = 0x70616D2E
movb $0x0, 0x4(%rax,%r14)
jmp 0xa24b
leaq 0x5f0f1(%rip), %rdi     # 0x692fe
leaq 0x5f910(%rip), %rsi     # 0x69b24
leaq 0x5f106(%rip), %rdx     # 0x69321
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x61fbc
jmp 0xa89d
movabsq $0x70616d2e647261, %rax # imm = 0x70616D2E647261
movq %rax, 0x11c6fb(%rip)    # 0x126935
movabsq $0x6472616f6277656e, %rax # imm = 0x6472616F6277656E
movq %rax, 0x11c6e5(%rip)    # 0x126930
callq 0x929f
testl %eax, %eax
js 0xa335
leaq 0x16ce49(%rip), %r13    # 0x1770a8
movl (%r13), %eax
movl %eax, 0x14(%rsp)
movl 0x92d6b(%rip), %ecx     # 0x9cfd8
movl %ecx, 0x18(%rsp)
movl 0x92d65(%rip), %edx     # 0x9cfdc
movl %edx, 0x1c(%rsp)
movl 0x92d5f(%rip), %esi     # 0x9cfe0
movl %esi, 0x20(%rsp)
movl 0x92d59(%rip), %edi     # 0x9cfe4
movl %edi, 0x24(%rsp)
movl 0x92d52(%rip), %r8d     # 0x9cfe8
movl %r8d, 0x28(%rsp)
movl 0x92d4a(%rip), %r9d     # 0x9cfec
movl %r9d, 0x2c(%rsp)
jne 0xa33d
testl %r9d, %r9d
jne 0xa33d
xorl %r9d, %r9d
testb %r15b, %r15b
jne 0xa33d
movl %eax, (%r13)
movl %ecx, 0x92d10(%rip)     # 0x9cfd8
movl %edx, 0x92d0e(%rip)     # 0x9cfdc
movl %esi, 0x92d0c(%rip)     # 0x9cfe0
movl %edi, 0x92d0a(%rip)     # 0x9cfe4
movl %r8d, 0x92d07(%rip)     # 0x9cfe8
movl %r9d, 0x92d04(%rip)     # 0x9cfec
cmpq $0x0, 0x8(%rsp)
setne %al
testl %r12d, %r12d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa38e
movl %r12d, %ebx
leaq 0x5f0ff(%rip), %r14     # 0x6940b
xorl %r15d, %r15d
movq 0x8(%rsp), %r12
cmpq %r15, %rbx
je 0xa384
movq (%r12,%r15,8), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x22427
movq (%r12,%r15,8), %rdi
callq 0x1d803
incq %r15
jmp 0xa314
pushq $-0x1
popq %rbp
jmp 0xa89d
leaq 0x16cd5c(%rip), %rax    # 0x1770a0
xorl %ebp, %ebp
cmpb $0x0, (%rax)
jne 0xa89d
leaq 0x14(%rsp), %rdi
callq 0x1c1c8
testl %eax, %eax
je 0xa89d
movl 0x14(%rsp), %eax
movl 0x18(%rsp), %ecx
movl 0x1c(%rsp), %edx
movl 0x20(%rsp), %esi
movl 0x24(%rsp), %edi
movl 0x28(%rsp), %r8d
movl 0x2c(%rsp), %r9d
jmp 0xa2be
movq 0x8(%rsp), %rdi
callq 0x61c0
leaq 0x5f081(%rip), %rdi     # 0x69416
callq 0x39cb2
leaq 0x76d(%rip), %rsi       # 0xab0e
pushq $0x78
popq %rdi
callq 0x62c1c
callq 0x62904
callq 0x62b41
leaq 0x5f066(%rip), %rdi     # 0x69420
movl $0x100000, %esi         # imm = 0x100000
callq 0x3281c
callq 0xacd7
movabsq $0x6e616d7265766c, %rax # imm = 0x6E616D7265766C
movq %rax, 0x11c965(%rip)    # 0x126d3f
movups 0x5ef1d(%rip), %xmm0    # 0x692fe
movaps %xmm0, 0x11c948(%rip)   # 0x126d30
leaq 0x82321(%rip), %rax     # 0x8c710
movq (%rax), %rdi
callq 0x1faf0
testl %eax, %eax
jne 0xa407
leaq 0x5f02b(%rip), %rdi     # 0x6942d
callq 0x30c8d
movsbl (%r13), %edi
movl 0x92bce(%rip), %esi     # 0x9cfe0
movl 0x92bcc(%rip), %edx     # 0x9cfe4
movl 0x92bca(%rip), %ecx     # 0x9cfe8
callq 0x30e98
testl %eax, %eax
js 0xa8ae
movswl 0x11c4ea(%rip), %edi    # 0x12691c
leaq 0x26b177(%rip), %rbx    # 0x2755b0
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
callq 0x31279
addq $0x2, %rbx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
cmpq $0x100, %r14            # imm = 0x100
je 0xa48c
movzbl -0x2(%rbx), %edx
movzbl -0x1(%rbx), %esi
addl %edx, %esi
movzbl (%rbx), %edx
addl %esi, %edx
cmpl %ecx, %edx
jbe 0xa476
movl %r14d, 0x11c8d4(%rip)   # 0x126d48
movl %edx, %ecx
cmpl %eax, %edx
jge 0xa483
movl %r14d, 0x11c8cb(%rip)   # 0x126d4c
movl %edx, %eax
incq %r14
addq $0x3, %rbx
jmp 0xa451
pushq $0x26
popq %rax
leaq 0x2325ca(%rip), %rcx    # 0x23ca60
cmpq $0x28026, %rax          # imm = 0x28026
je 0xa4a9
orw $-0x1, (%rcx,%rax)
addq $0x28, %rax
jmp 0xa496
xorl %eax, %eax
leaq 0x1a759e(%rip), %rcx    # 0x1b1a50
cmpq $0x80000, %rax          # imm = 0x80000
je 0xa4c6
orw $-0x1, 0x1e(%rcx,%rax)
addq $0x20, %rax
jmp 0xa4b2
pushq $0x2a
popq %rax
leaq 0x26b7e0(%rip), %rcx    # 0x275cb0
cmpq $0xb002a, %rax          # imm = 0xB002A
je 0xa4e3
orw $-0x1, (%rcx,%rax)
addq $0x2c, %rax
jmp 0xa4d0
leaq 0x5ef8a(%rip), %rdi     # 0x69474
callq 0x622c7
callq 0x969c
leaq 0x1a3205(%rip), %rax    # 0x1ad700
cmpl $0x0, (%rax)
sete %al
cmpl $0x0, 0x11c410(%rip)    # 0x126918
setne %bpl
andb %al, %bpl
leaq 0x11c848(%rip), %r14    # 0x126d5e
movq %r14, (%rsp)
movzbl %bpl, %esi
addl %esi, %esi
leaq 0x11c409(%rip), %rbx    # 0x126930
leaq 0x11c822(%rip), %rdx    # 0x126d50
leaq 0x11c81f(%rip), %rcx    # 0x126d54
leaq 0x11c81c(%rip), %r8     # 0x126d58
leaq 0x11c819(%rip), %r9     # 0x126d5c
movq %rbx, %rdi
callq 0x2d18e
cmpl $-0x2, %eax
jne 0xa583
addb %bpl, %bpl
movq %r14, (%rsp)
movzbl %bpl, %esi
leaq 0x11c3ce(%rip), %rdi    # 0x126930
leaq 0x11c7e7(%rip), %rdx    # 0x126d50
leaq 0x11c7e4(%rip), %rcx    # 0x126d54
leaq 0x11c7e1(%rip), %r8     # 0x126d58
leaq 0x11c7de(%rip), %r9     # 0x126d5c
callq 0x2d40b
testl %eax, %eax
js 0xa595
leaq 0x11c3a2(%rip), %rdi    # 0x126930
callq 0x969d
jmp 0xa5f0
callq 0x22da8
movl $0x8000, %eax           # imm = 0x8000
movl %eax, 0x11c7ab(%rip)    # 0x126d50
movl %eax, 0x11c7a9(%rip)    # 0x126d54
andl $0x0, 0x11c7a6(%rip)    # 0x126d58
leaq 0x3be9a7(%rip), %rax    # 0x3c8f60
andw $0x0, (%rax)
leaq 0x4056a4(%rip), %rax    # 0x40fc68
andw $0x0, (%rax)
movw $0x600, 0x11c78b(%rip)  # imm = 0x600
orw $-0x1, 0x11c785(%rip)   # 0x126d5e
callq 0xaf97
movslq 0x929d3(%rip), %rax     # 0x9cfb8
leaq 0x16cca4(%rip), %rcx    # 0x177290
movb $0x0, (%rcx,%rax)
callq 0x11f8c
movl 0x11c755(%rip), %eax    # 0x126d50
leaq 0x442712(%rip), %rcx    # 0x44cd14
movl %eax, (%rcx)
movl 0x11c74a(%rip), %eax    # 0x126d54
leaq 0x442707(%rip), %rcx    # 0x44cd18
movl %eax, (%rcx)
movl 0x11c73f(%rip), %eax    # 0x126d58
leaq 0x4426fc(%rip), %rcx    # 0x44cd1c
movl %eax, (%rcx)
movzwl 0x11c733(%rip), %eax    # 0x126d5c
leaq 0x4426f0(%rip), %rcx    # 0x44cd20
movw %ax, (%rcx)
movzwl 0x11c724(%rip), %eax    # 0x126d5e
leaq 0x4426e1(%rip), %rcx    # 0x44cd22
leaq 0x39aea0(%rip), %r15    # 0x3a54e8
andl $0x0, (%r15)
movw %ax, (%rcx)
leaq 0x16ca4a(%rip), %rbp    # 0x1770a0
leaq 0x16cc33(%rip), %r13    # 0x177290
leaq 0x5ee1c(%rip), %r14     # 0x69480
callq 0x63a71
testl %eax, %eax
je 0xa67c
cmpb $0x0, (%rbp)
je 0xa67c
movb $0x1, 0x1(%r13)
movb $0x0, (%rbp)
callq 0x44154
callq 0x953e
movl 0x11c6c4(%rip), %edi    # 0x126d50
movl 0x11c6c2(%rip), %esi    # 0x126d54
movl 0x11c6c0(%rip), %edx    # 0x126d58
movswl 0x11c6bd(%rip), %ecx    # 0x126d5c
movl 0x9292a(%rip), %r8d     # 0x9cfd0
movswl 0x11c6b0(%rip), %r9d    # 0x126d5e
callq 0x22e95
callq 0x9fd7
callq 0x2639d
callq 0x953f
callq 0x315ff
movl (%r15), %eax
movl %eax, %ecx
subl 0x11c68e(%rip), %ecx    # 0x126d60
movl %ecx, 0x11c68c(%rip)    # 0x126d64
movl %eax, 0x11c682(%rip)    # 0x126d60
cmpb $0x0, 0x1(%r13)
jle 0xa664
movb $0x0, 0x1(%r13)
movq %r14, %rdi
callq 0x11fbf
callq 0x63720
movl (%r15), %eax
movl %eax, %ecx
subl 0x11c65a(%rip), %ecx    # 0x126d60
movl %ecx, 0x11c658(%rip)    # 0x126d64
movl %eax, 0x11c64e(%rip)    # 0x126d60
movb 0x1c(%r13), %r12b
orb 0x1(%r13), %r12b
orb 0x39(%r13), %r12b
orb 0x31(%r13), %r12b
jne 0xa664
callq 0x63a71
testl %eax, %eax
je 0xa737
cmpb $0x0, (%rbp)
jne 0xa740
cmpb $0x0, 0x15(%r13)
je 0xa712
jmp 0xa74b
testb %r12b, %r12b
jne 0xa664
jmp 0xa750
movb $0x0, 0x15(%r13)
cmpw $0x0, 0x11c1ce(%rip)    # 0x126926
je 0xa857
leaq 0x5ed30(%rip), %rdi     # 0x69495
callq 0x11fbf
callq 0x63720
movb 0x1c(%r13), %al
orb 0x1(%r13), %al
orb 0x39(%r13), %al
orb 0x31(%r13), %al
jne 0xa857
callq 0x63a71
testl %eax, %eax
je 0xa798
cmpb $0x0, (%rbp)
jne 0xa857
cmpb $0x0, 0x15(%r13)
je 0xa76f
movb $0x0, 0x15(%r13)
leaq 0x1a2f55(%rip), %rax    # 0x1ad700
cmpl $0x0, (%rax)
jne 0xa7bf
leaq 0x11c179(%rip), %rdi    # 0x126930
callq 0x1200e
movq %rax, %rbx
callq 0x1202a
leaq 0x442549(%rip), %rax    # 0x44cd14
movl (%rax), %edi
leaq 0x442544(%rip), %rax    # 0x44cd18
movl (%rax), %esi
leaq 0x442545(%rip), %rdx    # 0x44cd22
callq 0x23663
callq 0x96af
leaq 0x92faa(%rip), %rax     # 0x9d798
cmpl $0x6, (%rax)
jg 0xa820
leaq 0x44251a(%rip), %rsi    # 0x44cd14
leaq 0x442517(%rip), %rdx    # 0x44cd18
leaq 0x442514(%rip), %rcx    # 0x44cd1c
leaq 0x442511(%rip), %r8     # 0x44cd20
leaq 0x44250c(%rip), %r9     # 0x44cd22
movq %rbx, %rdi
callq 0x2f5f6
jmp 0xa84b
leaq 0x4424ed(%rip), %rsi    # 0x44cd14
leaq 0x4424ea(%rip), %rdx    # 0x44cd18
leaq 0x4424e7(%rip), %rcx    # 0x44cd1c
leaq 0x4424e4(%rip), %r8     # 0x44cd20
leaq 0x4424df(%rip), %r9     # 0x44cd22
movq %rbx, %rdi
callq 0x2f297
testl %eax, %eax
jne 0xa857
movq %rbx, %rdi
callq 0x96b0
callq 0x1216c
callq 0x952b
callq 0x22cdf
leaq 0x1a71ab(%rip), %rax    # 0x1b1a18
movl (%rax), %esi
leaq 0x1a719a(%rip), %rax    # 0x1b1a10
movl (%rax), %edx
leaq 0x5ec24(%rip), %rdi     # 0x694a3
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x22427
leaq 0x645fd(%rip), %rdi     # 0x6ee8c
leaq 0x11c49a(%rip), %rsi    # 0x126d30
xorl %eax, %eax
callq 0x22427
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x952b
callq 0x22cdf
leaq 0x3f672d(%rip), %rax    # 0x400fec
movl (%rax), %esi
leaq 0x3f6728(%rip), %rax    # 0x400ff0
movl (%rax), %edx
leaq 0x5eb76(%rip), %rdi     # 0x69447
xorl %eax, %eax
callq 0x22427
xorl %edi, %edi
callq 0x66a0