// File: /workspace/github_c_makefile_star2_O3/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 0x1a99cf(%rip), %rax    # 0x1b4700
movl $0x1, (%rax)
leaq 0x69522(%rip), %rdi     # 0x74260
leaq 0x69526(%rip), %rsi     # 0x7426b
leaq 0x918(%rip), %rdx       # 0xb664
callq 0x4b4d8
leaq 0x6953b(%rip), %rdi     # 0x74293
leaq 0x6953c(%rip), %rsi     # 0x7429b
leaq 0x951(%rip), %rdx       # 0xb6b7
callq 0x4b4d8
leaq 0x69573(%rip), %rdi     # 0x742e5
leaq 0x69577(%rip), %rsi     # 0x742f0
leaq 0xa37(%rip), %rdx       # 0xb7b7
callq 0x4b4d8
leaq 0x695a5(%rip), %rdi     # 0x74331
leaq 0x695b0(%rip), %rsi     # 0x74343
leaq 0xa87(%rip), %rdx       # 0xb821
callq 0x4b4d8
leaq 0x69618(%rip), %rdi     # 0x743be
callq 0x6d991
leaq 0x1adc8a(%rip), %rax    # 0x1b8a3c
movw $0x1, (%rax)
movb $0x0, 0x122b72(%rip)    # 0x12d930
cmpl $0x2, %ebp
jl 0xaf2b
movl %ebp, %eax
shlq $0x3, %rax
movq %rax, 0x30(%rsp)
xorl %r15d, %r15d
movl $0x1, %r12d
xorl %ebx, %ebx
movl $0x0, 0x10(%rsp)
movslq %r12d, %rax
movq (%r14,%rax,8), %r13
cmpb $0x2d, (%r13)
jne 0xae80
cmpb $0x67, 0x1(%r13)
jne 0xae09
cmpb $0x0, 0x2(%r13)
je 0xaea6
movq %r13, %rdi
leaq 0x695c2(%rip), %rsi     # 0x743d5
callq 0x68d0
testl %eax, %eax
je 0xaea6
movq %r13, %rdi
leaq 0x695b1(%rip), %rsi     # 0x743db
callq 0x68d0
testl %eax, %eax
je 0xb28b
movq %r13, %rdi
leaq 0x69599(%rip), %rsi     # 0x743da
callq 0x68d0
testl %eax, %eax
je 0xb28b
cmpb $0x3f, 0x1(%r13)
jne 0xae60
cmpb $0x0, 0x2(%r13)
je 0xb28b
movq %r13, %rdi
leaq 0x6964d(%rip), %rsi     # 0x744b7
callq 0x68d0
testl %eax, %eax
movzbl %r15b, %r15d
movl $0x1, %eax
cmovel %eax, %r15d
jmp 0xaed6
cmpb $0x0, 0x122aa9(%rip)    # 0x12d930
jne 0xaed6
movl $0x3fb, %edx            # imm = 0x3FB
leaq 0x122a9b(%rip), %rdi    # 0x12d930
movq %r13, %rsi
callq 0x6190
movb $0x0, 0x122e87(%rip)    # 0x12dd2b
jmp 0xaed6
movl 0x10(%rsp), %r13d
testl %r13d, %r13d
jne 0xaebd
movq 0x30(%rsp), %rdi
callq 0x69a0
movq %rax, %rbx
incl %r12d
movslq %r12d, %rax
movq (%r14,%rax,8), %rax
movslq %r13d, %rcx
incl %r13d
movl %r13d, 0x10(%rsp)
movq %rax, (%rbx,%rcx,8)
incl %r12d
cmpl %ebp, %r12d
jl 0xade5
testb %r15b, %r15b
setne %r12b
cmpb $0x0, 0x122a40(%rip)    # 0x12d930
je 0xb56b
leaq 0x122a33(%rip), %r14    # 0x12d930
movq %r14, %rdi
movl $0x2e, %esi
callq 0x69e0
testq %rax, %rax
movl 0x10(%rsp), %ebp
jne 0xaf54
movq %r14, %rdi
callq 0x6420
movl $0x70616d2e, (%rax,%r14) # imm = 0x70616D2E
movb $0x0, 0x4(%rax,%r14)
jmp 0xaf54
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %ebp, %ebp
movabsq $0x70616d2e647261, %rax # imm = 0x70616D2E647261
movq %rax, 0x1229f2(%rip)    # 0x12d935
movabsq $0x6472616f6277656e, %rax # imm = 0x6472616F6277656E
movq %rax, 0x1229dc(%rip)    # 0x12d930
callq 0x9e20
testl %eax, %eax
js 0xb280
leaq 0x173140(%rip), %r15    # 0x17e0a8
movl (%r15), %ecx
movl %ecx, 0x14(%rsp)
movl 0x99063(%rip), %edx     # 0xa3fd8
movl %edx, 0x18(%rsp)
movl 0x9905d(%rip), %esi     # 0xa3fdc
movl %esi, 0x1c(%rsp)
movl 0x99057(%rip), %edi     # 0xa3fe0
movl %edi, 0x20(%rsp)
movl 0x99050(%rip), %r8d     # 0xa3fe4
movl %r8d, 0x24(%rsp)
movl 0x99048(%rip), %r9d     # 0xa3fe8
movl %r9d, 0x28(%rsp)
movl 0x99040(%rip), %r10d    # 0xa3fec
movl %r10d, 0x2c(%rsp)
orl %r10d, %eax
setne %r10b
orb %r12b, %r10b
xorl %eax, %eax
testb $0x1, %r10b
je 0xb006
leaq 0x1730d6(%rip), %rax    # 0x17e0a0
xorl %r14d, %r14d
cmpb $0x0, (%rax)
jne 0xb621
leaq 0x14(%rsp), %rdi
callq 0x1e760
testl %eax, %eax
je 0xb621
movl 0x14(%rsp), %ecx
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %esi
movl 0x20(%rsp), %edi
movl 0x24(%rsp), %r8d
movl 0x28(%rsp), %r9d
movl 0x2c(%rsp), %eax
movl %ecx, (%r15)
movl %edx, 0x98fc9(%rip)     # 0xa3fd8
movl %esi, 0x98fc7(%rip)     # 0xa3fdc
movl %edi, 0x98fc5(%rip)     # 0xa3fe0
movl %r8d, 0x98fc2(%rip)     # 0xa3fe4
movl %r9d, 0x98fbf(%rip)     # 0xa3fe8
movl %eax, 0x98fbd(%rip)     # 0xa3fec
testq %rbx, %rbx
setne %al
testl %ebp, %ebp
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xb075
movl %ebp, %r12d
leaq 0x69480(%rip), %r14     # 0x744cb
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x25221
movq (%rbx,%r13,8), %rdi
callq 0x1ff01
incq %r13
cmpq %r13, %r12
jne 0xb04e
movq %rbx, %rdi
callq 0x61c0
leaq 0x6945a(%rip), %rdi     # 0x744d6
callq 0x3db05
leaq 0x7fb(%rip), %rsi       # 0xb883
movl $0x78, %edi
callq 0x6e370
callq 0x6e05c
callq 0x6e293
leaq 0x6943d(%rip), %rdi     # 0x744e0
movl $0x100000, %esi         # imm = 0x100000
callq 0x35ed4
callq 0xba75
movabsq $0x6e616d7265766c, %rax # imm = 0x6E616D7265766C
movq %rax, 0x122c7c(%rip)    # 0x12dd3f
movups 0x692f4(%rip), %xmm0    # 0x743be
movaps %xmm0, 0x122c5f(%rip)   # 0x12dd30
leaq 0x88638(%rip), %rax     # 0x93710
movq (%rax), %rdi
callq 0x224b0
testl %eax, %eax
jne 0xb0f0
leaq 0x69402(%rip), %rdi     # 0x744ed
callq 0x32d18
movsbl (%r15), %edi
movl 0x98ee6(%rip), %esi     # 0xa3fe0
movl 0x98ee4(%rip), %edx     # 0xa3fe4
movl 0x98ee2(%rip), %ecx     # 0xa3fe8
callq 0x33e08
testl %eax, %eax
js 0xb633
movswl 0x122802(%rip), %edi    # 0x12d91c
leaq 0x27148f(%rip), %rbx    # 0x27c5b0
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
callq 0x348a4
addq $0x2, %rbx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movzbl -0x2(%rbx), %edx
movzbl -0x1(%rbx), %esi
addl %edx, %esi
movzbl (%rbx), %edx
addl %esi, %edx
cmpl %ecx, %edx
jbe 0xb155
movl %r14d, 0x122bf5(%rip)   # 0x12dd48
movl %edx, %ecx
cmpl %eax, %edx
jge 0xb162
movl %r14d, 0x122bec(%rip)   # 0x12dd4c
movl %edx, %eax
incq %r14
addq $0x3, %rbx
cmpq $0x100, %r14            # imm = 0x100
jne 0xb139
movl $0x26, %eax
leaq 0x2388e2(%rip), %rcx    # 0x243a60
movw $0xffff, (%rcx,%rax)    # imm = 0xFFFF
addq $0x28, %rax
cmpq $0x28026, %rax          # imm = 0x28026
jne 0xb17e
xorl %eax, %eax
leaq 0x1ad8b7(%rip), %rcx    # 0x1b8a50
movw $0xffff, 0x1e(%rcx,%rax) # imm = 0xFFFF
addq $0x20, %rax
cmpq $0x80000, %rax          # imm = 0x80000
jne 0xb199
movl $0x2a, %eax
leaq 0x271af8(%rip), %r14    # 0x27ccb0
movw $0xffff, (%r14,%rax)    # imm = 0xFFFF
addq $0x2c, %rax
cmpq $0xb002a, %rax          # imm = 0xB002A
jne 0xb1b8
leaq 0x69362(%rip), %rdi     # 0x74534
callq 0x6d9c2
callq 0xa253
leaq 0x1a951d(%rip), %rax    # 0x1b4700
cmpl $0x0, (%rax)
sete %al
cmpl $0x0, 0x122728(%rip)    # 0x12d918
setne %bpl
andb %al, %bpl
leaq 0x122b60(%rip), %r15    # 0x12dd5e
movq %r15, (%rsp)
movzbl %bpl, %esi
addl %esi, %esi
leaq 0x122721(%rip), %rbx    # 0x12d930
leaq 0x122b3a(%rip), %rdx    # 0x12dd50
leaq 0x122b37(%rip), %rcx    # 0x12dd54
leaq 0x122b34(%rip), %r8     # 0x12dd58
leaq 0x122b31(%rip), %r9     # 0x12dd5c
movq %rbx, %rdi
callq 0x30260
cmpl $-0x2, %eax
jne 0xb26b
addb %bpl, %bpl
movq %r15, (%rsp)
movzbl %bpl, %esi
leaq 0x1226e6(%rip), %rdi    # 0x12d930
leaq 0x122aff(%rip), %rdx    # 0x12dd50
leaq 0x122afc(%rip), %rcx    # 0x12dd54
leaq 0x122af9(%rip), %r8     # 0x12dd58
leaq 0x122af6(%rip), %r9     # 0x12dd5c
callq 0x3050a
testl %eax, %eax
js 0xb2af
leaq 0x1226ba(%rip), %rdi    # 0x12d930
callq 0xa254
jmp 0xb30e
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0xb621
leaq 0x6912c(%rip), %rdi     # 0x743be
leaq 0x6994b(%rip), %rsi     # 0x74be4
leaq 0x69141(%rip), %rdx     # 0x743e1
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x6d6a4
jmp 0xb621
callq 0x25c20
movl $0x8000, %eax           # imm = 0x8000
movl %eax, 0x122a91(%rip)    # 0x12dd50
movl %eax, 0x122a8f(%rip)    # 0x12dd54
movl $0x0, 0x122a89(%rip)    # 0x12dd58
movw $0x600, 0x122a84(%rip)  # imm = 0x600
leaq 0x3c4c81(%rip), %rax    # 0x3cff60
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x40b97d(%rip), %rax    # 0x416c68
movw %cx, (%rax)
movw $0xffff, 0x122a67(%rip) # imm = 0xFFFF
callq 0xbd63
movslq 0x98cb5(%rip), %rax     # 0xa3fb8
leaq 0x172f86(%rip), %rcx    # 0x17e290
movb $0x0, (%rcx,%rax)
movl $0x0, 0x16eeb4(%rip)    # 0x17a1cc
xorl %eax, %eax
movl $0x1a, %ecx
cmpw $0x3ff, (%r14,%rcx)     # imm = 0x3FF
jg 0xb330
incl %eax
movl %eax, 0x16ee9c(%rip)    # 0x17a1cc
addq $0x2c, %rcx
cmpq $0xb001a, %rcx          # imm = 0xB001A
jne 0xb31f
movl 0x122a0d(%rip), %eax    # 0x12dd50
leaq 0x4489ca(%rip), %rcx    # 0x453d14
movl %eax, (%rcx)
movl 0x122a02(%rip), %eax    # 0x12dd54
leaq 0x4489bf(%rip), %r12    # 0x453d18
movl %eax, (%r12)
movl 0x1229f5(%rip), %eax    # 0x12dd58
leaq 0x4489b2(%rip), %rcx    # 0x453d1c
movl %eax, (%rcx)
movzwl 0x1229e9(%rip), %eax    # 0x12dd5c
leaq 0x4489a6(%rip), %rcx    # 0x453d20
movw %ax, (%rcx)
movzwl 0x1229da(%rip), %eax    # 0x12dd5e
leaq 0x448997(%rip), %rcx    # 0x453d22
movw %ax, (%rcx)
leaq 0x3a1153(%rip), %r15    # 0x3ac4e8
movl $0x0, (%r15)
leaq 0x172cfd(%rip), %rbp    # 0x17e0a0
leaq 0x172ee6(%rip), %r13    # 0x17e290
leaq 0x6918f(%rip), %r14     # 0x74540
callq 0x6f32a
testl %eax, %eax
je 0xb3c9
cmpb $0x0, (%rbp)
je 0xb3c9
movb $0x1, 0x1(%r13)
movb $0x0, (%rbp)
callq 0x4ccac
callq 0xa0ef
movl 0x122977(%rip), %edi    # 0x12dd50
movl 0x122975(%rip), %esi    # 0x12dd54
movl 0x122973(%rip), %edx    # 0x12dd58
movswl 0x122970(%rip), %ecx    # 0x12dd5c
movl 0x98bdd(%rip), %r8d     # 0xa3fd0
movswl 0x122963(%rip), %r9d    # 0x12dd5e
callq 0x25e5d
callq 0xacdc
callq 0x29bd8
callq 0xa0f0
callq 0x34c2b
movl (%r15), %eax
movl %eax, %ecx
subl 0x122941(%rip), %ecx    # 0x12dd60
movl %ecx, 0x12293f(%rip)    # 0x12dd64
movl %eax, 0x122935(%rip)    # 0x12dd60
cmpb $0x0, 0x1(%r13)
jle 0xb3b1
movb $0x0, 0x1(%r13)
movq %r14, %rdi
callq 0x13554
callq 0x6efcd
movl (%r15), %eax
movl %eax, %ecx
subl 0x12290d(%rip), %ecx    # 0x12dd60
movl %ecx, 0x12290b(%rip)    # 0x12dd64
movl %eax, 0x122901(%rip)    # 0x12dd60
movb 0x1c(%r13), %al
orb 0x1(%r13), %al
orb 0x39(%r13), %al
orb 0x31(%r13), %al
jne 0xb3b1
callq 0x6f32a
testl %eax, %eax
je 0xb484
cmpb $0x0, (%rbp)
jne 0xb490
cmpb $0x0, 0x15(%r13)
je 0xb45f
movb $0x0, 0x15(%r13)
cmpw $0x0, 0x12248e(%rip)    # 0x12d926
je 0xb5ab
leaq 0x690b0(%rip), %rdi     # 0x74555
callq 0x13554
callq 0x6efcd
movb 0x1c(%r13), %al
orb 0x1(%r13), %al
orb 0x39(%r13), %al
orb 0x31(%r13), %al
jne 0xb5ab
callq 0x6f32a
testl %eax, %eax
je 0xb4d8
cmpb $0x0, (%rbp)
jne 0xb5ab
cmpb $0x0, 0x15(%r13)
je 0xb4af
movb $0x0, 0x15(%r13)
leaq 0x1a9215(%rip), %rax    # 0x1b4700
cmpl $0x0, (%rax)
jne 0xb50f
leaq 0x122439(%rip), %r14    # 0x12d930
movq %r14, %rdi
movl $0x2f, %esi
callq 0x69e0
leaq 0x1(%rax), %rbx
testq %rax, %rax
cmoveq %r14, %rbx
callq 0x135e2
leaq 0x4487f9(%rip), %rax    # 0x453d14
movl (%rax), %edi
movl (%r12), %esi
leaq 0x4487fa(%rip), %rdx    # 0x453d22
callq 0x2668d
callq 0xa266
leaq 0x9925f(%rip), %rax     # 0xa4798
cmpl $0x6, (%rax)
jg 0xb574
leaq 0x4487cf(%rip), %rsi    # 0x453d14
leaq 0x4487cc(%rip), %rdx    # 0x453d18
leaq 0x4487c9(%rip), %rcx    # 0x453d1c
leaq 0x4487c6(%rip), %r8     # 0x453d20
leaq 0x4487c1(%rip), %r9     # 0x453d22
movq %rbx, %rdi
callq 0x32745
jmp 0xb59f
movl 0x10(%rsp), %ebp
jmp 0xaf32
leaq 0x448799(%rip), %rsi    # 0x453d14
leaq 0x448796(%rip), %rdx    # 0x453d18
leaq 0x448793(%rip), %rcx    # 0x453d1c
leaq 0x448790(%rip), %r8     # 0x453d20
leaq 0x44878b(%rip), %r9     # 0x453d22
movq %rbx, %rdi
callq 0x323cc
testl %eax, %eax
jne 0xb5ab
movq %rbx, %rdi
callq 0xa267
movq 0x16f01e(%rip), %rdi    # 0x17a5d0
callq 0x20b90
movq 0x16f01a(%rip), %rdi    # 0x17a5d8
callq 0x20b90
xorl %r14d, %r14d
movq %r14, 0x16f00b(%rip)    # 0x17a5d8
movq %r14, 0x16effc(%rip)    # 0x17a5d0
movl %r14d, 0x16f005(%rip)   # 0x17a5e0
movl %r14d, 0x16f002(%rip)   # 0x17a5e4
callq 0xa0dc
callq 0x25b4a
leaq 0x1ad425(%rip), %rax    # 0x1b8a18
movl (%rax), %esi
leaq 0x1ad414(%rip), %rax    # 0x1b8a10
movl (%rax), %edx
leaq 0x68f5e(%rip), %rdi     # 0x74563
xorl %eax, %eax
callq 0x25221
leaq 0x6eaf9(%rip), %rdi     # 0x7a10c
leaq 0x122716(%rip), %rsi    # 0x12dd30
xorl %eax, %eax
callq 0x25221
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xa0dc
callq 0x25b4a
leaq 0x3fc9a8(%rip), %rax    # 0x407fec
movl (%rax), %esi
leaq 0x3fc9a3(%rip), %rax    # 0x407ff0
movl (%rax), %edx
leaq 0x68eb1(%rip), %rdi     # 0x74507
xorl %eax, %eax
callq 0x25221
xorl %edi, %edi
callq 0x66a0