// File: FreeSlave[P]vhlt/hlrad/qrad.cpp
// Function: ReadLightingCone()
void ReadLightingCone ()
{
	int num;
	int i, k;
	entity_t *mapent;
	epair_t *ep;

	num = ((dmiptexlump_t *)g_dtexdata)->nummiptex;
	g_lightingconeinfo = (vec3_t *)malloc (num * sizeof(vec3_t));
	for (i = 0; i < num; i++)
	{
		g_lightingconeinfo[i][0] = 1.0; // default power
		g_lightingconeinfo[i][1] = 1.0; // default scale
	}
	for (k = 0; k < g_numentities; k++)
	{
		mapent = &g_entities[k];
		if (strcmp(ValueForKey(mapent, "classname"), "info_angularfade"))
			continue;
		Developer (DEVELOPER_LEVEL_MESSAGE, "info_angularfade entity detected.\n");
		for (i = 0; i < num; i++)
		{
			const char *texname = ((miptex_t*)(g_dtexdata+((dmiptexlump_t*)g_dtexdata)->dataofs[i]))->name;
			for (ep = mapent->epairs; ep; ep = ep->next)
			{
				if (strcasecmp (ep->key, texname))
					continue;
				if (!strcasecmp (ep->key, "origin"))
					continue;
				double power, scale;
				int count;
				count = sscanf (ep->value, "%lf %lf", &power, &scale);
				if (count == 1)
				{
					scale = 1.0;
				}
				else if (count != 2)
				{
					Warning ("ignore bad angular fade value '%s'", ep->value);
					continue;
				}
				if (power < 0.0 || scale < 0.0)
				{
					Warning ("ignore disallowed angular fade value '%s'", ep->value);
					continue;
				}
				scale *= DefaultScaleForPower (power);
				g_lightingconeinfo[i][0] = power;
				g_lightingconeinfo[i][1] = scale;
				Developer (DEVELOPER_LEVEL_MESSAGE, "info_angularfade: %s = %f %f\n", texname, power, scale);
			}
		}
	}
}

// Assembly:
subq $0x48, %rsp
leaq 0x83777d(%rip), %rax    # 0x8864a8
movq (%rax), %rax
movl (%rax), %eax
movl %eax, 0x44(%rsp)
movslq 0x44(%rsp), %rax
imulq $0xc, %rax, %rdi
callq 0x4430
movq %rax, 0x5520e5f(%rip)   # 0x556fba8
movl $0x0, 0x40(%rsp)
movl 0x40(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x4eda7
movq 0x5520e46(%rip), %rax   # 0x556fba8
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x1b2d6(%rip), %xmm0    # 0x6a04c
movss %xmm0, (%rax)
movq 0x5520e27(%rip), %rax   # 0x556fba8
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x1b2b7(%rip), %xmm0    # 0x6a04c
movss %xmm0, 0x4(%rax)
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x4ed51
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
leaq 0x202567a(%rip), %rcx   # 0x2074434
cmpl (%rcx), %eax
jge 0x4eff8
movslq 0x3c(%rsp), %rcx
leaq 0x2025672(%rip), %rax   # 0x2074440
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x1b771(%rip), %rsi     # 0x6a557
callq 0x7d50
movq %rax, %rdi
leaq 0x204b0(%rip), %rsi     # 0x6f2a5
callq 0x4480
cmpl $0x0, %eax
je 0x4ee04
jmp 0x4efe8
movl $0x3, %edi
leaq 0x204a6(%rip), %rsi     # 0x6f2b6
movb $0x0, %al
callq 0xbbf0
movl $0x0, 0x40(%rsp)
movl 0x40(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x4efe6
leaq 0x837674(%rip), %rax    # 0x8864a8
movq (%rax), %rax
leaq 0x83766a(%rip), %rcx    # 0x8864a8
movq (%rcx), %rcx
movslq 0x40(%rsp), %rdx
movslq 0x4(%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x4efd4
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x4350
cmpl $0x0, %eax
je 0x4ee8a
jmp 0x4efc2
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x2271a(%rip), %rsi     # 0x715b4
callq 0x4350
cmpl $0x0, %eax
jne 0x4eea9
jmp 0x4efc2
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x1f10b(%rip), %rsi     # 0x6dfc4
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movb $0x0, %al
callq 0x4300
movl %eax, 0xc(%rsp)
cmpl $0x1, 0xc(%rsp)
jne 0x4eee5
movsd 0x1e30b(%rip), %xmm0    # 0x6d1e8
movsd %xmm0, 0x10(%rsp)
jmp 0x4ef0a
cmpl $0x2, 0xc(%rsp)
je 0x4ef08
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rsi
leaq 0x203dd(%rip), %rdi     # 0x6f2d9
movb $0x0, %al
callq 0xb9f0
jmp 0x4efc2
jmp 0x4ef0a
xorps %xmm0, %xmm0
ucomisd 0x18(%rsp), %xmm0
ja 0x4ef20
xorps %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
jbe 0x4ef3c
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rsi
leaq 0x203cc(%rip), %rdi     # 0x6f2fc
movb $0x0, %al
callq 0xb9f0
jmp 0x4efc2
movsd 0x18(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x4f000
cvtss2sd %xmm0, %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x5520c3c(%rip), %rax   # 0x556fba8
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movsd 0x10(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x5520c1b(%rip), %rax   # 0x556fba8
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movq 0x20(%rsp), %rdx
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movl $0x3, %edi
leaq 0x2036b(%rip), %rsi     # 0x6f326
movb $0x2, %al
callq 0xbbf0
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x4ee61
jmp 0x4efd6
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x4ee1f
jmp 0x4efe8
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x4edaf
addq $0x48, %rsp
retq
nopl (%rax)