// File: /workspace/github_cpp_makefile_star2_O2/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 0x16845(%rip), %rax     # 0x45470
movslq (%rax), %rdi
pushq $0x1c
popq %rsi
callq 0x41f0
movq %rax, 0x66c7ebb(%rip)   # 0x66f6af8
leaq 0x10be7c4(%rip), %rax   # 0x10ed408
movslq (%rax), %rdi
pushq $0x24
popq %rsi
callq 0x41f0
movq %rax, 0x66c7e9a(%rip)   # 0x66f6af0
leaq 0x1b7e7a7(%rip), %rax   # 0x1bad404
movl (%rax), %ebp
movslq %ebp, %rdi
pushq $0x60
popq %rsi
callq 0x41f0
movq %rax, 0x66c7e77(%rip)   # 0x66f6ae8
pushq $0x30
popq %r13
xorl %r8d, %r8d
pushq $0x20
popq %rbx
movslq %ebp, %rax
cmpq %rax, %r8
jge 0x2edac
movq 0x66c7e5a(%rip), %r12   # 0x66f6ae8
imulq $0x14, %r8, %r14
addq 0x1534f(%rip), %r14     # 0x43fe8
movq %rbx, %rdi
movq %r8, %rbx
callq 0x42e0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movss 0x6d0f(%rip), %xmm0     # 0x359c4
callq 0xadb6
imulq $0x60, %rbx, %rbp
addq %r12, %rbp
movq %r15, (%rbp)
cmpl $0x2, 0x8(%r15)
movq %rbx, %r8
ja 0x2ece3
movq (%r15), %rax
movq %r15, %rdi
movq %r8, %rbx
callq *0x8(%rax)
movq %rbx, %r8
andq $0x0, (%rbp)
movzwl (%r14), %eax
imulq $0x14, %rax, %rax
leaq 0xafe70e(%rip), %rdx    # 0xb2d400
movl 0x10(%rdx,%rax), %ecx
movl %ecx, 0x18(%rbp)
movups (%rdx,%rax), %xmm0
movups %xmm0, 0x8(%rbp)
cmpw $0x0, 0x2(%r14)
je 0x2ed1a
leaq 0x8(%rbp), %rax
movups (%rax), %xmm0
xorps 0x6579(%rip), %xmm0     # 0x35290
movups %xmm0, (%rax)
movswq 0xa(%r14), %rax
movl %eax, 0x28(%rbp)
imulq $0x28, %rax, %rax
addq 0x15243(%rip), %rax     # 0x43f70
addq %r13, %r12
movq %rax, %rcx
xorl %edx, %edx
pushq $0x20
popq %rbx
cmpq $0x2, %rdx
je 0x2ed63
xorl %esi, %esi
cmpq $0x4, %rsi
je 0x2ed56
movss (%rcx,%rsi,4), %xmm0
movss %xmm0, (%r12,%rsi,4)
incq %rsi
jmp 0x2ed40
incq %rdx
addq $0x10, %rcx
addq $0x10, %r12
jmp 0x2ed38
leaq 0x523fc4e(%rip), %rcx   # 0x526e9b8
movq (%rcx), %rcx
movslq 0x20(%rax), %rax
imulq $0x330, %rax, %rax      # imm = 0x330
cmpb $0x7b, (%rcx,%rax)
sete 0x2c(%rbp)
movl 0x10(%rcx,%rax), %edx
movl %edx, 0x50(%rbp)
movl 0x14(%rcx,%rax), %edx
movl %edx, 0x54(%rbp)
movq 0x18(%rcx,%rax), %rax
movq %rax, 0x58(%rbp)
incq %r8
leaq 0x1b7e663(%rip), %rax   # 0x1bad404
movl (%rax), %ebp
addq $0x60, %r13
jmp 0x2ec7b
leaq 0x10be65d(%rip), %r14   # 0x10ed410
xorl %r15d, %r15d
leaq 0x1b7e647(%rip), %r13   # 0x1bad404
leaq 0x10be644(%rip), %rbp   # 0x10ed408
movslq (%rbp), %rax
cmpq %rax, %r15
jge 0x2ee7e
movq 0x66c7d18(%rip), %r12   # 0x66f6af0
movslq (%r14), %rax
imulq $0x14, %rax, %rax
leaq 0xafe61a(%rip), %rcx    # 0xb2d400
movl 0x10(%rcx,%rax), %eax
movl %eax, -0x20(%r12,%rbx)
movslq (%r14), %rax
imulq $0x14, %rax, %rax
movss (%rcx,%rax), %xmm0
movss %xmm0, -0x1c(%r12,%rbx)
movslq (%r14), %rax
imulq $0x14, %rax, %rax
movss 0x4(%rcx,%rax), %xmm0
movss %xmm0, -0x18(%r12,%rbx)
movslq (%r14), %rax
imulq $0x14, %rax, %rax
movss 0x8(%rcx,%rax), %xmm0
movss %xmm0, -0x14(%r12,%rbx)
movslq (%r14), %rax
imulq $0x14, %rax, %rax
movss 0xc(%rcx,%rax), %xmm0
movss %xmm0, -0x10(%r12,%rbx)
movswl 0x4(%r14), %eax
movl %eax, -0xc(%r12,%rbx)
movswl 0x6(%r14), %eax
movl %eax, -0x8(%r12,%rbx)
movzwl 0x14(%r14), %edi
movl %edi, -0x4(%r12,%rbx)
movzwl 0x16(%r14), %esi
movl %esi, (%r12,%rbx)
callq 0x2e9af
movl %eax, (%r12,%rbx)
incq %r15
addq $0x18, %r14
addq $0x24, %rbx
jmp 0x2edc4
xorl %ebx, %ebx
xorl %r14d, %r14d
movslq (%r13), %rax
cmpq %rax, %r14
jge 0x2eea4
movq 0x66c7c55(%rip), %rdi   # 0x66f6ae8
addq %rbx, %rdi
callq 0x2eab8
incq %r14
addq $0x60, %rbx
jmp 0x2ee83
leaq 0x165d5(%rip), %rax     # 0x45480
leaq 0xc(%rax), %rcx
pushq $0xc
popq %rdx
xorl %esi, %esi
pushq $-0xc
popq %rdi
movss 0x6409(%rip), %xmm0     # 0x352c8
movss 0x319d(%rip), %xmm1     # 0x32064
leaq 0x165a2(%rip), %r11     # 0x45470
movslq (%r11), %r8
cmpq %r8, %rsi
jge 0x2ef32
movq 0x66c7c1b(%rip), %r8    # 0x66f6af8
imulq $0x1c, %rsi, %r9
movq %rsi, %r10
shlq $0x6, %r10
movl 0x24(%rax,%r10), %r10d
movl %r10d, 0x18(%r8,%r9)
addq %rdx, %r8
movq %rdi, %r9
testq %r9, %r9
je 0x2ef25
movss (%rcx,%r9), %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%r8,%r9)
movss 0xc(%rcx,%r9), %xmm2
addss %xmm1, %xmm2
movss %xmm2, 0xc(%r8,%r9)
addq $0x4, %r9
jmp 0x2eef8
incq %rsi
addq $0x1c, %rdx
addq $0x40, %rcx
jmp 0x2eece
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x45a0