// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlbsp/writebsp.cpp
// Function: FinishBSPFile()
void            FinishBSPFile()
{
    Verbose("--- FinishBSPFile ---\n");

#ifdef ZHLT_MAX_MAP_LEAFS
	if (g_dmodels[0].visleafs > MAX_MAP_LEAFS_ENGINE)
	{
		Warning ("Number of world leaves(%d) exceeded MAX_MAP_LEAFS(%d)\nIf you encounter problems when running your map, consider this the most likely cause.\n", g_dmodels[0].visleafs, MAX_MAP_LEAFS_ENGINE);
	}
#endif
#ifdef ZHLT_WARNWORLDFACES
	if (g_dmodels[0].numfaces > MAX_MAP_WORLDFACES)
	{
		Warning ("Number of world faces(%d) exceeded %d. Some faces will disappear in game.\nTo reduce world faces, change some world brushes (including func_details) to func_walls.\n", g_dmodels[0].numfaces, MAX_MAP_WORLDFACES);
	}
#endif
#ifdef HLBSP_MERGECLIPNODE
	Developer (DEVELOPER_LEVEL_MESSAGE, "count_mergedclipnodes = %d\n", count_mergedclipnodes);
	if (!g_noclipnodemerge)
	{
#ifdef ZHLT_XASH2
		int total = 0;
		for (int hull = 1; hull < MAX_MAP_HULLS; hull++)
		{
			total += g_numclipnodes[hull - 1];
		}
		Log ("Reduced %d clipnodes to %d\n", total + count_mergedclipnodes, total);
#else
		Log ("Reduced %d clipnodes to %d\n", g_numclipnodes + count_mergedclipnodes, g_numclipnodes);
#endif
	}
#endif
	if(!g_noopt)
	{
#ifdef HLCSG_HLBSP_REDUCETEXTURE
		{
			Log ("Reduced %d texinfos to %d\n", g_numtexinfo, g_nummappedtexinfo);
			for (int i = 0; i < g_nummappedtexinfo; i++)
			{
				g_texinfo[i] = g_mappedtexinfo[i];
			}
			g_numtexinfo = g_nummappedtexinfo;
		}
		{
			dmiptexlump_t *l = (dmiptexlump_t *)g_dtexdata;
			int &g_nummiptex = l->nummiptex;
			bool *Used = (bool *)calloc (g_nummiptex, sizeof(bool));
			int Num = 0, Size = 0;
			int *Map = (int *)malloc (g_nummiptex * sizeof(int));
			int i;
			hlassume (Used != NULL && Map != NULL, assume_NoMemory);
			int *lumpsizes = (int *)malloc (g_nummiptex * sizeof (int));
			const int newdatasizemax = g_texdatasize - ((byte *)&l->dataofs[g_nummiptex] - (byte *)l);
			byte *newdata = (byte *)malloc (newdatasizemax);
			int newdatasize = 0;
			hlassume (lumpsizes != NULL && newdata != NULL, assume_NoMemory);
			int total = 0;
			for (i = 0; i < g_nummiptex; i++)
			{
				if (l->dataofs[i] == -1)
				{
					lumpsizes[i] = -1;
					continue;
				}
				lumpsizes[i] = g_texdatasize - l->dataofs[i];
				for (int j = 0; j < g_nummiptex; j++)
				{
					int lumpsize = l->dataofs[j] - l->dataofs[i];
					if (l->dataofs[j] == -1 || lumpsize < 0 || lumpsize == 0 && j <= i)
						continue;
					if (lumpsize < lumpsizes[i])
						lumpsizes[i] = lumpsize;
				}
				total += lumpsizes[i];
			}
			if (total != newdatasizemax)
			{
				Warning ("Bad texdata structure.\n");
				goto skipReduceTexdata;
			}
			for (i = 0; i < g_numtexinfo; i++)
			{
				texinfo_t *t = &g_texinfo[i];
				if (t->miptex < 0 || t->miptex >= g_nummiptex)
				{
					Warning ("Bad miptex number %d.\n", t->miptex);
					goto skipReduceTexdata;
				}
				Used[t->miptex] = true;
			}
			for (i = 0; i < g_nummiptex; i++)
			{
				const int MAXWADNAME = 16;
				char name[MAXWADNAME];
				int j, k;
				if (l->dataofs[i] < 0)
					continue;
				if (Used[i] == true)
				{
					miptex_t *m = (miptex_t *)((byte *)l + l->dataofs[i]);
					if (m->name[0] != '+' && m->name[0] != '-')
						continue;
					safe_strncpy (name, m->name, MAXWADNAME);
					if (name[1] == '\0')
						continue;
					for (j = 0; j < 20; j++)
					{
						if (j < 10)
							name[1] = '0' + j;
						else
							name[1] = 'A' + j - 10;
						for (k = 0; k < g_nummiptex; k++)
						{
							if (l->dataofs[k] < 0)
								continue;
							miptex_t *m2 = (miptex_t *)((byte *)l + l->dataofs[k]);
							if (!strcasecmp (name, m2->name))
								Used[k] = true;
						}
					}
				}
			}
			for (i = 0; i < g_nummiptex; i++)
			{
				if (Used[i])
				{
					Map[i] = Num;
					Num++;
				}
				else
				{
					Map[i] = -1;
				}
			}
			for (i = 0; i < g_numtexinfo; i++)
			{
				texinfo_t *t = &g_texinfo[i];
				t->miptex = Map[t->miptex];
			}
			Size += (byte *)&l->dataofs[Num] - (byte *)l;
			for (i = 0; i < g_nummiptex; i++)
			{
				if (Used[i])
				{
					if (lumpsizes[i] == -1)
					{
						l->dataofs[Map[i]] = -1;
					}
					else
					{
						memcpy ((byte *)newdata + newdatasize, (byte *)l + l->dataofs[i], lumpsizes[i]);
						l->dataofs[Map[i]] = Size;
						newdatasize += lumpsizes[i];
						Size += lumpsizes[i];
					}
				}
			}
			memcpy (&l->dataofs[Num], newdata, newdatasize);
			Log ("Reduced %d texdatas to %d (%d bytes to %d)\n", g_nummiptex, Num, g_texdatasize, Size);
			g_nummiptex = Num;
			g_texdatasize = Size;
			skipReduceTexdata:;
			free (lumpsizes);
			free (newdata);
			free (Used);
			free (Map);
		}
		Log ("Reduced %d planes to %d\n", g_numplanes, gNumMappedPlanes);
#endif
		for(int counter = 0; counter < gNumMappedPlanes; counter++)
		{
			g_dplanes[counter] = gMappedPlanes[counter];
		}
		g_numplanes = gNumMappedPlanes;
	}
#ifdef HLCSG_HLBSP_REDUCETEXTURE
	else
	{
		hlassume (g_numtexinfo < MAX_MAP_TEXINFO, assume_MAX_MAP_TEXINFO);
		hlassume (g_numplanes < MAX_MAP_PLANES, assume_MAX_MAP_PLANES);
	}
#endif
#ifdef HLBSP_BRINKHACK
	if (!g_nobrink)
	{
		Log ("FixBrinks:\n");
#ifdef ZHLT_XASH2
		dclipnode_t *clipnodes[MAX_MAP_HULLS - 1];
		int numclipnodes[MAX_MAP_HULLS - 1];
		for (int hull = 1; hull < MAX_MAP_HULLS; hull++)
		{
			clipnodes[hull - 1] = (dclipnode_t *)malloc (MAX_MAP_CLIPNODES * sizeof (dclipnode_t));
			hlassume (clipnodes[hull - 1] != NULL, assume_NoMemory);
		}
#else
		dclipnode_t *clipnodes; //[MAX_MAP_CLIPNODES]
		int numclipnodes;
		clipnodes = (dclipnode_t *)malloc (MAX_MAP_CLIPNODES * sizeof (dclipnode_t));
		hlassume (clipnodes != NULL, assume_NoMemory);
#endif
		void *(*brinkinfo)[NUM_HULLS]; //[MAX_MAP_MODELS]
		int (*headnode)[NUM_HULLS]; //[MAX_MAP_MODELS]
		brinkinfo = (void *(*)[NUM_HULLS])malloc (MAX_MAP_MODELS * sizeof (void *[NUM_HULLS]));
		hlassume (brinkinfo != NULL, assume_NoMemory);
		headnode = (int (*)[NUM_HULLS])malloc (MAX_MAP_MODELS * sizeof (int [NUM_HULLS]));
		hlassume (headnode != NULL, assume_NoMemory);

		int i, j, level;
		for (i = 0; i < g_nummodels; i++)
		{
			dmodel_t *m = &g_dmodels[i];
			Developer (DEVELOPER_LEVEL_MESSAGE, " model %d\n", i);
			for (j = 1; j < NUM_HULLS; j++)
			{
#ifdef ZHLT_XASH2
				brinkinfo[i][j] = CreateBrinkinfo (g_dclipnodes[j - 1], m->headnode[j]);
#else
				brinkinfo[i][j] = CreateBrinkinfo (g_dclipnodes, m->headnode[j]);
#endif
			}
		}
		for (level = BrinkAny; level > BrinkNone; level--)
		{
#ifdef ZHLT_XASH2
			for (int hull = 1; hull < MAX_MAP_HULLS; hull++)
			{
				numclipnodes[hull - 1] = 0;
			}
#else
			numclipnodes = 0;
#endif
#ifdef HLBSP_MERGECLIPNODE
			count_mergedclipnodes = 0;
#endif
			for (i = 0; i < g_nummodels; i++)
			{
				for (j = 1; j < NUM_HULLS; j++)
				{
#ifdef ZHLT_XASH2
					if (!FixBrinks (brinkinfo[i][j], (bbrinklevel_e) level, headnode[i][j], clipnodes[j - 1], MAX_MAP_CLIPNODES, numclipnodes[j - 1], numclipnodes[j - 1]))
#else
					if (!FixBrinks (brinkinfo[i][j], (bbrinklevel_e) level, headnode[i][j], clipnodes, MAX_MAP_CLIPNODES, numclipnodes, numclipnodes))
#endif
					{
						break;
					}
				}
				if (j < NUM_HULLS)
				{
					break;
				}
			}
			if (i == g_nummodels)
			{
				break;
			}
		}
		for (i = 0; i < g_nummodels; i++)
		{
			for (j = 1; j < NUM_HULLS; j++)
			{
				DeleteBrinkinfo (brinkinfo[i][j]);
			}
		}
		if (level == BrinkNone)
		{
			Warning ("No brinks have been fixed because clipnode data is almost full.");
		}
		else
		{
			if (level != BrinkAny)
			{
				Warning ("Not all brinks have been fixed because clipnode data is almost full.");
			}
#ifdef HLBSP_MERGECLIPNODE
			Developer (DEVELOPER_LEVEL_MESSAGE, "count_mergedclipnodes = %d\n", count_mergedclipnodes);
#endif
#ifdef ZHLT_XASH2
			int g_numclipnodes_total = 0;
			int numclipnodes_total = 0;
			for (int hull = 1; hull < MAX_MAP_HULLS; hull++)
			{
				g_numclipnodes_total += g_numclipnodes[hull - 1];
				numclipnodes_total += numclipnodes[hull - 1];
			}
			Log ("Increased %d clipnodes to %d.\n", g_numclipnodes_total, numclipnodes_total);
			for (int hull = 1; hull < MAX_MAP_HULLS; hull++)
			{
				g_numclipnodes[hull - 1] = numclipnodes[hull - 1];
				memcpy (g_dclipnodes[hull - 1], clipnodes[hull - 1], numclipnodes[hull - 1] * sizeof (dclipnode_t));
			}
#else
			Log ("Increased %d clipnodes to %d.\n", g_numclipnodes, numclipnodes);
			g_numclipnodes = numclipnodes;
			memcpy (g_dclipnodes, clipnodes, numclipnodes * sizeof (dclipnode_t));
#endif
			for (i = 0; i < g_nummodels; i++)
			{
				dmodel_t *m = &g_dmodels[i];
				for (j = 1; j < NUM_HULLS; j++)
				{
					m->headnode[j] = headnode[i][j];
				}
			}
		}
		free (brinkinfo);
		free (headnode);
#ifdef ZHLT_XASH2
		for (int hull = 1; hull < MAX_MAP_HULLS; hull++)
		{
			free (clipnodes[hull - 1]);
		}
#else
		free (clipnodes);
#endif
	}
#endif
	
#ifdef ZHLT_HIDDENSOUNDTEXTURE
	for (int i = 0; i < g_numtexinfo; i++)
	{
		g_texinfo[i].flags &= ~TEX_SHOULDHIDE;
	}
#endif
#ifdef ZHLT_64BIT_FIX
#ifdef PLATFORM_CAN_CALC_EXTENT
	WriteExtentFile (g_extentfilename);
#else
	Warning ("The " PLATFORM_VERSIONSTRING " version of hlbsp couldn't create extent file. The lack of extent file may cause hlrad error.");
#endif
#endif
	if (g_chart)
    {
        PrintBSPFileSizes();
    }

#ifdef HLCSG_HLBSP_DOUBLEPLANE
#undef dplane_t // this allow us to temporarily access the raw data directly without the layer of indirection
#undef g_dplanes
	for (int i = 0; i < g_numplanes; i++)
	{
		plane_t *mp = &g_mapplanes[i];
		dplane_t *dp = &g_dplanes[i];
		VectorCopy (mp->normal, dp->normal);
		dp->dist = mp->dist;
		dp->type = mp->type;
	}
#define dplane_t plane_t
#define g_dplanes g_mapplanes
#endif
    WriteBSPFile(g_bspfilename);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0x76c4(%rip), %rdi      # 0x23d9d
xorl %eax, %eax
callq 0xa3d7
leaq 0xfd59(%rip), %rbx      # 0x2c440
movl 0x34(%rbx), %esi
cmpl $0x2001, %esi           # imm = 0x2001
jl 0x1c705
leaq 0x76bb(%rip), %rdi      # 0x23db4
movl $0x2000, %edx           # imm = 0x2000
xorl %eax, %eax
callq 0xa2f6
movl 0x3c(%rbx), %esi
cmpl $0x8001, %esi           # imm = 0x8001
jl 0x1c723
leaq 0x772a(%rip), %rdi      # 0x23e41
movl $0x8000, %edx           # imm = 0x8000
xorl %eax, %eax
callq 0xa2f6
movl 0x4a34457(%rip), %edx   # 0x4a50b80
leaq 0x77b5(%rip), %rsi      # 0x23ee5
movl $0x3, %edi
xorl %eax, %eax
callq 0xa496
leaq 0x20b82ce(%rip), %rax   # 0x20d4a11
cmpb $0x0, (%rax)
jne 0x1c767
leaq 0x1cb7c71(%rip), %rax   # 0x1cd43c0
movl (%rax), %edx
movl 0x4a34429(%rip), %esi   # 0x4a50b80
addl %edx, %esi
leaq 0x77a1(%rip), %rdi      # 0x23f01
xorl %eax, %eax
callq 0x9c96
leaq 0x20b82a2(%rip), %rax   # 0x20d4a10
leaq 0x1177c47(%rip), %r14   # 0x11943bc
movl (%r14), %esi
cmpb $0x0, (%rax)
je 0x1c7b5
xorl %edi, %edi
cmpl $0x7fff, %esi           # imm = 0x7FFF
setl %dil
movl $0x26, %esi
callq 0xa731
leaq 0xaf7c1a(%rip), %rax    # 0xb143b4
xorl %edi, %edi
cmpl $0x8000, (%rax)         # imm = 0x8000
setl %dil
movl $0x23, %esi
callq 0xa731
jmp 0x1cbfe
movl 0x4a343cd(%rip), %edx   # 0x4a50b88
leaq 0x775b(%rip), %rdi      # 0x23f1d
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x9c96
movslq 0x4a343b5(%rip), %rbx   # 0x4a50b88
testq %rbx, %rbx
jle 0x1c7f6
movq %rbx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdx
leaq 0x1177bd6(%rip), %rdi   # 0x11943c0
leaq 0x4a3439f(%rip), %rsi   # 0x4a50b90
callq 0x4260
movl %ebx, (%r14)
leaq 0x817c68(%rip), %rax    # 0x834468
movq (%rax), %rbp
movslq (%rbp), %r14
movl $0x1, %esi
movq %r14, %rdi
callq 0x41e0
movq %rax, %rbx
shlq $0x2, %r14
movq %r14, %rdi
callq 0x4400
movq %rax, %r15
movq %rbx, 0x8(%rsp)
testq %rbx, %rbx
setne %al
testq %r15, %r15
setne %cl
andb %al, %cl
movzbl %cl, %edi
movl $0x1, %esi
callq 0xa731
movslq (%rbp), %rbx
movq %rbx, %rdi
shlq $0x2, %rdi
callq 0x4400
leaq 0x817c07(%rip), %rdx    # 0x834464
leaq 0x4(%rbp), %r12
leal (%r12,%rbx,4), %ecx
movq %rax, %rbx
movl %ebp, %r14d
subl %ecx, %r14d
addl (%rdx), %r14d
movslq %r14d, %rdi
callq 0x4400
testq %rbx, %rbx
setne %dl
movq %rax, 0x28(%rsp)
testq %rax, %rax
setne %cl
andb %dl, %cl
movzbl %cl, %edi
movl $0x1, %esi
callq 0xa731
movslq (%rbp), %rax
testq %rax, %rax
jle 0x1c908
leaq 0x817bbb(%rip), %rcx    # 0x834464
movl (%rcx), %ecx
xorl %edx, %edx
xorl %r13d, %r13d
movl (%r12,%rdx,4), %esi
cmpl $-0x1, %esi
je 0x1c8f9
movl %ecx, %edi
subl %esi, %edi
movl %edi, (%rbx,%rdx,4)
xorl %edi, %edi
movl (%r12,%rdi,4), %r8d
cmpl $-0x1, %r8d
je 0x1c8eb
subl %esi, %r8d
js 0x1c8eb
sete %r9b
cmpq %rdx, %rdi
setbe %r10b
testb %r9b, %r10b
jne 0x1c8eb
cmpl (%rbx,%rdx,4), %r8d
jge 0x1c8eb
movl %r8d, (%rbx,%rdx,4)
incq %rdi
cmpq %rdi, %rax
jne 0x1c8c2
addl (%rbx,%rdx,4), %r13d
jmp 0x1c900
movl $0xffffffff, (%rbx,%rdx,4) # imm = 0xFFFFFFFF
incq %rdx
cmpq %rax, %rdx
jne 0x1c8b0
cmpl %r14d, %r13d
jne 0x1ca6a
leaq 0x1177aa4(%rip), %r8    # 0x11943bc
movslq (%r8), %rax
testq %rax, %rax
jle 0x1c95a
shlq $0x3, %rax
leaq (%rax,%rax,4), %rax
xorl %ecx, %ecx
leaq 0x1177a8f(%rip), %rdx   # 0x11943c0
movq 0x8(%rsp), %rdi
movslq 0x20(%rdx,%rcx), %rsi
testq %rsi, %rsi
js 0x1ca7d
cmpl (%rbp), %esi
jge 0x1ca7d
movb $0x1, (%rdi,%rsi)
addq $0x28, %rcx
cmpq %rcx, %rax
jne 0x1c936
movl (%rbp), %eax
testl %eax, %eax
movq %rbx, 0x10(%rsp)
jle 0x1ca3b
movq %r15, 0x20(%rsp)
xorl %ecx, %ecx
leaq 0x30(%rsp), %r13
movq %rcx, 0x18(%rsp)
movslq (%r12,%rcx,4), %rsi
testq %rsi, %rsi
js 0x1ca15
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpb $0x1, (%rax,%rcx)
jne 0x1ca15
movzbl (%rbp,%rsi), %eax
cmpl $0x2d, %eax
je 0x1c9a7
cmpl $0x2b, %eax
jne 0x1ca15
addq %rbp, %rsi
movl $0x10, %edx
movq %r13, %rdi
callq 0x8905
cmpb $0x0, 0x31(%rsp)
je 0x1ca15
xorl %ebx, %ebx
leal 0x37(%rbx), %eax
movl %ebx, %ecx
orb $0x30, %cl
cmpl $0xa, %ebx
movzbl %cl, %ecx
movzbl %al, %eax
cmovbl %ecx, %eax
movb %al, 0x31(%rsp)
movslq (%rbp), %r14
testq %r14, %r14
jle 0x1ca0e
xorl %r15d, %r15d
movslq (%r12,%r15,4), %rsi
testq %rsi, %rsi
js 0x1ca06
addq %rbp, %rsi
movq %r13, %rdi
callq 0x4320
testl %eax, %eax
jne 0x1ca06
movq 0x8(%rsp), %rax
movb $0x1, (%rax,%r15)
incq %r15
cmpq %r15, %r14
jne 0x1c9e4
incl %ebx
cmpl $0x14, %ebx
jne 0x1c9c0
movq 0x18(%rsp), %rcx
incq %rcx
movslq (%rbp), %rax
cmpq %rax, %rcx
jl 0x1c976
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %rbx
leaq 0x1177981(%rip), %r8    # 0x11943bc
testl %eax, %eax
jle 0x1ca90
movl %eax, %eax
xorl %ecx, %ecx
xorl %edi, %edi
movq 0x8(%rsp), %rdx
cmpb $0x1, (%rdx,%rcx)
jne 0x1ca58
movl %edi, (%r15,%rcx,4)
incl %edi
jmp 0x1ca60
movl $0xffffffff, (%r15,%rcx,4) # imm = 0xFFFFFFFF
incq %rcx
cmpq %rcx, %rax
jne 0x1ca4a
jmp 0x1ca92
leaq 0x74c7(%rip), %rdi      # 0x23f38
xorl %eax, %eax
callq 0xa2f6
jmp 0x1cb94
leaq 0x74cc(%rip), %rdi      # 0x23f50
xorl %eax, %eax
callq 0xa2f6
jmp 0x1cb94
xorl %edi, %edi
movslq (%r8), %rax
testq %rax, %rax
jle 0x1cac1
shlq $0x3, %rax
leaq (%rax,%rax,4), %rax
xorl %ecx, %ecx
leaq 0x1177915(%rip), %rdx   # 0x11943c0
movslq 0x20(%rdx,%rcx), %rsi
movl (%r15,%rsi,4), %esi
movl %esi, 0x20(%rdx,%rcx)
addq $0x28, %rcx
cmpq %rcx, %rax
jne 0x1caab
movl %edi, 0x20(%rsp)
movslq %edi, %rax
leaq (%r12,%rax,4), %rax
movq %rax, 0x40(%rsp)
subl %ebp, %eax
movl %eax, 0x18(%rsp)
xorl %r13d, %r13d
cmpl $0x0, (%rbp)
jle 0x1cb50
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
cmpb $0x1, (%rax,%rbx)
jne 0x1cb3c
movq 0x10(%rsp), %rax
movslq (%rax,%rbx,4), %r14
cmpq $-0x1, %r14
je 0x1cb30
movslq %r13d, %r13
movq 0x28(%rsp), %rax
leaq (%rax,%r13), %rdi
movslq 0x4(%rbp,%rbx,4), %rsi
addq %rbp, %rsi
movq %r14, %rdx
callq 0x4260
movslq (%r15,%rbx,4), %rax
movl 0x18(%rsp), %ecx
movl %ecx, 0x4(%rbp,%rax,4)
addl %r14d, %r13d
addl %r14d, %ecx
movl %ecx, 0x18(%rsp)
jmp 0x1cb3c
movslq (%r15,%rbx,4), %rax
movl $0xffffffff, (%r12,%rax,4) # imm = 0xFFFFFFFF
incq %rbx
movslq (%rbp), %rax
cmpq %rax, %rbx
jl 0x1cae2
movslq %r13d, %r13
movq 0x10(%rsp), %rbx
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
callq 0x4260
movl (%rbp), %esi
leaq 0x8178f8(%rip), %r14    # 0x834464
movl (%r14), %ecx
leaq 0x73f1(%rip), %rdi      # 0x23f67
movl 0x20(%rsp), %r12d
movl %r12d, %edx
movl 0x18(%rsp), %r13d
movl %r13d, %r8d
xorl %eax, %eax
callq 0x9c96
movl %r12d, (%rbp)
movl %r13d, (%r14)
movq %rbx, %rdi
callq 0x4380
movq 0x28(%rsp), %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
callq 0x4380
movq %r15, %rdi
callq 0x4380
leaq 0xaf77f5(%rip), %rbx    # 0xb143b4
movl (%rbx), %esi
movl 0x4a33fbd(%rip), %edx   # 0x4a50b84
leaq 0x73c5(%rip), %rdi      # 0x23f93
xorl %eax, %eax
callq 0x9c96
movslq 0x4a33fa8(%rip), %r14   # 0x4a50b84
testq %r14, %r14
jle 0x1cbfb
movq %r14, %rdx
shlq $0x6, %rdx
leaq 0x20b7e31(%rip), %rdi   # 0x20d4a20
leaq 0x4b73f7a(%rip), %rsi   # 0x4b90b70
callq 0x4260
movl %r14d, (%rbx)
leaq 0x20b7e10(%rip), %rax   # 0x20d4a15
cmpb $0x0, (%rax)
jne 0x1cebb
leaq 0x7397(%rip), %rdi      # 0x23fac
xorl %eax, %eax
callq 0x9c96
movl $0x3fff8, %edi          # imm = 0x3FFF8
callq 0x4400
xorl %edi, %edi
movq %rax, 0x8(%rsp)
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa731
movl $0x4000, %edi           # imm = 0x4000
callq 0x4400
xorl %edi, %edi
movq %rax, 0x10(%rsp)
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa731
movl $0x2000, %edi           # imm = 0x2000
callq 0x4400
xorl %edi, %edi
movq %rax, 0x20(%rsp)
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa731
leaq 0xf7a7(%rip), %r15      # 0x2c430
cmpl $0x0, (%r15)
jle 0x1ccef
leaq 0xf7aa(%rip), %rax      # 0x2c440
leaq 0x28(%rax), %r14
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %r12
leaq 0x1cb7726(%rip), %r13   # 0x1cd43d0
xorl %ebp, %ebp
movl $0x3, %edi
leaq 0x7300(%rip), %rsi      # 0x23fb8
movl %ebp, %edx
xorl %eax, %eax
callq 0xa496
xorl %ebx, %ebx
movl (%r14,%rbx,4), %esi
movq %r13, %rdi
callq 0x114ba
movq %rax, (%r12,%rbx,8)
incq %rbx
cmpq $0x3, %rbx
jne 0x1ccc3
incq %rbp
movslq (%r15), %rax
addq $0x20, %r12
addq $0x40, %r14
cmpq %rax, %rbp
jl 0x1ccac
movq 0x20(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x28(%rsp)
movl $0x5, %r12d
leaq 0x30(%rsp), %r13
xorl %eax, %eax
movl %eax, 0x30(%rsp)
movl %eax, 0x4a33e5e(%rip)   # 0x4a50b80
movl $0x0, %ebp
cmpl %eax, (%r15)
jle 0x1cd8d
movq 0x28(%rsp), %r15
movq 0x18(%rsp), %r14
xorl %ebp, %ebp
xorl %ebx, %ebx
movq (%r15,%rbx,2), %rdi
leaq (%r14,%rbx), %rdx
movl 0x30(%rsp), %r9d
movq %r13, (%rsp)
movl %r12d, %esi
movq 0x8(%rsp), %rcx
movl $0x7fff, %r8d           # imm = 0x7FFF
callq 0x118a2
testb %al, %al
je 0x1cd86
addq $0x4, %rbx
cmpq $0xc, %rbx
jne 0x1cd3a
incq %rbp
leaq 0xf6ba(%rip), %rax      # 0x2c430
movslq (%rax), %rax
addq $0x10, %r14
addq $0x20, %r15
cmpq %rax, %rbp
jl 0x1cd38
leaq 0xf6a3(%rip), %r15      # 0x2c430
cmpl (%r15), %ebp
je 0x1cda7
leal -0x1(%r12), %eax
cmpl $0x1, %r12d
movl %eax, %r12d
ja 0x1cd16
xorl %r12d, %r12d
cmpl $0x0, (%r15)
jle 0x1cde2
xorl %r14d, %r14d
movq 0x10(%rsp), %r15
movl $0x1, %ebx
movq (%r15,%rbx,8), %rdi
callq 0x11947
incq %rbx
cmpq $0x4, %rbx
jne 0x1cdba
incq %r14
leaq 0xf65a(%rip), %rax      # 0x2c430
movslq (%rax), %rax
addq $0x20, %r15
cmpq %rax, %r14
jl 0x1cdb5
cmpl $0x5, %r12d
leaq 0xf643(%rip), %r14      # 0x2c430
je 0x1ce15
testl %r12d, %r12d
jne 0x1ce07
leaq 0x71c8(%rip), %rdi      # 0x23fc3
xorl %eax, %eax
callq 0xa2f6
jmp 0x1ce9d
leaq 0x71f5(%rip), %rdi      # 0x24003
xorl %eax, %eax
callq 0xa2f6
movl 0x4a33d65(%rip), %edx   # 0x4a50b80
leaq 0x70c3(%rip), %rsi      # 0x23ee5
movl $0x3, %edi
xorl %eax, %eax
callq 0xa496
leaq 0x1cb758b(%rip), %rbx   # 0x1cd43c0
movl (%rbx), %esi
movl 0x30(%rsp), %edx
leaq 0x7206(%rip), %rdi      # 0x24048
xorl %eax, %eax
callq 0x9c96
movslq 0x30(%rsp), %rdx
movl %edx, (%rbx)
shlq $0x3, %rdx
leaq 0x1cb7575(%rip), %rdi   # 0x1cd43d0
movq 0x8(%rsp), %rsi
callq 0x4260
movslq (%r14), %rax
testq %rax, %rax
leaq 0xf5ce(%rip), %rdi      # 0x2c440
jle 0x1ce9d
movq 0x20(%rsp), %rcx
addq $0x4, %rcx
shlq $0x4, %rax
xorl %edx, %edx
movl 0x8(%rcx,%rdx), %esi
movl %esi, 0x30(%rdi,%rdx,4)
movq (%rcx,%rdx), %rsi
movq %rsi, 0x28(%rdi,%rdx,4)
addq $0x10, %rdx
cmpq %rdx, %rax
jne 0x1ce83
movq 0x10(%rsp), %rdi
callq 0x4380
movq 0x20(%rsp), %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
callq 0x4380
leaq 0x20b6b4e(%rip), %rdi   # 0x20d3a10
callq 0x5d91
leaq 0x20b7b49(%rip), %rax   # 0x20d4a17
cmpb $0x1, (%rax)
jne 0x1ced8
callq 0x6586
leaq 0xaf74d5(%rip), %rax    # 0xb143b4
movslq (%rax), %rax
testq %rax, %rax
jle 0x1cf30
leaq 0xaf74d2(%rip), %rcx    # 0xb143c0
addq $0x10, %rcx
shlq $0x6, %rax
xorl %edx, %edx
leaq 0x20b7b21(%rip), %rsi   # 0x20d4a20
movsd 0x10(%rsi,%rdx), %xmm0
cvtpd2ps (%rsi,%rdx), %xmm1
movhpd 0x30(%rsi,%rdx), %xmm0  # xmm0 = xmm0[0],mem[0]
cvtpd2ps %xmm0, %xmm0
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd %xmm1, -0x10(%rcx)
movl 0x38(%rsi,%rdx), %edi
movl %edi, (%rcx)
addq $0x14, %rcx
addq $0x40, %rdx
cmpq %rdx, %rax
jne 0x1ceff
leaq 0x20b2ad9(%rip), %rdi   # 0x20cfa10
callq 0x57d6
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq