// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: CreateOpaqueNodes()
void CreateOpaqueNodes ()
{
	int i, j;
	opaquemodels = (opaquemodel_t *)calloc (g_nummodels, sizeof (opaquemodel_t));
	opaquenodes = (opaquenode_t *)calloc (g_numnodes, sizeof (opaquenode_t));
	opaquefaces = (opaqueface_t *)calloc (g_numfaces, sizeof (opaqueface_t));
	for (i = 0; i < g_numfaces; i++)
	{
		opaqueface_t *of = &opaquefaces[i];
		dface_t *df = &g_dfaces[i];
		of->winding = new Winding (*df);
		if (of->winding->m_NumPoints < 3)
		{
			delete of->winding;
			of->winding = NULL;
		}
		of->plane = g_dplanes[df->planenum];
		if (df->side)
		{
			VectorInverse (of->plane.normal);
			of->plane.dist = -of->plane.dist;
		}
#ifdef HLRAD_OPAQUE_ALPHATEST
		of->texinfo = df->texinfo;
		texinfo_t *info = &g_texinfo[of->texinfo];
		for (j = 0; j < 2; j++)
		{
			for (int k = 0; k < 4; k++)
			{
				of->tex_vecs[j][k] = info->vecs[j][k];
			}
		}
		radtexture_t *tex = &g_textures[info->miptex];
		of->tex_alphatest = tex->name[0] == '{';
		of->tex_width = tex->width;
		of->tex_height = tex->height;
		of->tex_canvas = tex->canvas;
#endif
	}
	for (i = 0; i < g_numnodes; i++)
	{
		opaquenode_t *on = &opaquenodes[i];
		dnode_t *dn = &g_dnodes[i];
		on->type = g_dplanes[dn->planenum].type;
		VectorCopy (g_dplanes[dn->planenum].normal, on->normal);
		on->dist = g_dplanes[dn->planenum].dist;
		on->children[0] = dn->children[0];
		on->children[1] = dn->children[1];
		on->firstface = dn->firstface;
		on->numfaces = dn->numfaces;
		on->numfaces = MergeOpaqueFaces (on->firstface, on->numfaces);
	}
	for (i = 0; i < g_numfaces; i++)
	{
		BuildFaceEdges (&opaquefaces[i]);
	}
	for (i = 0; i < g_nummodels; i++)
	{
		opaquemodel_t *om = &opaquemodels[i];
		dmodel_t *dm = &g_dmodels[i];
		om->headnode = dm->headnode[0];
		for (j = 0; j < 3; j++)
		{
			om->mins[j] = dm->mins[j] - 1;
			om->maxs[j] = dm->maxs[j] + 1;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x154b7(%rip), %rax     # 0x49460
movslq (%rax), %rdi
movl $0x1c, %esi
callq 0x41e0
movq %rax, 0x66c6b2b(%rip)   # 0x66faae8
leaq 0x10bd434(%rip), %rax   # 0x10f13f8
movslq (%rax), %rdi
movl $0x24, %esi
callq 0x41e0
movq %rax, 0x66c6b08(%rip)   # 0x66faae0
leaq 0x1b7d415(%rip), %rax   # 0x1bb13f4
movslq (%rax), %rbx
movl $0x60, %esi
movq %rbx, %rdi
callq 0x41e0
movq %rax, 0x66c6ae2(%rip)   # 0x66faad8
testq %rbx, %rbx
jle 0x34136
movl $0x30, %ebp
xorl %r15d, %r15d
movq 0x66c6aca(%rip), %r12   # 0x66faad8
leaq (%r15,%r15,4), %rbx
shlq $0x2, %rbx
addq 0x13fc3(%rip), %rbx     # 0x47fe0
movl $0x20, %edi
callq 0x42f0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
movss 0x7a4c(%rip), %xmm0     # 0x3ba84
callq 0xc700
leaq (%r15,%r15,2), %r13
shlq $0x5, %r13
addq %r12, %r13
movq %r14, (%r13)
cmpl $0x2, 0x8(%r14)
ja 0x34064
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq $0x0, (%r13)
movzwl (%rbx), %eax
leaq (%rax,%rax,4), %rax
leaq 0xafd37e(%rip), %rdx    # 0xb313f0
movl 0x10(%rdx,%rax,4), %ecx
movl %ecx, 0x18(%r13)
movups (%rdx,%rax,4), %xmm0
movups %xmm0, 0x8(%r13)
cmpw $0x0, 0x2(%rbx)
je 0x3409b
leaq 0x8(%r13), %rax
movups (%rax), %xmm0
xorps 0x3ff8(%rip), %xmm0     # 0x38090
movups %xmm0, (%rax)
movswq 0xa(%rbx), %rax
movl %eax, 0x28(%r13)
leaq (%rax,%rax,4), %rax
shlq $0x3, %rax
addq 0x13ebd(%rip), %rax     # 0x47f70
addq %rbp, %r12
movq %rax, %rcx
xorl %edx, %edx
xorl %esi, %esi
movss (%rcx,%rsi,4), %xmm0
movss %xmm0, (%r12,%rsi,4)
incq %rsi
cmpq $0x4, %rsi
jne 0x340bd
leaq 0x1(%rdx), %rsi
addq $0x10, %rcx
addq $0x10, %r12
testq %rdx, %rdx
movq %rsi, %rdx
je 0x340bb
leaq 0x523e8bc(%rip), %rcx   # 0x52729a8
movq (%rcx), %rcx
movslq 0x20(%rax), %rax
imulq $0x330, %rax, %rax      # imm = 0x330
cmpb $0x7b, (%rcx,%rax)
sete 0x2c(%r13)
movl 0x10(%rcx,%rax), %edx
movl %edx, 0x50(%r13)
movl 0x14(%rcx,%rax), %edx
movl %edx, 0x54(%r13)
movq 0x18(%rcx,%rax), %rax
movq %rax, 0x58(%r13)
incq %r15
leaq 0x1b7d2ce(%rip), %rax   # 0x1bb13f4
movslq (%rax), %rax
addq $0x60, %rbp
cmpq %rax, %r15
jl 0x34007
leaq 0x10bd2bb(%rip), %rbp   # 0x10f13f8
cmpl $0x0, (%rbp)
jle 0x3420f
leaq 0x10bd2b2(%rip), %rbx   # 0x10f1400
movl $0x20, %r14d
xorl %r15d, %r15d
leaq 0xafd292(%rip), %r12    # 0xb313f0
movq 0x66c697b(%rip), %r13   # 0x66faae0
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rax
movl 0x10(%r12,%rax,4), %eax
movl %eax, -0x20(%r13,%r14)
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rax
movss (%r12,%rax,4), %xmm0
movss %xmm0, -0x1c(%r13,%r14)
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rax
movss 0x4(%r12,%rax,4), %xmm0
movss %xmm0, -0x18(%r13,%r14)
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rax
movss 0x8(%r12,%rax,4), %xmm0
movss %xmm0, -0x14(%r13,%r14)
movslq (%rbx), %rax
leaq (%rax,%rax,4), %rax
movss 0xc(%r12,%rax,4), %xmm0
movss %xmm0, -0x10(%r13,%r14)
movswl 0x4(%rbx), %eax
movl %eax, -0xc(%r13,%r14)
movswl 0x6(%rbx), %eax
movl %eax, -0x8(%r13,%r14)
movzwl 0x14(%rbx), %edi
movl %edi, -0x4(%r13,%r14)
movzwl 0x16(%rbx), %esi
movl %esi, (%r13,%r14)
callq 0x33c67
movl %eax, (%r13,%r14)
incq %r15
movslq (%rbp), %rax
addq $0x18, %rbx
addq $0x24, %r14
cmpq %rax, %r15
jl 0x3415e
leaq 0x1b7d1de(%rip), %r15   # 0x1bb13f4
cmpl $0x0, (%r15)
jle 0x3423f
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x66c68b0(%rip), %rdi   # 0x66faad8
addq %rbx, %rdi
callq 0x33d93
incq %r14
movslq (%r15), %rax
addq $0x60, %rbx
cmpq %rax, %r14
jl 0x34221
leaq 0x1521a(%rip), %r10     # 0x49460
cmpl $0x0, (%r10)
jle 0x342d9
leaq 0x15219(%rip), %rax     # 0x49470
leaq 0xc(%rax), %rcx
movl $0xc, %edx
xorl %esi, %esi
movss 0x7106(%rip), %xmm0     # 0x3b370
movss 0x3ec6(%rip), %xmm1     # 0x38138
movq 0x66c686f(%rip), %rdi   # 0x66faae8
leaq (%rsi,%rsi,8), %r8
leaq (%r8,%r8,2), %r8
addq %rsi, %r8
movq %rsi, %r9
shlq $0x6, %r9
movl 0x24(%rax,%r9), %r9d
movl %r9d, 0x18(%rdi,%r8)
addq %rdx, %rdi
movq $-0x3, %r8
movss (%rcx,%r8,4), %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rdi,%r8,4)
movss 0xc(%rcx,%r8,4), %xmm2
addss %xmm1, %xmm2
movss %xmm2, 0xc(%rdi,%r8,4)
incq %r8
jne 0x3429f
incq %rsi
movslq (%r10), %rdi
addq $0x1c, %rdx
addq $0x40, %rcx
cmpq %rdi, %rsi
jl 0x34272
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4590