// File: FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: ProcessModel()
static bool     ProcessModel()
{
    surfchain_t*    surfs;
#ifdef ZHLT_DETAILBRUSH
	brush_t			*detailbrushes;
#endif
    node_t*         nodes;
    dmodel_t*       model;
    int             startleafs;

    surfs = ReadSurfs(polyfiles[0]);

    if (!surfs)
        return false;                                      // all models are done
#ifdef ZHLT_DETAILBRUSH
	detailbrushes = ReadBrushes (brushfiles[0]);
#endif

    hlassume(g_nummodels < MAX_MAP_MODELS, assume_MAX_MAP_MODELS);

    startleafs = g_numleafs;
    int modnum = g_nummodels;
    model = &g_dmodels[modnum];
    g_nummodels++;

//    Log("ProcessModel: %i (%i f)\n", modnum, model->numfaces);

	g_hullnum = 0; //vluzacn
#ifdef HLCSG_HLBSP_ALLOWEMPTYENTITY
	VectorFill (model->mins, 99999);
	VectorFill (model->maxs, -99999);
	{
		if (surfs->mins[0] > surfs->maxs[0])
		{
			Developer (DEVELOPER_LEVEL_FLUFF, "model %d hull %d empty\n", modnum, g_hullnum);
		}
		else
		{
			vec3_t mins, maxs;
			int i;
			VectorSubtract (surfs->mins, g_hull_size[g_hullnum][0], mins);
			VectorSubtract (surfs->maxs, g_hull_size[g_hullnum][1], maxs);
			for (i = 0; i < 3; i++)
			{
				if (mins[i] > maxs[i])
				{
					vec_t tmp;
					tmp = (mins[i] + maxs[i]) / 2;
					mins[i] = tmp;
					maxs[i] = tmp;
				}
			}
			for (i = 0; i < 3; i++)
			{
				model->maxs[i] = qmax (model->maxs[i], maxs[i]);
				model->mins[i] = qmin (model->mins[i], mins[i]);
			}
		}
	}
#else
    VectorCopy(surfs->mins, model->mins);
    VectorCopy(surfs->maxs, model->maxs);
#endif

    // SolidBSP generates a node tree
    nodes = SolidBSP(surfs,
#ifdef ZHLT_DETAILBRUSH
		detailbrushes,
#endif
		modnum==0);

    // build all the portals in the bsp tree
    // some portals are solid polygons, and some are paths to other leafs
    if (g_nummodels == 1 && !g_nofill)                       // assume non-world bmodels are simple
    {
#ifdef HLBSP_FILL
		if (!g_noinsidefill)
			FillInside (nodes);
#endif
        nodes = FillOutside(nodes, (g_bLeaked != true), 0);                  // make a leakfile if bad
    }

    FreePortals(nodes);

    // fix tjunctions
    tjunc(nodes);

    MakeFaceEdges();

    // emit the faces for the bsp file
    model->headnode[0] = g_numnodes;
    model->firstface = g_numfaces;
#ifdef HLCSG_HLBSP_ALLOWEMPTYENTITY
	bool novisiblebrushes = false;
	// model->headnode[0]<0 will crash HL, so must split it.
	if (nodes->planenum == -1)
	{
		novisiblebrushes = true;
		if (nodes->markfaces[0] != NULL)
			hlassume(false, assume_EmptySolid);
		if (g_numplanes == 0)
			Error ("No valid planes.\n");
		nodes->planenum = 0; // arbitrary plane
		nodes->children[0] = AllocNode ();
		nodes->children[0]->planenum = -1;
		nodes->children[0]->contents = CONTENTS_EMPTY;
#ifdef ZHLT_DETAILBRUSH
		nodes->children[0]->isdetail = false;
		nodes->children[0]->isportalleaf = true;
		nodes->children[0]->iscontentsdetail = false;
#endif
		nodes->children[0]->faces = NULL;
		nodes->children[0]->markfaces = (face_t**)calloc (1, sizeof(face_t*));
		VectorFill (nodes->children[0]->mins, 0);
		VectorFill (nodes->children[0]->maxs, 0);
		nodes->children[1] = AllocNode ();
		nodes->children[1]->planenum = -1;
		nodes->children[1]->contents = CONTENTS_EMPTY;
#ifdef ZHLT_DETAILBRUSH
		nodes->children[1]->isdetail = false;
		nodes->children[1]->isportalleaf = true;
		nodes->children[1]->iscontentsdetail = false;
#endif
		nodes->children[1]->faces = NULL;
		nodes->children[1]->markfaces = (face_t**)calloc (1, sizeof(face_t*));
		VectorFill (nodes->children[1]->mins, 0);
		VectorFill (nodes->children[1]->maxs, 0);
		nodes->contents = 0;
#ifdef ZHLT_DETAILBRUSH
		nodes->isdetail = false;
		nodes->isportalleaf = false;
#endif
		nodes->faces = NULL;
		nodes->markfaces = NULL;
		VectorFill (nodes->mins, 0);
		VectorFill (nodes->maxs, 0);
	}
#endif
    WriteDrawNodes(nodes);
    model->numfaces = g_numfaces - model->firstface;
    model->visleafs = g_numleafs - startleafs;

    if (g_noclip)
    {
		/*
			KGP 12/31/03 - store empty content type in headnode pointers to signify
			lack of clipping information in a way that doesn't crash the half-life
			engine at runtime.
		*/
		model->headnode[1] = CONTENTS_EMPTY;
		model->headnode[2] = CONTENTS_EMPTY;
		model->headnode[3] = CONTENTS_EMPTY;
#if defined (HLCSG_HLBSP_CUSTOMBOUNDINGBOX) || defined (HLCSG_HLBSP_ALLOWEMPTYENTITY)
		goto skipclip;
#else
        return true;
#endif
    }

    // the clipping hulls are simpler
    for (g_hullnum = 1; g_hullnum < NUM_HULLS; g_hullnum++)
    {
        surfs = ReadSurfs(polyfiles[g_hullnum]);
#ifdef ZHLT_DETAILBRUSH
		detailbrushes = ReadBrushes (brushfiles[g_hullnum]);
#endif
#ifdef HLCSG_HLBSP_ALLOWEMPTYENTITY
		{
			int hullnum = g_hullnum;
			if (surfs->mins[0] > surfs->maxs[0])
			{
				Developer (DEVELOPER_LEVEL_MESSAGE, "model %d hull %d empty\n", modnum, hullnum);
			}
			else
			{
				vec3_t mins, maxs;
				int i;
				VectorSubtract (surfs->mins, g_hull_size[hullnum][0], mins);
				VectorSubtract (surfs->maxs, g_hull_size[hullnum][1], maxs);
				for (i = 0; i < 3; i++)
				{
					if (mins[i] > maxs[i])
					{
						vec_t tmp;
						tmp = (mins[i] + maxs[i]) / 2;
						mins[i] = tmp;
						maxs[i] = tmp;
					}
				}
				for (i = 0; i < 3; i++)
				{
					model->maxs[i] = qmax (model->maxs[i], maxs[i]);
					model->mins[i] = qmin (model->mins[i], mins[i]);
				}
			}
		}
#endif
        nodes = SolidBSP(surfs,
#ifdef ZHLT_DETAILBRUSH
			detailbrushes, 
#endif
			modnum==0);
        if (g_nummodels == 1 && !g_nofill)                   // assume non-world bmodels are simple
        {
            nodes = FillOutside(nodes, (g_bLeaked != true), g_hullnum);
        }
        FreePortals(nodes);
		/*
			KGP 12/31/03 - need to test that the head clip node isn't empty; if it is
			we need to set model->headnode equal to the content type of the head, or create
			a trivial single-node case where the content type is the same for both leaves
			if setting the content type is invalid.
		*/
		if(nodes->planenum == -1) //empty!
		{
			model->headnode[g_hullnum] = nodes->contents;
		}
		else
		{
#ifdef ZHLT_XASH2
	        model->headnode[g_hullnum] = g_numclipnodes[g_hullnum - 1];
#else
	        model->headnode[g_hullnum] = g_numclipnodes;
#endif
		    WriteClipNodes(nodes);
		}
    }
#if defined (HLCSG_HLBSP_CUSTOMBOUNDINGBOX) || defined (HLCSG_HLBSP_ALLOWEMPTYENTITY)
	skipclip:
#endif

#ifdef HLCSG_HLBSP_CUSTOMBOUNDINGBOX
	{
		entity_t *ent;
		ent = EntityForModel (modnum);
		if (ent != &g_entities[0] && *ValueForKey (ent, "zhlt_minsmaxs"))
		{
			double origin[3], mins[3], maxs[3];
			VectorClear (origin);
			sscanf (ValueForKey (ent, "origin"), "%lf %lf %lf", &origin[0], &origin[1], &origin[2]);
			if (sscanf (ValueForKey (ent, "zhlt_minsmaxs"), "%lf %lf %lf %lf %lf %lf", &mins[0], &mins[1], &mins[2], &maxs[0], &maxs[1], &maxs[2]) == 6)
			{
				VectorSubtract (mins, origin, model->mins);
				VectorSubtract (maxs, origin, model->maxs);
			}
		}
	}
#endif
#ifdef HLCSG_HLBSP_ALLOWEMPTYENTITY
	Developer (DEVELOPER_LEVEL_MESSAGE, "model %d - mins=(%g,%g,%g) maxs=(%g,%g,%g)\n", modnum,
		model->mins[0], model->mins[1], model->mins[2], model->maxs[0], model->maxs[1], model->maxs[2]);
	if (model->mins[0] > model->maxs[0])
	{
		entity_t *ent = EntityForModel (g_nummodels - 1);
		if (g_nummodels - 1 != 0 && ent == &g_entities[0])
		{
			ent = NULL;
		}
		Warning ("Empty solid entity: model %d (entity: classname \"%s\", origin \"%s\", targetname \"%s\")", 
			g_nummodels - 1, 
			(ent? ValueForKey (ent, "classname"): "unknown"), 
			(ent? ValueForKey (ent, "origin"): "unknown"), 
			(ent? ValueForKey (ent, "targetname"): "unknown"));
		VectorClear (model->mins); // fix "backward minsmaxs" in HL
		VectorClear (model->maxs);
	}
	else if (novisiblebrushes)
	{
		entity_t *ent = EntityForModel (g_nummodels - 1);
		if (g_nummodels - 1 != 0 && ent == &g_entities[0])
		{
			ent = NULL;
		}
		Warning ("No visible brushes in solid entity: model %d (entity: classname \"%s\", origin \"%s\", targetname \"%s\", range (%.0f,%.0f,%.0f) - (%.0f,%.0f,%.0f))", 
			g_nummodels - 1, 
			(ent? ValueForKey (ent, "classname"): "unknown"), 
			(ent? ValueForKey (ent, "origin"): "unknown"), 
			(ent? ValueForKey (ent, "targetname"): "unknown"), 
			model->mins[0], model->mins[1], model->mins[2], model->maxs[0], model->maxs[1], model->maxs[2]);
	}
#endif
    return true;
}

// Assembly:
subq $0x1c8, %rsp            # imm = 0x1C8
movq 0x30c82c2(%rip), %rdi   # 0x30efa30
callq 0x28bc0
movq %rax, 0x1b8(%rsp)
cmpq $0x0, 0x1b8(%rsp)
jne 0x27793
movb $0x0, 0x1c7(%rsp)
jmp 0x28ba0
movq 0x30c82b6(%rip), %rdi   # 0x30efa50
callq 0x290e0
movq %rax, 0x1b0(%rsp)
leaq 0x1fc82(%rip), %rax     # 0x47430
cmpl $0x200, (%rax)          # imm = 0x200
setl %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x2b, %esi
callq 0xbe90
leaq 0xa27cb6(%rip), %rax    # 0xa4f484
movl (%rax), %eax
movl %eax, 0x19c(%rsp)
leaq 0x1fc52(%rip), %rax     # 0x47430
movl (%rax), %eax
movl %eax, 0x198(%rsp)
movslq 0x198(%rsp), %rcx
leaq 0x1fc4a(%rip), %rax     # 0x47440
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, 0x1a0(%rsp)
leaq 0x1fc24(%rip), %rax     # 0x47430
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1fc18(%rip), %rax     # 0x47430
movl %ecx, (%rax)
movl $0x0, 0x20c31ec(%rip)   # 0x20eaa10
movq 0x1a0(%rsp), %rax
movss 0x12e08(%rip), %xmm0    # 0x3a63c
movss %xmm0, (%rax)
movq 0x1a0(%rsp), %rax
movss 0x12df4(%rip), %xmm0    # 0x3a63c
movss %xmm0, 0x4(%rax)
movq 0x1a0(%rsp), %rax
movss 0x12ddf(%rip), %xmm0    # 0x3a63c
movss %xmm0, 0x8(%rax)
movq 0x1a0(%rsp), %rax
movss 0xe7ca(%rip), %xmm0     # 0x3603c
movss %xmm0, 0xc(%rax)
movq 0x1a0(%rsp), %rax
movss 0xe7b5(%rip), %xmm0     # 0x3603c
movss %xmm0, 0x10(%rax)
movq 0x1a0(%rsp), %rax
movss 0xe7a0(%rip), %xmm0     # 0x3603c
movss %xmm0, 0x14(%rax)
movq 0x1b8(%rsp), %rax
movsd (%rax), %xmm0
movq 0x1b8(%rsp), %rax
ucomisd 0x18(%rax), %xmm0
jbe 0x278e1
movl 0x198(%rsp), %edx
movl 0x20c3147(%rip), %ecx   # 0x20eaa10
movl $0x4, %edi
leaq 0x13bfc(%rip), %rsi     # 0x3b4d1
movb $0x0, %al
callq 0xbb80
jmp 0x27c0f
movq 0x1b8(%rsp), %rax
movsd (%rax), %xmm0
movslq 0x20c311c(%rip), %rcx   # 0x20eaa10
leaq 0x1fa35(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd (%rax), %xmm0
movsd %xmm0, 0x180(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movslq 0x20c30ed(%rip), %rcx   # 0x20eaa10
leaq 0x1fa06(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, 0x188(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x10(%rax), %xmm0
movslq 0x20c30bd(%rip), %rcx   # 0x20eaa10
leaq 0x1f9d6(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x10(%rax), %xmm0
movsd %xmm0, 0x190(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x18(%rax), %xmm0
movslq 0x20c308d(%rip), %rcx   # 0x20eaa10
leaq 0x1f9a6(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x18(%rax), %xmm0
movsd %xmm0, 0x160(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x20(%rax), %xmm0
movslq 0x20c305d(%rip), %rcx   # 0x20eaa10
leaq 0x1f976(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x20(%rax), %xmm0
movsd %xmm0, 0x168(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x28(%rax), %xmm0
movslq 0x20c302d(%rip), %rcx   # 0x20eaa10
leaq 0x1f946(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x28(%rax), %xmm0
movsd %xmm0, 0x170(%rsp)
movl $0x0, 0x15c(%rsp)
cmpl $0x3, 0x15c(%rsp)
jge 0x27abf
movslq 0x15c(%rsp), %rax
movsd 0x180(%rsp,%rax,8), %xmm0
movslq 0x15c(%rsp), %rax
ucomisd 0x160(%rsp,%rax,8), %xmm0
jbe 0x27aa7
movslq 0x15c(%rsp), %rax
movsd 0x180(%rsp,%rax,8), %xmm0
movslq 0x15c(%rsp), %rax
addsd 0x160(%rsp,%rax,8), %xmm0
movsd 0x125a2(%rip), %xmm1    # 0x3a008
divsd %xmm1, %xmm0
movsd %xmm0, 0x150(%rsp)
movsd 0x150(%rsp), %xmm0
movslq 0x15c(%rsp), %rax
movsd %xmm0, 0x180(%rsp,%rax,8)
movsd 0x150(%rsp), %xmm0
movslq 0x15c(%rsp), %rax
movsd %xmm0, 0x160(%rsp,%rax,8)
jmp 0x27aa9
movl 0x15c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x15c(%rsp)
jmp 0x27a0a
movl $0x0, 0x15c(%rsp)
cmpl $0x3, 0x15c(%rsp)
jge 0x27c0d
movq 0x1a0(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movss 0xc(%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movslq 0x15c(%rsp), %rax
ucomisd 0x160(%rsp,%rax,8), %xmm0
jbe 0x27b2a
movq 0x1a0(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movss 0xc(%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x88(%rsp)
jmp 0x27b44
movslq 0x15c(%rsp), %rax
movsd 0x160(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x88(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movss %xmm0, 0xc(%rax,%rcx,4)
movq 0x1a0(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movslq 0x15c(%rsp), %rax
movsd 0x180(%rsp,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x27bbb
movq 0x1a0(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x80(%rsp)
jmp 0x27bd5
movslq 0x15c(%rsp), %rax
movsd 0x180(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x80(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x15c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x15c(%rsp)
jmp 0x27aca
jmp 0x27c0f
movq 0x1b8(%rsp), %rdi
movq 0x1b0(%rsp), %rsi
cmpl $0x0, 0x198(%rsp)
sete %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x2afe0
movq %rax, 0x1a8(%rsp)
leaq 0x1f7ec(%rip), %rax     # 0x47430
cmpl $0x1, (%rax)
jne 0x27c96
testb $0x1, 0x20c7dd2(%rip)   # 0x20efa22
jne 0x27c96
testb $0x1, 0x20c7dca(%rip)   # 0x20efa23
jne 0x27c68
movq 0x1a8(%rsp), %rdi
callq 0x22480
movq 0x1a8(%rsp), %rdi
movb 0x20c7db3(%rip), %al    # 0x20efa29
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
setne %al
movzbl %al, %esi
andl $0x1, %esi
xorl %edx, %edx
callq 0x218a0
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x23910
movq 0x1a8(%rsp), %rdi
callq 0x30900
callq 0x304a0
leaq 0x10c770c(%rip), %rax   # 0x10ef3c8
movl (%rax), %ecx
movq 0x1a0(%rsp), %rax
movl %ecx, 0x24(%rax)
leaq 0x1b876f4(%rip), %rax   # 0x1baf3c4
movl (%rax), %ecx
movq 0x1a0(%rsp), %rax
movl %ecx, 0x38(%rax)
movb $0x0, 0x14f(%rsp)
movq 0x1a8(%rsp), %rax
cmpl $-0x1, 0x80(%rax)
jne 0x2809b
movb $0x1, 0x14f(%rsp)
movq 0x1a8(%rsp), %rax
movq 0xa8(%rax), %rax
cmpq $0x0, (%rax)
je 0x27d23
xorl %edi, %edi
movl $0x16, %esi
callq 0xbe90
leaq 0xb0768a(%rip), %rax    # 0xb2f3b4
cmpl $0x0, (%rax)
jne 0x27d3d
leaq 0x137b3(%rip), %rdi     # 0x3b4e9
movb $0x0, %al
callq 0xb510
movq 0x1a8(%rsp), %rax
movl $0x0, 0x80(%rax)
callq 0x25b80
movq %rax, %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x88(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movl $0xffffffff, 0x80(%rax) # imm = 0xFFFFFFFF
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movl $0xffffffff, 0xa0(%rax) # imm = 0xFFFFFFFF
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movb $0x0, 0x48(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movb $0x1, 0x49(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movb $0x0, 0x4a(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movq $0x0, 0x98(%rax)
movl $0x1, %edi
movl $0x8, %esi
callq 0x41e0
movq %rax, %rcx
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
movq %rcx, 0xa8(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x58(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x70(%rax)
movq 0x1a8(%rsp), %rax
movq 0x88(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rax)
callq 0x25b80
movq %rax, %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x90(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movl $0xffffffff, 0x80(%rax) # imm = 0xFFFFFFFF
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movl $0xffffffff, 0xa0(%rax) # imm = 0xFFFFFFFF
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movb $0x0, 0x48(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movb $0x1, 0x49(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movb $0x0, 0x4a(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq $0x0, 0x98(%rax)
movl $0x1, %edi
movl $0x8, %esi
callq 0x41e0
movq %rax, %rcx
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq %rcx, 0xa8(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x58(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x70(%rax)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rax)
movq 0x1a8(%rsp), %rax
movl $0x0, 0xa0(%rax)
movq 0x1a8(%rsp), %rax
movb $0x0, 0x48(%rax)
movq 0x1a8(%rsp), %rax
movb $0x0, 0x49(%rax)
movq 0x1a8(%rsp), %rax
movq $0x0, 0x98(%rax)
movq 0x1a8(%rsp), %rax
movq $0x0, 0xa8(%rax)
movq 0x1a8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rax)
movq 0x1a8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x58(%rax)
movq 0x1a8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rax)
movq 0x1a8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rax)
movq 0x1a8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x70(%rax)
movq 0x1a8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rax)
movq 0x1a8(%rsp), %rdi
callq 0x32b30
leaq 0x1b87315(%rip), %rax   # 0x1baf3c4
movl (%rax), %ecx
movq 0x1a0(%rsp), %rax
subl 0x38(%rax), %ecx
movq 0x1a0(%rsp), %rax
movl %ecx, 0x3c(%rax)
leaq 0xa273b6(%rip), %rax    # 0xa4f484
movl (%rax), %ecx
subl 0x19c(%rsp), %ecx
movq 0x1a0(%rsp), %rax
movl %ecx, 0x34(%rax)
testb $0x1, 0x20c793d(%rip)   # 0x20efa26
je 0x2811d
movq 0x1a0(%rsp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
movq 0x1a0(%rsp), %rax
movl $0xffffffff, 0x2c(%rax) # imm = 0xFFFFFFFF
movq 0x1a0(%rsp), %rax
movl $0xffffffff, 0x30(%rax) # imm = 0xFFFFFFFF
jmp 0x285d9
movl $0x1, 0x20c28e9(%rip)   # 0x20eaa10
cmpl $0x4, 0x20c28e2(%rip)   # 0x20eaa10
jge 0x285d7
movslq 0x20c28d5(%rip), %rcx   # 0x20eaa10
leaq 0x30c78ee(%rip), %rax   # 0x30efa30
movq (%rax,%rcx,8), %rdi
callq 0x28bc0
movq %rax, 0x1b8(%rsp)
movslq 0x20c28b6(%rip), %rcx   # 0x20eaa10
leaq 0x30c78ef(%rip), %rax   # 0x30efa50
movq (%rax,%rcx,8), %rdi
callq 0x290e0
movq %rax, 0x1b0(%rsp)
movl 0x20c2898(%rip), %eax   # 0x20eaa10
movl %eax, 0x148(%rsp)
movq 0x1b8(%rsp), %rax
movsd (%rax), %xmm0
movq 0x1b8(%rsp), %rax
ucomisd 0x18(%rax), %xmm0
jbe 0x281c0
movl 0x198(%rsp), %edx
movl 0x148(%rsp), %ecx
movl $0x3, %edi
leaq 0x1331d(%rip), %rsi     # 0x3b4d1
movb $0x0, %al
callq 0xbb80
jmp 0x284e2
movq 0x1b8(%rsp), %rax
movsd (%rax), %xmm0
movslq 0x148(%rsp), %rcx
leaq 0x1f155(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd (%rax), %xmm0
movsd %xmm0, 0x130(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movslq 0x148(%rsp), %rcx
leaq 0x1f125(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, 0x138(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x10(%rax), %xmm0
movslq 0x148(%rsp), %rcx
leaq 0x1f0f4(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x10(%rax), %xmm0
movsd %xmm0, 0x140(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x18(%rax), %xmm0
movslq 0x148(%rsp), %rcx
leaq 0x1f0c3(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x18(%rax), %xmm0
movsd %xmm0, 0x110(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x20(%rax), %xmm0
movslq 0x148(%rsp), %rcx
leaq 0x1f092(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x20(%rax), %xmm0
movsd %xmm0, 0x118(%rsp)
movq 0x1b8(%rsp), %rax
movsd 0x28(%rax), %xmm0
movslq 0x148(%rsp), %rcx
leaq 0x1f061(%rip), %rax     # 0x47330
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
subsd 0x28(%rax), %xmm0
movsd %xmm0, 0x120(%rsp)
movl $0x0, 0x10c(%rsp)
cmpl $0x3, 0x10c(%rsp)
jge 0x283a4
movslq 0x10c(%rsp), %rax
movsd 0x130(%rsp,%rax,8), %xmm0
movslq 0x10c(%rsp), %rax
ucomisd 0x110(%rsp,%rax,8), %xmm0
jbe 0x2838c
movslq 0x10c(%rsp), %rax
movsd 0x130(%rsp,%rax,8), %xmm0
movslq 0x10c(%rsp), %rax
addsd 0x110(%rsp,%rax,8), %xmm0
movsd 0x11cbd(%rip), %xmm1    # 0x3a008
divsd %xmm1, %xmm0
movsd %xmm0, 0x100(%rsp)
movsd 0x100(%rsp), %xmm0
movslq 0x10c(%rsp), %rax
movsd %xmm0, 0x130(%rsp,%rax,8)
movsd 0x100(%rsp), %xmm0
movslq 0x10c(%rsp), %rax
movsd %xmm0, 0x110(%rsp,%rax,8)
jmp 0x2838e
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x282ef
movl $0x0, 0x10c(%rsp)
cmpl $0x3, 0x10c(%rsp)
jge 0x284e0
movq 0x1a0(%rsp), %rax
movslq 0x10c(%rsp), %rcx
movss 0xc(%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movslq 0x10c(%rsp), %rax
ucomisd 0x110(%rsp,%rax,8), %xmm0
jbe 0x2840c
movq 0x1a0(%rsp), %rax
movslq 0x10c(%rsp), %rcx
movss 0xc(%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
jmp 0x28423
movslq 0x10c(%rsp), %rax
movsd 0x110(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movslq 0x10c(%rsp), %rcx
movss %xmm0, 0xc(%rax,%rcx,4)
movq 0x1a0(%rsp), %rax
movslq 0x10c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movslq 0x10c(%rsp), %rax
movsd 0x130(%rsp,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x28494
movq 0x1a0(%rsp), %rax
movslq 0x10c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x70(%rsp)
jmp 0x284ab
movslq 0x10c(%rsp), %rax
movsd 0x130(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x70(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movslq 0x10c(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x283af
jmp 0x284e2
movq 0x1b8(%rsp), %rdi
movq 0x1b0(%rsp), %rsi
cmpl $0x0, 0x198(%rsp)
sete %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x2afe0
movq %rax, 0x1a8(%rsp)
leaq 0x1ef19(%rip), %rax     # 0x47430
cmpl $0x1, (%rax)
jne 0x28557
testb $0x1, 0x20c74ff(%rip)   # 0x20efa22
jne 0x28557
movq 0x1a8(%rsp), %rdi
movb 0x20c74f6(%rip), %al    # 0x20efa29
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
setne %al
movl 0x20c24cc(%rip), %edx   # 0x20eaa10
movzbl %al, %esi
andl $0x1, %esi
callq 0x218a0
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x23910
movq 0x1a8(%rsp), %rax
cmpl $-0x1, 0x80(%rax)
jne 0x28598
movq 0x1a8(%rsp), %rax
movl 0xa0(%rax), %edx
movq 0x1a0(%rsp), %rax
movslq 0x20c247e(%rip), %rcx   # 0x20eaa10
movl %edx, 0x24(%rax,%rcx,4)
jmp 0x285c1
leaq 0x1cc6e21(%rip), %rax   # 0x1cef3c0
movl (%rax), %edx
movq 0x1a0(%rsp), %rax
movslq 0x20c2460(%rip), %rcx   # 0x20eaa10
movl %edx, 0x24(%rax,%rcx,4)
movq 0x1a8(%rsp), %rdi
callq 0x324f0
jmp 0x285c3
movl 0x20c2447(%rip), %eax   # 0x20eaa10
addl $0x1, %eax
movl %eax, 0x20c243e(%rip)   # 0x20eaa10
jmp 0x28127
jmp 0x285d9
movl 0x198(%rsp), %edi
callq 0x8ce0
movq %rax, 0xf8(%rsp)
leaq 0x2014e0c(%rip), %rax   # 0x203d400
cmpq %rax, 0xf8(%rsp)
je 0x287d2
movq 0xf8(%rsp), %rdi
leaq 0x12eea(%rip), %rsi     # 0x3b4fb
callq 0x7cd0
cmpb $0x0, (%rax)
je 0x287d2
xorps %xmm0, %xmm0
movsd %xmm0, 0xf0(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xe8(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xe0(%rsp)
movq 0xf8(%rsp), %rdi
leaq 0xdfe0(%rip), %rsi      # 0x36632
callq 0x7cd0
movq %rax, %rdi
leaq 0xe0(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
addq $0x8, %rcx
leaq 0xe0(%rsp), %r8
addq $0x10, %r8
leaq 0x12e94(%rip), %rsi     # 0x3b515
movb $0x0, %al
callq 0x42d0
movq 0xf8(%rsp), %rdi
leaq 0x12e64(%rip), %rsi     # 0x3b4fb
callq 0x7cd0
movq %rax, %rdi
leaq 0xc0(%rsp), %rdx
leaq 0xc0(%rsp), %rcx
addq $0x8, %rcx
leaq 0xc0(%rsp), %r8
addq $0x10, %r8
leaq 0xa0(%rsp), %r9
leaq 0xa0(%rsp), %r10
addq $0x8, %r10
leaq 0xa0(%rsp), %rax
addq $0x10, %rax
leaq 0x12e23(%rip), %rsi     # 0x3b509
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x42d0
cmpl $0x6, %eax
jne 0x287d0
movsd 0xc0(%rsp), %xmm0
subsd 0xe0(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss %xmm0, (%rax)
movsd 0xc8(%rsp), %xmm0
subsd 0xe8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss %xmm0, 0x4(%rax)
movsd 0xd0(%rsp), %xmm0
subsd 0xf0(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss %xmm0, 0x8(%rax)
movsd 0xa0(%rsp), %xmm0
subsd 0xe0(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss %xmm0, 0xc(%rax)
movsd 0xa8(%rsp), %xmm0
subsd 0xe8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss %xmm0, 0x10(%rax)
movsd 0xb0(%rsp), %xmm0
subsd 0xf0(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss %xmm0, 0x14(%rax)
jmp 0x287d2
movl 0x198(%rsp), %edx
movq 0x1a0(%rsp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq 0x1a0(%rsp), %rax
movss 0x8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movq 0x1a0(%rsp), %rax
movss 0xc(%rax), %xmm3
cvtss2sd %xmm3, %xmm3
movq 0x1a0(%rsp), %rax
movss 0x10(%rax), %xmm4
cvtss2sd %xmm4, %xmm4
movq 0x1a0(%rsp), %rax
movss 0x14(%rax), %xmm5
cvtss2sd %xmm5, %xmm5
movl $0x3, %edi
leaq 0x12cd7(%rip), %rsi     # 0x3b521
movb $0x6, %al
callq 0xbb80
movq 0x1a0(%rsp), %rax
movss (%rax), %xmm0
movq 0x1a0(%rsp), %rax
ucomiss 0xc(%rax), %xmm0
jbe 0x289fb
leaq 0x1ebba(%rip), %rax     # 0x47430
movl (%rax), %edi
subl $0x1, %edi
callq 0x8ce0
movq %rax, 0x98(%rsp)
leaq 0x1eba1(%rip), %rax     # 0x47430
movl (%rax), %eax
subl $0x1, %eax
cmpl $0x0, %eax
je 0x288b6
leaq 0x2014b60(%rip), %rax   # 0x203d400
cmpq %rax, 0x98(%rsp)
jne 0x288b6
movq $0x0, 0x98(%rsp)
leaq 0x1eb73(%rip), %rax     # 0x47430
movl (%rax), %eax
subl $0x1, %eax
movl %eax, 0x6c(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x288ec
movq 0x98(%rsp), %rdi
leaq 0xdc65(%rip), %rsi      # 0x36545
callq 0x7cd0
movq %rax, 0x60(%rsp)
jmp 0x288fa
leaq 0x12cae(%rip), %rax     # 0x3b5a1
movq %rax, 0x60(%rsp)
jmp 0x288fa
movq 0x60(%rsp), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x2892a
movq 0x98(%rsp), %rdi
leaq 0xdd14(%rip), %rsi      # 0x36632
callq 0x7cd0
movq %rax, 0x50(%rsp)
jmp 0x28938
leaq 0x12c70(%rip), %rax     # 0x3b5a1
movq %rax, 0x50(%rsp)
jmp 0x28938
movq 0x50(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x28968
movq 0x98(%rsp), %rdi
leaq 0xdd64(%rip), %rsi      # 0x366c0
callq 0x7cd0
movq %rax, 0x40(%rsp)
jmp 0x28976
leaq 0x12c32(%rip), %rax     # 0x3b5a1
movq %rax, 0x40(%rsp)
jmp 0x28976
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rdx
movl 0x6c(%rsp), %esi
movq 0x40(%rsp), %r8
leaq 0x12bbd(%rip), %rdi     # 0x3b54d
movb $0x0, %al
callq 0xb980
movq 0x1a0(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movq 0x1a0(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x4(%rax)
movq 0x1a0(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, (%rax)
movq 0x1a0(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x14(%rax)
movq 0x1a0(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x10(%rax)
movq 0x1a0(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rax)
jmp 0x28b98
testb $0x1, 0x14f(%rsp)
je 0x28b96
leaq 0x1ea20(%rip), %rax     # 0x47430
movl (%rax), %edi
subl $0x1, %edi
callq 0x8ce0
movq %rax, 0x90(%rsp)
leaq 0x1ea07(%rip), %rax     # 0x47430
movl (%rax), %eax
subl $0x1, %eax
cmpl $0x0, %eax
je 0x28a50
leaq 0x20149c6(%rip), %rax   # 0x203d400
cmpq %rax, 0x90(%rsp)
jne 0x28a50
movq $0x0, 0x90(%rsp)
leaq 0x1e9d9(%rip), %rax     # 0x47430
movl (%rax), %eax
subl $0x1, %eax
movl %eax, 0x3c(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x28a86
movq 0x90(%rsp), %rdi
leaq 0xdacb(%rip), %rsi      # 0x36545
callq 0x7cd0
movq %rax, 0x30(%rsp)
jmp 0x28a94
leaq 0x12b14(%rip), %rax     # 0x3b5a1
movq %rax, 0x30(%rsp)
jmp 0x28a94
movq 0x30(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x28ac4
movq 0x90(%rsp), %rdi
leaq 0xdb7a(%rip), %rsi      # 0x36632
callq 0x7cd0
movq %rax, 0x20(%rsp)
jmp 0x28ad2
leaq 0x12ad6(%rip), %rax     # 0x3b5a1
movq %rax, 0x20(%rsp)
jmp 0x28ad2
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x28b02
movq 0x90(%rsp), %rdi
leaq 0xdbca(%rip), %rsi      # 0x366c0
callq 0x7cd0
movq %rax, 0x10(%rsp)
jmp 0x28b10
leaq 0x12a98(%rip), %rax     # 0x3b5a1
movq %rax, 0x10(%rsp)
jmp 0x28b10
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rdx
movl 0x3c(%rsp), %esi
movq 0x10(%rsp), %r8
movq 0x1a0(%rsp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x1a0(%rsp), %rax
movss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq 0x1a0(%rsp), %rax
movss 0x8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movq 0x1a0(%rsp), %rax
movss 0xc(%rax), %xmm3
cvtss2sd %xmm3, %xmm3
movq 0x1a0(%rsp), %rax
movss 0x10(%rax), %xmm4
cvtss2sd %xmm4, %xmm4
movq 0x1a0(%rsp), %rax
movss 0x14(%rax), %xmm5
cvtss2sd %xmm5, %xmm5
leaq 0x12a1a(%rip), %rdi     # 0x3b5a9
movb $0x6, %al
callq 0xb980
jmp 0x28b98
movb $0x1, 0x1c7(%rsp)
movb 0x1c7(%rsp), %al
andb $0x1, %al
addq $0x1c8, %rsp            # imm = 0x1C8
retq
nopw %cs:(%rax,%rax)