// File: /workspace/github_cpp_makefile_star2_O3/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 0x15512(%rip), %rax     # 0x48460
movslq (%rax), %rdi
movl $0x1c, %esi
callq 0x41e0
movq %rax, 0x66c6b86(%rip)   # 0x66f9ae8
leaq 0x10bd48f(%rip), %r13   # 0x10f03f8
movl (%r13), %ebp
movslq %ebp, %rdi
movl $0x24, %esi
callq 0x41e0
movq %rax, 0x66c6b5f(%rip)   # 0x66f9ae0
leaq 0x1b7d46c(%rip), %r12   # 0x1bb03f4
movslq (%r12), %rbx
movl $0x60, %esi
movq %rbx, %rdi
callq 0x41e0
movq %rax, 0x66c6b38(%rip)   # 0x66f9ad8
testq %rbx, %rbx
jle 0x330f0
movl $0x30, %ebp
xorl %r15d, %r15d
movq 0x66c6b20(%rip), %r12   # 0x66f9ad8
leaq (%r15,%r15,4), %rbx
shlq $0x2, %rbx
addq 0x14021(%rip), %rbx     # 0x46fe8
movl $0x20, %edi
callq 0x42e0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
movss 0x7a52(%rip), %xmm0     # 0x3aa34
callq 0xc54a
leaq (%r15,%r15,2), %r13
shlq $0x5, %r13
addq %r12, %r13
movq %r14, (%r13)
cmpl $0x2, 0x8(%r14)
ja 0x3300e
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq $0x0, (%r13)
movzwl (%rbx), %eax
leaq (%rax,%rax,4), %rax
leaq 0xafd3d4(%rip), %rdx    # 0xb303f0
movl 0x10(%rdx,%rax,4), %ecx
movl %ecx, 0x18(%r13)
movups (%rdx,%rax,4), %xmm0
movups %xmm0, 0x8(%r13)
cmpw $0x0, 0x2(%rbx)
je 0x33045
leaq 0x8(%r13), %rax
movups (%rax), %xmm0
xorps 0x403e(%rip), %xmm0     # 0x37080
movups %xmm0, (%rax)
movswq 0xa(%rbx), %rax
movl %eax, 0x28(%r13)
leaq (%rax,%rax,4), %rax
shlq $0x3, %rax
addq 0x13f13(%rip), %rax     # 0x46f70
addq %rbp, %r12
movb $0x1, %cl
xorl %edx, %edx
shlq $0x4, %rdx
leaq (%rax,%rdx), %rsi
addq %r12, %rdx
xorl %edi, %edi
movss (%rsi,%rdi,4), %xmm0
movss %xmm0, (%rdx,%rdi,4)
incq %rdi
cmpq $0x4, %rdi
jne 0x33071
movl $0x1, %edx
testb $0x1, %cl
movl $0x0, %ecx
jne 0x33064
leaq 0x523e90e(%rip), %rcx   # 0x52719a8
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 0x1b7d320(%rip), %r12   # 0x1bb03f4
movslq (%r12), %rbx
addq $0x60, %rbp
cmpq %rbx, %r15
jl 0x32fb1
leaq 0x10bd30c(%rip), %r13   # 0x10f03f8
movl (%r13), %ebp
testl %ebp, %ebp
jle 0x331d1
leaq 0x10bd301(%rip), %rbx   # 0x10f0400
movl $0x20, %r14d
xorl %r15d, %r15d
leaq 0xafd2e1(%rip), %r12    # 0xb303f0
movq %r13, %rbp
movq 0x66c69c7(%rip), %r13   # 0x66f9ae0
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 0x32c17
movl %eax, (%r13,%r14)
movq %rbp, %r13
incq %r15
movslq (%rbp), %rax
addq $0x18, %rbx
addq $0x24, %r14
cmpq %rax, %r15
jl 0x3310f
leaq 0x1b7d227(%rip), %r12   # 0x1bb03f4
movl (%r12), %ebx
testl %ebx, %ebx
jle 0x331f9
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x66c68f7(%rip), %rdi   # 0x66f9ad8
addq %rbx, %rdi
callq 0x32d5e
incq %r14
movslq (%r12), %rax
addq $0x60, %rbx
cmpq %rax, %r14
jl 0x331da
leaq 0x15260(%rip), %r10     # 0x48460
cmpl $0x0, (%r10)
jle 0x33293
leaq 0x1525f(%rip), %rax     # 0x48470
leaq 0xc(%rax), %rcx
movl $0xc, %edx
xorl %esi, %esi
movss 0x715c(%rip), %xmm0     # 0x3a380
movss 0x3e78(%rip), %xmm1     # 0x370a4
movq 0x66c68b5(%rip), %rdi   # 0x66f9ae8
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 0x33259
incq %rsi
movslq (%r10), %rdi
addq $0x1c, %rdx
addq $0x40, %rcx
cmpq %rdi, %rsi
jl 0x3322c
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 0x42f0
movq %rbx, %rdi
callq 0x4580