// File: FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: AddTransparencyToRawArray(unsigned int, unsigned int, float const*)
void	AddTransparencyToRawArray(const unsigned p1, const unsigned p2, const vec3_t trans)
{
	//make thread safe
	ThreadLock();
	
	unsigned data_index = AddTransparencyToDataList(trans);
	
	//realloc if needed
	while( s_raw_count >= s_max_raw_count )
	{
		unsigned int old_max_count = s_max_raw_count;
#ifdef HLRAD_TRANSPARENCY_FAST
		s_max_raw_count = qmax (64u, (unsigned int)((double)s_max_raw_count * 1.41));
#else
		s_max_raw_count += RAW_LIST_GROWTH;
#endif
#ifdef ZHLT_64BIT_FIX
		if (s_max_raw_count >= (unsigned int)INT_MAX)
		{
			Error ("AddTransparencyToRawArray: array size exceeded INT_MAX");
		}
#endif
		
		s_raw_list = (transList_t *)realloc( s_raw_list, sizeof(transList_t) * s_max_raw_count );
#ifdef HLRAD_HLASSUMENOMEMORY
		hlassume (s_raw_list != NULL, assume_NoMemory);
#endif
		
#ifdef HLRAD_TRANSPARENCY_FAST
		memset( &s_raw_list[old_max_count], 0, sizeof(transList_t) * (s_max_raw_count - old_max_count) );
#else
		memset( &s_raw_list[old_max_count], 0, sizeof(transList_t) * RAW_LIST_GROWTH );
#endif
	}
	
	s_raw_list[s_raw_count].p1 = p1;
	s_raw_list[s_raw_count].p2 = p2;
	s_raw_list[s_raw_count].data_index = data_index;
	
	s_raw_count++;
	
	//unlock list
	ThreadUnlock();
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movl %esi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
callq 0xd220
movq 0x18(%rsp), %rdi
callq 0x65d00
movl %eax, 0x14(%rsp)
movl 0x66c9f76(%rip), %eax   # 0x672fb10
cmpl 0x66c9f74(%rip), %eax   # 0x672fb14
jb 0x65c8c
movl 0x66c9f68(%rip), %eax   # 0x672fb14
movl %eax, 0x10(%rsp)
movl 0x66c9f5e(%rip), %eax   # 0x672fb14
cvtsi2sd %rax, %xmm0
movsd 0xc22d(%rip), %xmm1     # 0x71df0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %ecx
movl $0x40, %eax
cmpl %ecx, %eax
jbe 0x65be2
movl $0x40, %eax
movl %eax, 0xc(%rsp)
jmp 0x65c02
movl 0x66c9f2c(%rip), %eax   # 0x672fb14
cvtsi2sd %rax, %xmm0
movsd 0xc1fb(%rip), %xmm1     # 0x71df0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x66c9f08(%rip)   # 0x672fb14
cmpl $0x7fffffff, 0x66c9efe(%rip) # imm = 0x7FFFFFFF
jb 0x65c26
leaq 0xc1ed(%rip), %rdi      # 0x71e0c
movb $0x0, %al
callq 0xb580
movq 0x66c9eeb(%rip), %rdi   # 0x672fb18
movl 0x66c9ee1(%rip), %eax   # 0x672fb14
imulq $0xc, %rax, %rsi
callq 0x4590
movq %rax, 0x66c9ed5(%rip)   # 0x672fb18
cmpq $0x0, 0x66c9ecd(%rip)   # 0x672fb18
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movq 0x66c9eb3(%rip), %rdi   # 0x672fb18
movl 0x10(%rsp), %eax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movl 0x66c9e9e(%rip), %eax   # 0x672fb14
subl 0x10(%rsp), %eax
movl %eax, %eax
imulq $0xc, %rax, %rdx
xorl %esi, %esi
callq 0x41b0
jmp 0x65b94
movl 0x24(%rsp), %ecx
movq 0x66c9e81(%rip), %rax   # 0x672fb18
movl 0x66c9e73(%rip), %edx   # 0x672fb10
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl 0x20(%rsp), %ecx
movq 0x66c9e67(%rip), %rax   # 0x672fb18
movl 0x66c9e59(%rip), %edx   # 0x672fb10
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl 0x14(%rsp), %ecx
movq 0x66c9e4c(%rip), %rax   # 0x672fb18
movl 0x66c9e3e(%rip), %edx   # 0x672fb10
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl 0x66c9e2e(%rip), %eax   # 0x672fb10
addl $0x1, %eax
movl %eax, 0x66c9e25(%rip)   # 0x672fb10
callq 0xd240
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)