// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x829294(%rip), %rax    # 0x84d4a8
movq (%rax), %rax
movslq (%rax), %rbx
imulq $0xc, %rbx, %rdi
callq 0x4420
movq %rax, 0x551296e(%rip)   # 0x5536b98
xorl %eax, %eax
testl %ebx, %ebx
movl $0x0, %ecx
cmovgl %ebx, %ecx
movq %rcx, 0x20(%rsp)
imulq $0xc, %rcx, %rcx
movl $0x3f800000, %edx       # imm = 0x3F800000
cmpq %rax, %rcx
je 0x24264
movq 0x5512948(%rip), %rsi   # 0x5536b98
movl %edx, (%rsi,%rax)
movq 0x551293e(%rip), %rsi   # 0x5536b98
movl %edx, 0x4(%rsi,%rax)
addq $0xc, %rax
jmp 0x24244
leaq 0x152c2(%rip), %r12     # 0x3952d
xorl %ecx, %ecx
leaq 0x20171c0(%rip), %rax   # 0x203b434
movslq (%rax), %rax
cmpq %rax, %rcx
jge 0x2441a
movq %rcx, 0x18(%rsp)
movq %rcx, %rdi
shlq $0x5, %rdi
addq 0x1fd3d(%rip), %rdi     # 0x43fd0
movq %rdi, 0x8(%rsp)
leaq 0xe2cc(%rip), %rsi      # 0x3256b
callq 0x6929
movq %rax, %rdi
leaq 0x12f70(%rip), %rsi     # 0x3721e
callq 0x4460
testl %eax, %eax
je 0x242c1
movq 0x18(%rsp), %rcx
incq %rcx
jmp 0x2426d
pushq $0x3
popq %rdi
leaq 0x12f64(%rip), %rsi     # 0x3722f
xorl %eax, %eax
callq 0x9045
addq $0x18, 0x8(%rsp)
xorl %r13d, %r13d
cmpq 0x20(%rsp), %r13
je 0x242b7
leaq 0x8291bf(%rip), %rax    # 0x84d4a8
movq (%rax), %rax
movslq 0x4(%rax,%r13,4), %r14
addq %rax, %r14
imulq $0xc, %r13, %r15
movq 0x8(%rsp), %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x24412
movq 0x8(%rbx), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x4320
testl %eax, %eax
jne 0x242fd
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4320
testl %eax, %eax
je 0x242fd
movq 0x10(%rbx), %rdi
leaq 0x11c0a(%rip), %rsi     # 0x35f40
leaq 0x10(%rsp), %rdx
movq %rsp, %rcx
xorl %eax, %eax
callq 0x42c0
cmpl $0x1, %eax
je 0x2435a
cmpl $0x2, %eax
jne 0x243fb
movsd (%rsp), %xmm0
jmp 0x24370
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rsp)
movsd 0x10d58(%rip), %xmm0    # 0x350c8
xorpd %xmm2, %xmm2
movsd 0x10(%rsp), %xmm1
ucomisd %xmm1, %xmm2
ja 0x243ee
ucomisd %xmm0, %xmm2
ja 0x243ee
cvtsd2ss %xmm1, %xmm1
movaps %xmm1, %xmm2
addss 0xdccf(%rip), %xmm2     # 0x32064
mulss 0x1164b(%rip), %xmm2    # 0x359e8
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
movsd %xmm0, (%rsp)
movq 0x55127e7(%rip), %rax   # 0x5536b98
movss %xmm1, (%rax,%r15)
cvtsd2ss (%rsp), %xmm0
movq 0x55127d5(%rip), %rax   # 0x5536b98
movss %xmm0, 0x4(%rax,%r15)
movsd 0x10(%rsp), %xmm0
movsd (%rsp), %xmm1
pushq $0x3
popq %rdi
leaq 0x12ec0(%rip), %rsi     # 0x3729f
movq %r14, %rdx
movb $0x2, %al
callq 0x9045
jmp 0x242fd
movq 0x10(%rbx), %rsi
leaq 0x12e7c(%rip), %rdi     # 0x37275
jmp 0x24406
movq 0x10(%rbx), %rsi
leaq 0x12e4c(%rip), %rdi     # 0x37252
xorl %eax, %eax
callq 0x8ea5
jmp 0x242fd
incq %r13
jmp 0x242db
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq