// File: FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: AddTransparencyToDataList(float const*)
static unsigned AddTransparencyToDataList(const vec3_t trans)
{
	//Check if this value is in list already
#ifdef ZHLT_64BIT_FIX
	for(unsigned int i = 0; i < s_trans_count; i++)
#else
	for(int i = 0; i < s_trans_count; i++)
#endif
	{
		if( VectorCompare( trans, s_trans_list[i] ) )
		{
			return i;
		}
	}
	
	//realloc if needed
	while( s_trans_count >= s_max_trans_count )
	{
		unsigned int old_max_count = s_max_trans_count;
#ifdef HLRAD_TRANSPARENCY_FAST
		s_max_trans_count = qmax (64u, (unsigned int)((double)s_max_trans_count * 1.41));
#else
		s_max_trans_count += TRANS_LIST_GROWTH;
#endif
#ifdef ZHLT_64BIT_FIX
		if (s_max_trans_count >= (unsigned int)INT_MAX)
		{
			Error ("AddTransparencyToDataList: array size exceeded INT_MAX");
		}
#endif
		
		s_trans_list = (vec3_t *)realloc( s_trans_list, sizeof(vec3_t) * s_max_trans_count );
#ifdef HLRAD_HLASSUMENOMEMORY
		hlassume (s_trans_list != NULL, assume_NoMemory);
#endif
		
#ifdef HLRAD_TRANSPARENCY_FAST
		memset( &s_trans_list[old_max_count], 0, sizeof(vec3_t) * (s_max_trans_count - old_max_count) );
#else
		memset( &s_trans_list[old_max_count], 0, sizeof(vec3_t) * TRANS_LIST_GROWTH );
#endif
		
		if( old_max_count == 0 )
		{
			VectorFill(s_trans_list[0], 1.0);
			s_trans_count++;
		}
	}
	
	VectorCopy(trans, s_trans_list[s_trans_count]);
	
	return ( s_trans_count++ );
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x66c9e19(%rip), %eax   # 0x672fb34
jae 0x65d5b
movq 0x18(%rsp), %rdi
movq 0x66c9e0f(%rip), %rsi   # 0x672fb38
movl 0x14(%rsp), %eax
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x440c0
testb $0x1, %al
jne 0x65d3f
jmp 0x65d4c
movl 0x14(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x65f22
jmp 0x65d4e
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x65d11
jmp 0x65d5d
movl 0x66c9dd1(%rip), %eax   # 0x672fb34
cmpl 0x66c9dc7(%rip), %eax   # 0x672fb30
jb 0x65ea6
movl 0x66c9dbb(%rip), %eax   # 0x672fb30
movl %eax, 0x10(%rsp)
movl 0x66c9db1(%rip), %eax   # 0x672fb30
cvtsi2sd %rax, %xmm0
movsd 0xc064(%rip), %xmm1     # 0x71df0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %ecx
movl $0x40, %eax
cmpl %ecx, %eax
jbe 0x65dab
movl $0x40, %eax
movl %eax, 0xc(%rsp)
jmp 0x65dcb
movl 0x66c9d7f(%rip), %eax   # 0x672fb30
cvtsi2sd %rax, %xmm0
movsd 0xc032(%rip), %xmm1     # 0x71df0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x66c9d5b(%rip)   # 0x672fb30
cmpl $0x7fffffff, 0x66c9d51(%rip) # imm = 0x7FFFFFFF
jb 0x65def
leaq 0xc0ee(%rip), %rdi      # 0x71ed6
movb $0x0, %al
callq 0xb580
movq 0x66c9d42(%rip), %rdi   # 0x672fb38
movl 0x66c9d34(%rip), %eax   # 0x672fb30
imulq $0xc, %rax, %rsi
callq 0x4590
movq %rax, 0x66c9d2c(%rip)   # 0x672fb38
cmpq $0x0, 0x66c9d24(%rip)   # 0x672fb38
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movq 0x66c9d0a(%rip), %rdi   # 0x672fb38
movl 0x10(%rsp), %eax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movl 0x66c9cf1(%rip), %eax   # 0x672fb30
subl 0x10(%rsp), %eax
movl %eax, %eax
imulq $0xc, %rax, %rdx
xorl %esi, %esi
callq 0x41b0
cmpl $0x0, 0x10(%rsp)
jne 0x65ea1
movq 0x66c9cda(%rip), %rax   # 0x672fb38
movss 0x41e6(%rip), %xmm0     # 0x6a04c
movss %xmm0, (%rax)
movq 0x66c9cc7(%rip), %rax   # 0x672fb38
movss 0x41d3(%rip), %xmm0     # 0x6a04c
movss %xmm0, 0x4(%rax)
movq 0x66c9cb3(%rip), %rax   # 0x672fb38
movss 0x41bf(%rip), %xmm0     # 0x6a04c
movss %xmm0, 0x8(%rax)
movl 0x66c9c9c(%rip), %eax   # 0x672fb34
addl $0x1, %eax
movl %eax, 0x66c9c93(%rip)   # 0x672fb34
jmp 0x65d5d
movq 0x18(%rsp), %rax
movss (%rax), %xmm0
movq 0x66c9c82(%rip), %rax   # 0x672fb38
movl 0x66c9c78(%rip), %ecx   # 0x672fb34
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq 0x18(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x66c9c60(%rip), %rax   # 0x672fb38
movl 0x66c9c56(%rip), %ecx   # 0x672fb34
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movq 0x18(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x66c9c3d(%rip), %rax   # 0x672fb38
movl 0x66c9c33(%rip), %ecx   # 0x672fb34
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
movl 0x66c9c21(%rip), %eax   # 0x672fb34
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x66c9c16(%rip)   # 0x672fb34
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)