// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x829229(%rip), %rax    # 0x851498
movq (%rax), %rax
movslq (%rax), %r14
leaq (,%r14,4), %rax
leaq (%rax,%rax,2), %rbx
movq %rbx, %rdi
callq 0x4410
movq %rax, 0x54d28d0(%rip)   # 0x54fab60
movq %r14, 0x20(%rsp)
testq %r14, %r14
jle 0x282c7
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x54d28bb(%rip), %rdx   # 0x54fab60
movl %eax, 0x8(%rdx,%rcx)
movq 0x54d28b0(%rip), %rdx   # 0x54fab60
movl %eax, 0x4(%rdx,%rcx)
movq 0x54d28a5(%rip), %rdx   # 0x54fab60
movl %eax, (%rdx,%rcx)
addq $0xc, %rcx
cmpq %rcx, %rbx
jne 0x2829e
leaq 0x2017156(%rip), %rax   # 0x203f424
cmpl $0x0, (%rax)
jle 0x284ed
leaq 0x17352(%rip), %r12     # 0x3f630
xorl %ecx, %ecx
movq %rcx, 0x28(%rsp)
movq %rcx, %rdi
shlq $0x5, %rdi
addq 0x1fcd5(%rip), %rdi     # 0x47fc8
movq %rdi, 0x30(%rsp)
leaq 0x1030c(%rip), %rsi     # 0x3860b
callq 0x7571
movq %rax, %rdi
leaq 0x14f78(%rip), %rsi     # 0x3d286
callq 0x4440
testl %eax, %eax
jne 0x284d2
movl $0x3, %edi
leaq 0x14f70(%rip), %rsi     # 0x3d297
xorl %eax, %eax
callq 0xa52e
cmpl $0x0, 0x20(%rsp)
jle 0x284d2
xorl %ebp, %ebp
movq 0x30(%rsp), %rax
movq 0x18(%rax), %r15
testq %r15, %r15
je 0x284c4
leaq 0x829144(%rip), %rax    # 0x851498
movq (%rax), %rax
movslq 0x4(%rax,%rbp,4), %r14
addq %rax, %r14
leaq (,%rbp,4), %rax
leaq (%rax,%rax,2), %rbx
movq 0x8(%r15), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x4320
testl %eax, %eax
je 0x2838b
movq (%r15), %r15
testq %r15, %r15
jne 0x2836b
jmp 0x284c4
movq %r13, %rdi
movq %r12, %rsi
callq 0x4320
testl %eax, %eax
je 0x2837e
movq 0x10(%r15), %rdi
leaq 0x13c57(%rip), %rsi     # 0x3bffc
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
xorl %eax, %eax
callq 0x42d0
cmpl $0x3, %eax
je 0x283db
cmpl $0x1, %eax
jne 0x284ad
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x2849a
ucomisd 0x12d71(%rip), %xmm0    # 0x3b168
ja 0x2849a
movsd 0x10(%rsp), %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm1, %xmm2
ja 0x2849a
ucomisd 0x12d4f(%rip), %xmm1    # 0x3b168
ja 0x2849a
movsd 0x8(%rsp), %xmm1
ucomisd %xmm1, %xmm2
ja 0x2849a
ucomisd 0x12d39(%rip), %xmm1    # 0x3b168
ja 0x2849a
cvtsd2ss %xmm0, %xmm0
movq 0x54d2724(%rip), %rax   # 0x54fab60
movss %xmm0, (%rax,%rbx)
xorps %xmm0, %xmm0
cvtsd2ss 0x10(%rsp), %xmm0
movq 0x54d270f(%rip), %rax   # 0x54fab60
movss %xmm0, 0x4(%rax,%rbx)
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movq 0x54d26f9(%rip), %rax   # 0x54fab60
movss %xmm0, 0x8(%rax,%rbx)
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movl $0x3, %edi
leaq 0x14e75(%rip), %rsi     # 0x3d300
movq %r14, %rdx
movb $0x3, %al
callq 0xa52e
jmp 0x2837e
leaq 0x14e3b(%rip), %rdi     # 0x3d2dc
xorl %eax, %eax
callq 0xa38e
jmp 0x2837e
movq 0x10(%r15), %rsi
leaq 0x14e02(%rip), %rdi     # 0x3d2ba
xorl %eax, %eax
callq 0xa38e
jmp 0x2837e
incq %rbp
cmpq 0x20(%rsp), %rbp
jne 0x2833b
movq 0x28(%rsp), %rcx
incq %rcx
leaq 0x2016f43(%rip), %rax   # 0x203f424
movslq (%rax), %rax
cmpq %rax, %rcx
jl 0x282e0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq