// File: FreeSlave[P]vhlt/hlrad/qrad.cpp
// Function: AddFaceToOpaqueList(int, int, float const*, float const (&) [3], bool, int, bool)
static void     AddFaceToOpaqueList(
#ifdef HLRAD_OPAQUE_NODE
									int entitynum, int modelnum, const vec3_t origin
#else
									const unsigned facenum, const Winding* const winding
#endif
#ifdef HLRAD_HULLU
									, const vec3_t &transparency_scale, const bool transparency
#endif
#ifndef HLRAD_OPAQUE_NODE
#ifdef HLRAD_OPAQUE_GROUP
									, const dmodel_t* mod
#endif
#endif
#ifdef HLRAD_OPAQUE_STYLE
									, int style
#endif
#ifdef HLRAD_OPAQUE_BLOCK
									, bool block
#endif
									)
{
    if (g_opaque_face_count == g_max_opaque_face_count)
    {
        g_max_opaque_face_count += OPAQUE_ARRAY_GROWTH_SIZE;
        g_opaque_face_list = (opaqueList_t*)realloc(g_opaque_face_list, sizeof(opaqueList_t) * g_max_opaque_face_count);
#ifdef HLRAD_HLASSUMENOMEMORY
		hlassume (g_opaque_face_list != NULL, assume_NoMemory);
#endif
    }

    {
        opaqueList_t*   opaque = &g_opaque_face_list[g_opaque_face_count];

        g_opaque_face_count++;

#ifdef HLRAD_OPAQUE_STYLE
		if (transparency && style != -1)
		{
			Warning ("Dynamic shadow is not allowed in entity with custom shadow.\n");
			style = -1;
		}
#endif
#ifdef HLRAD_HULLU
        VectorCopy(transparency_scale, opaque->transparency_scale);
        opaque->transparency = transparency;
#endif
#ifdef HLRAD_OPAQUE_NODE
		opaque->entitynum = entitynum;
		opaque->modelnum = modelnum;
		VectorCopy (origin, opaque->origin);
#else
        opaque->facenum = facenum;
        getAdjustedPlaneFromFaceNumber(facenum, &opaque->plane);
        opaque->winding = new Winding(*winding);
#endif
#ifndef HLRAD_OPAQUE_NODE
#ifdef HLRAD_OPAQUE_GROUP
		{
			int ig;
			for (ig=0; ig<g_opaque_group_count; ++ig)
				if (mod==g_opaque_group_list[ig].mod)
					break;
			if (ig==g_opaque_group_count) //new opaque group
			{
				if (g_opaque_group_count>=MAX_OPAQUE_GROUP_COUNT)
					Error ("too many opaque models");
				g_opaque_group_list[ig].mod=mod;
#ifdef HLRAD_OPAQUE_RANGE
				for (int i=0; i<3; ++i)
				{
					g_opaque_group_list[ig].mins[i]=mod->mins[i]+g_face_offset[facenum][i]-1;
					g_opaque_group_list[ig].maxs[i]=mod->maxs[i]+g_face_offset[facenum][i]+1;
				}
#endif
				g_opaque_group_count++;
			}
			opaque->groupnum=ig;
		}
#endif
#endif
#ifdef HLRAD_OPAQUE_STYLE
		opaque->style = style;
#endif
#ifdef HLRAD_OPAQUE_BLOCK
		opaque->block = block;
#endif
    }
}

// Assembly:
subq $0x48, %rsp
movl %r8d, %eax
movq %rcx, (%rsp)
movq %rdx, %rcx
movq (%rsp), %rdx
movq %rcx, 0x8(%rsp)
movl %esi, %ecx
movq 0x8(%rsp), %rsi
movl %ecx, 0x14(%rsp)
movl %edi, %r8d
movl 0x14(%rsp), %edi
movb %al, %cl
movb 0x50(%rsp), %al
movl %r8d, 0x44(%rsp)
movl %edi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
andb $0x1, %cl
movb %cl, 0x2f(%rsp)
movl %r9d, 0x28(%rsp)
andb $0x1, %al
movb %al, 0x27(%rsp)
movl 0x54da4f6(%rip), %eax   # 0x552fa70
cmpl 0x54da4f4(%rip), %eax   # 0x552fa74
jne 0x555cb
movl 0x54da4ec(%rip), %eax   # 0x552fa74
addl $0x400, %eax            # imm = 0x400
movl %eax, 0x54da4e1(%rip)   # 0x552fa74
movq 0x54da4ce(%rip), %rdi   # 0x552fa68
movl 0x54da4d4(%rip), %eax   # 0x552fa74
imulq $0x2c, %rax, %rsi
callq 0x4590
movq %rax, 0x54da4b8(%rip)   # 0x552fa68
cmpq $0x0, 0x54da4b0(%rip)   # 0x552fa68
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movq 0x54da496(%rip), %rax   # 0x552fa68
movl 0x54da498(%rip), %ecx   # 0x552fa70
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movl 0x54da486(%rip), %eax   # 0x552fa70
addl $0x1, %eax
movl %eax, 0x54da47d(%rip)   # 0x552fa70
testb $0x1, 0x2f(%rsp)
je 0x55617
cmpl $-0x1, 0x28(%rsp)
je 0x55617
leaq 0x1c005(%rip), %rdi     # 0x7160d
movb $0x0, %al
callq 0xb9f0
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
movq 0x30(%rsp), %rax
movss (%rax), %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0x14(%rax)
movq 0x30(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0x18(%rax)
movq 0x30(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0x1c(%rax)
movb 0x2f(%rsp), %cl
movq 0x18(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x20(%rax)
movl 0x44(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, (%rax)
movl 0x40(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x38(%rsp), %rax
movss (%rax), %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0x8(%rax)
movq 0x38(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0xc(%rax)
movq 0x38(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0x10(%rax)
movl 0x28(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x24(%rax)
movb 0x27(%rsp), %cl
movq 0x18(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x28(%rax)
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)