// File: FreeSlave[P]vhlt/hlrad/qrad.cpp
// Function: ReadTranslucentTextures()
void ReadTranslucentTextures()
{
	int num;
	int i, k;
	entity_t *mapent;
	epair_t *ep;

	num = ((dmiptexlump_t *)g_dtexdata)->nummiptex;
	g_translucenttextures = (vec3_t *)malloc (num * sizeof(vec3_t));
	for (i = 0; i < num; i++)
	{
		VectorClear (g_translucenttextures[i]);
	}
	for (k = 0; k < g_numentities; k++)
	{
		mapent = &g_entities[k];
		if (strcmp(ValueForKey(mapent, "classname"), "info_translucent"))
			continue;
		Developer (DEVELOPER_LEVEL_MESSAGE, "info_translucent 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 r, g, b;
				int count;
				count = sscanf (ep->value, "%lf %lf %lf", &r, &g, &b);
				if (count == 1)
				{
					g = b = r;
				}
				else if (count != 3)
				{
					Warning ("ignore bad translucent value '%s'", ep->value);
					continue;
				}
				if (r < 0.0 || r > 1.0 || g < 0.0 || g > 1.0 || b < 0.0 || b > 1.0)
				{
					Warning ("translucent value should be 0.0-1.0");
					continue;
				}
				g_translucenttextures[i][0] = r;
				g_translucenttextures[i][1] = g;
				g_translucenttextures[i][2] = b;
				Developer (DEVELOPER_LEVEL_MESSAGE, "info_translucent: %s = %f %f %f\n", texname, r, g, b);
			}
		}
	}
}

// Assembly:
subq $0x48, %rsp
leaq 0x837abd(%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, 0x54e1177(%rip)   # 0x552fb80
movl $0x0, 0x40(%rsp)
movl 0x40(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x4ea78
movq 0x54e115e(%rip), %rax   # 0x552fb80
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movq 0x54e1143(%rip), %rax   # 0x552fb80
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x4(%rax)
movq 0x54e1128(%rip), %rax   # 0x552fb80
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, (%rax)
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x4ea11
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
leaq 0x20259a9(%rip), %rcx   # 0x2074434
cmpl (%rcx), %eax
jge 0x4ed19
movslq 0x3c(%rsp), %rcx
leaq 0x20259a1(%rip), %rax   # 0x2074440
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x1baa0(%rip), %rsi     # 0x6a557
callq 0x7d50
movq %rax, %rdi
leaq 0x20744(%rip), %rsi     # 0x6f20a
callq 0x4480
cmpl $0x0, %eax
je 0x4ead5
jmp 0x4ed09
movl $0x3, %edi
leaq 0x2073a(%rip), %rsi     # 0x6f21b
movb $0x0, %al
callq 0xbbf0
movl $0x0, 0x40(%rsp)
movl 0x40(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x4ed07
leaq 0x8379a3(%rip), %rax    # 0x8864a8
movq (%rax), %rax
leaq 0x837999(%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 0x4ecf5
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x4350
cmpl $0x0, %eax
je 0x4eb5b
jmp 0x4ece3
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x22a49(%rip), %rsi     # 0x715b4
callq 0x4350
cmpl $0x0, %eax
jne 0x4eb7a
jmp 0x4ece3
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x1f436(%rip), %rsi     # 0x6dfc0
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movb $0x0, %al
callq 0x4300
movl %eax, 0x4(%rsp)
cmpl $0x1, 0x4(%rsp)
jne 0x4ebbf
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
jmp 0x4ebe4
cmpl $0x3, 0x4(%rsp)
je 0x4ebe2
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rsi
leaq 0x20668(%rip), %rdi     # 0x6f23e
movb $0x0, %al
callq 0xb9f0
jmp 0x4ece3
jmp 0x4ebe4
xorps %xmm0, %xmm0
ucomisd 0x18(%rsp), %xmm0
ja 0x4ec41
movsd 0x18(%rsp), %xmm0
movsd 0x1e5eb(%rip), %xmm1    # 0x6d1e8
ucomisd %xmm1, %xmm0
ja 0x4ec41
xorps %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
ja 0x4ec41
movsd 0x10(%rsp), %xmm0
movsd 0x1e5cc(%rip), %xmm1    # 0x6d1e8
ucomisd %xmm1, %xmm0
ja 0x4ec41
xorps %xmm0, %xmm0
ucomisd 0x8(%rsp), %xmm0
ja 0x4ec41
movsd 0x8(%rsp), %xmm0
movsd 0x1e5ad(%rip), %xmm1    # 0x6d1e8
ucomisd %xmm1, %xmm0
jbe 0x4ec54
leaq 0x20618(%rip), %rdi     # 0x6f260
movb $0x0, %al
callq 0xb9f0
jmp 0x4ece3
movsd 0x18(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x54e0f1b(%rip), %rax   # 0x552fb80
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movsd 0x10(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x54e0efa(%rip), %rax   # 0x552fb80
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x54e0ed8(%rip), %rax   # 0x552fb80
movslq 0x40(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
movq 0x20(%rsp), %rdx
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movl $0x3, %edi
leaq 0x205a8(%rip), %rsi     # 0x6f284
movb $0x3, %al
callq 0xbbf0
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x4eb32
jmp 0x4ecf7
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x4eaf0
jmp 0x4ed09
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x4ea80
addq $0x48, %rsp
retq
nop