// File: /workspace/github_cpp_makefile_star2_O3/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 0x828e59(%rip), %rax    # 0x850498
movq (%rax), %rax
movslq (%rax), %r14
leaq (,%r14,4), %rax
leaq (%rax,%rax,2), %rbx
movq %rbx, %rdi
callq 0x4400
movq %rax, 0x5512528(%rip)   # 0x5539b88
movq %r14, 0x8(%rsp)
testq %r14, %r14
jle 0x2768f
xorl %eax, %eax
movl $0x3f800000, %ecx       # imm = 0x3F800000
movq 0x5512510(%rip), %rdx   # 0x5539b88
movl %ecx, (%rdx,%rax)
movq 0x5512506(%rip), %rdx   # 0x5539b88
movl %ecx, 0x4(%rdx,%rax)
addq $0xc, %rax
cmpq %rax, %rbx
jne 0x27671
leaq 0x2016d8e(%rip), %rax   # 0x203e424
cmpl $0x0, (%rax)
jle 0x27879
leaq 0x16f07(%rip), %r12     # 0x3e5ad
xorl %ecx, %ecx
movq %rcx, 0x18(%rsp)
movq %rcx, %rdi
shlq $0x5, %rdi
addq 0x1f915(%rip), %rdi     # 0x46fd0
movq %rdi, 0x20(%rsp)
leaq 0xff3c(%rip), %rsi      # 0x37603
callq 0x752d
movq %rax, %rdi
leaq 0x14bc8(%rip), %rsi     # 0x3c29e
callq 0x4430
testl %eax, %eax
jne 0x2785e
movl $0x3, %edi
leaq 0x14bc0(%rip), %rsi     # 0x3c2af
xorl %eax, %eax
callq 0xa446
cmpl $0x0, 0x8(%rsp)
jle 0x2785e
xorl %r13d, %r13d
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rbp
testq %rbp, %rbp
je 0x27850
leaq 0x828d7b(%rip), %rax    # 0x850498
movq (%rax), %rax
movslq 0x4(%rax,%r13,4), %rbx
addq %rax, %rbx
leaq (,%r13,4), %rax
leaq (%rax,%rax,2), %r15
movq 0x8(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4310
testl %eax, %eax
je 0x27755
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x27734
jmp 0x27850
movq %r14, %rdi
movq %r12, %rsi
callq 0x4310
testl %eax, %eax
je 0x27747
movq 0x10(%rbp), %rdi
leaq 0x13811(%rip), %rsi     # 0x3af80
leaq 0x10(%rsp), %rdx
movq %rsp, %rcx
xorl %eax, %eax
callq 0x42c0
cmpl $0x1, %eax
je 0x27793
cmpl $0x2, %eax
jne 0x27839
movsd (%rsp), %xmm0
jmp 0x277a9
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rsp)
movsd 0x129bf(%rip), %xmm0    # 0x3a168
xorpd %xmm2, %xmm2
movsd 0x10(%rsp), %xmm1
ucomisd %xmm1, %xmm2
ja 0x2782c
ucomisd %xmm0, %xmm2
ja 0x2782c
cvtsd2ss %xmm1, %xmm1
movaps %xmm1, %xmm2
addss 0xf8d6(%rip), %xmm2     # 0x370a4
mulss 0x13282(%rip), %xmm2    # 0x3aa58
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
movsd %xmm0, (%rsp)
movq 0x551239e(%rip), %rax   # 0x5539b88
movss %xmm1, (%rax,%r15)
xorps %xmm0, %xmm0
cvtsd2ss (%rsp), %xmm0
movq 0x5512389(%rip), %rax   # 0x5539b88
movss %xmm0, 0x4(%rax,%r15)
movsd 0x10(%rsp), %xmm0
movsd (%rsp), %xmm1
movl $0x3, %edi
leaq 0x14b02(%rip), %rsi     # 0x3c31f
movq %rbx, %rdx
movb $0x2, %al
callq 0xa446
jmp 0x27747
movq 0x10(%rbp), %rsi
leaq 0x14abe(%rip), %rdi     # 0x3c2f5
jmp 0x27844
movq 0x10(%rbp), %rsi
leaq 0x14a8e(%rip), %rdi     # 0x3c2d2
xorl %eax, %eax
callq 0xa2a6
jmp 0x27747
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x27704
movq 0x18(%rsp), %rcx
incq %rcx
leaq 0x2016bb7(%rip), %rax   # 0x203e424
movslq (%rax), %rax
cmpq %rax, %rcx
jl 0x276a8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq