// File: FreeSlave[P]vhlt/hlrad/qrad.cpp
// Function: ReadInfoTexlights()
void            ReadInfoTexlights()
{
    int         k;
    int         values;
    int         numtexlights = 0;
    float       r, g, b, i;
    entity_t*   mapent;
    epair_t*    ep;
    texlight_t  texlight;

    for (k = 0; k < g_numentities; k++)
    {
        mapent = &g_entities[k];
        
        if (strcmp(ValueForKey(mapent, "classname"), "info_texlights"))
            continue;

#ifdef HLRAD_CUSTOMTEXLIGHT
		Log("Reading texlights from info_texlights map entity\n");
#else
        Log("[Reading texlights from info_texlights map entity]\n");
#endif

        for (ep = mapent->epairs; ep; ep = ep->next)
        {
            if (    !strcmp(ep->key, "classname") 
                 || !strcmp(ep->key, "origin")
               )
                continue; // we dont care about these keyvalues

            values = sscanf(ep->value, "%f %f %f %f", &r, &g, &b, &i);
            
            if (values == 1)
            {  
                g = b = r;
            }
            else if (values == 4) // use brightness value.
            {
                r *= i / 255.0;
                g *= i / 255.0;
                b *= i / 255.0;
            }
            else if (values != 3)
            {
                Warning("ignoring bad texlight '%s' in info_texlights entity", ep->key);
                continue;
            }

            texlight.name = ep->key;
            texlight.value[0] = r;
            texlight.value[1] = g;
            texlight.value[2] = b;
            texlight.filename = "info_texlights";
            s_texlights.push_back(texlight);
            numtexlights++;
        }

#ifndef HLRAD_CUSTOMTEXLIGHT
        Log("[%i texlights parsed from info_texlights map entity]\n\n", numtexlights);
#endif
    }
}

// Assembly:
subq $0x88, %rsp
movl $0x0, 0x7c(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x5b700
movl $0x0, 0x84(%rsp)
movl 0x84(%rsp), %eax
leaq 0x20253c2(%rip), %rcx   # 0x2074434
cmpl (%rcx), %eax
jge 0x4f2eb
movslq 0x84(%rsp), %rcx
shlq $0x5, %rcx
leaq 0x20253b3(%rip), %rax   # 0x2074440
addq %rcx, %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
leaq 0x1b4b6(%rip), %rsi     # 0x6a557
callq 0x7d50
movq %rax, 0x8(%rsp)
jmp 0x4f0ad
movq 0x8(%rsp), %rdi
leaq 0x2028b(%rip), %rsi     # 0x6f344
callq 0x4480
cmpl $0x0, %eax
je 0x4f0e5
jmp 0x4f2d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x18(%rsp)
movl %eax, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x5b780
jmp 0x4f2fd
leaq 0x20267(%rip), %rdi     # 0x6f353
xorl %eax, %eax
callq 0xb0d0
jmp 0x4f0f5
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x58(%rsp)
je 0x4f2d3
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x1b438(%rip), %rsi     # 0x6a557
callq 0x4480
cmpl $0x0, %eax
je 0x4f143
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x2247b(%rip), %rsi     # 0x715b4
callq 0x4480
cmpl $0x0, %eax
jne 0x4f148
jmp 0x4f2c1
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x20979(%rip), %rsi     # 0x6fad1
leaq 0x78(%rsp), %rdx
leaq 0x74(%rsp), %rcx
leaq 0x70(%rsp), %r8
leaq 0x6c(%rsp), %r9
movb $0x0, %al
callq 0x4300
movl %eax, 0x80(%rsp)
cmpl $0x1, 0x80(%rsp)
jne 0x4f19b
movss 0x78(%rsp), %xmm0
movss %xmm0, 0x70(%rsp)
movss %xmm0, 0x74(%rsp)
jmp 0x4f25e
cmpl $0x4, 0x80(%rsp)
jne 0x4f235
movss 0x6c(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x1fa2d(%rip), %xmm0    # 0x6ebe8
divsd %xmm0, %xmm1
movss 0x78(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x78(%rsp)
movss 0x6c(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x1f9ff(%rip), %xmm0    # 0x6ebe8
divsd %xmm0, %xmm1
movss 0x74(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x74(%rsp)
movss 0x6c(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x1f9d1(%rip), %xmm0    # 0x6ebe8
divsd %xmm0, %xmm1
movss 0x70(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x70(%rsp)
jmp 0x4f25c
cmpl $0x3, 0x80(%rsp)
je 0x4f25a
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x20136(%rip), %rdi     # 0x6f385
xorl %eax, %eax
callq 0xb9f0
jmp 0x4f258
jmp 0x4f2c1
jmp 0x4f25c
jmp 0x4f25e
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x20(%rsp), %rdi
callq 0x4440
jmp 0x4f273
movss 0x78(%rsp), %xmm0
movss %xmm0, 0x40(%rsp)
movss 0x74(%rsp), %xmm0
movss %xmm0, 0x44(%rsp)
movss 0x70(%rsp), %xmm0
movss %xmm0, 0x48(%rsp)
leaq 0x200a6(%rip), %rax     # 0x6f344
movq %rax, 0x50(%rsp)
leaq 0x55208d6(%rip), %rdi   # 0x556fb80
leaq 0x20(%rsp), %rsi
callq 0x5b710
jmp 0x4f2b6
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x58(%rsp)
jmp 0x4f103
jmp 0x4f2d5
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x4f064
leaq 0x20(%rsp), %rdi
callq 0x5b780
addq $0x88, %rsp
retq
movq 0x18(%rsp), %rdi
callq 0x45c0
nopw (%rax,%rax)