// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %ebx
callq 0xb321
movl 0x66c5a82(%rip), %r12d  # 0x66f9b14
testq %r12, %r12
movl %ebx, 0x4(%rsp)
je 0x3410e
movq 0x66c5a76(%rip), %rax   # 0x66f9b18
movss (%r14), %xmm0
leaq 0x4(%rax), %rdx
xorl %ecx, %ecx
movaps 0x628c(%rip), %xmm1     # 0x3a340
movsd 0x69ec(%rip), %xmm2     # 0x3aaa8
leaq (%rcx,%rcx,2), %rsi
movaps %xmm0, %xmm3
subss (%rax,%rsi,4), %xmm3
andps %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
ucomisd %xmm2, %xmm3
ja 0x34102
xorl %esi, %esi
cmpq $0x2, %rsi
je 0x34128
movss 0x4(%r14,%rsi,4), %xmm3
subss (%rdx,%rsi,4), %xmm3
andps %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
incq %rsi
ucomisd %xmm2, %xmm3
jbe 0x340d7
decq %rsi
cmpq $0x1, %rsi
ja 0x34128
incq %rcx
addq $0xc, %rdx
cmpq %r12, %rcx
jne 0x340bc
movl %ebp, (%rsp)
movl 0x66c59f9(%rip), %ebp   # 0x66f9b10
cmpl %ebp, %r12d
jae 0x34130
movq 0x66c59f5(%rip), %rbx   # 0x66f9b18
jmp 0x34206
movl %ecx, %r12d
jmp 0x3423d
leaq 0xadaf(%rip), %r15      # 0x3eee6
movl %ebp, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
mulsd 0xacb6(%rip), %xmm0     # 0x3ee00
cvttsd2si %xmm0, %rcx
cmpl $0x41, %ecx
movl $0x40, %eax
cmovael %ecx, %eax
movl %eax, 0x66c59b0(%rip)   # 0x66f9b10
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jb 0x34178
movq %r15, %rdi
xorl %eax, %eax
callq 0x9f34
movl 0x66c5998(%rip), %eax   # 0x66f9b10
movq 0x66c5999(%rip), %rdi   # 0x66f9b18
movl %eax, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rsi
callq 0x4560
movq %rax, 0x66c5983(%rip)   # 0x66f9b18
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa6ed
movq 0x66c5969(%rip), %rbx   # 0x66f9b18
leaq (%r12,%r12,2), %rax
leaq (%rbx,%rax,4), %rdi
movl 0x66c5952(%rip), %r13d  # 0x66f9b10
movl %r13d, %eax
subl %ebp, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x4190
movl 0x66c593b(%rip), %r12d  # 0x66f9b14
testl %ebp, %ebp
jne 0x341fa
movsd 0x792b(%rip), %xmm0     # 0x3bb10
movsd %xmm0, (%rbx)
movl $0x3f800000, 0x8(%rbx)  # imm = 0x3F800000
incl %r12d
movl %r12d, 0x66c591a(%rip)  # 0x66f9b14
movl %r13d, %ebp
cmpl %r13d, %r12d
jae 0x34137
movss (%r14), %xmm0
movl %r12d, %eax
leaq (%rax,%rax,2), %rax
movss %xmm0, (%rbx,%rax,4)
movss 0x4(%r14), %xmm0
movss %xmm0, 0x4(%rbx,%rax,4)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%rbx,%rax,4)
leal 0x1(%r12), %eax
movl %eax, 0x66c58da(%rip)   # 0x66f9b14
movl (%rsp), %ebp
movl 0x66c58ad(%rip), %eax   # 0x66f9af0
movl 0x66c58aa(%rip), %r15d  # 0x66f9af4
cmpl %r15d, %eax
jae 0x3425b
movq 0x66c58a2(%rip), %r13   # 0x66f9af8
jmp 0x34314
leaq 0xabba(%rip), %r14      # 0x3ee1c
movl %r15d, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
mulsd 0xab8b(%rip), %xmm0     # 0x3ee00
cvttsd2si %xmm0, %rcx
cmpl $0x41, %ecx
movl $0x40, %eax
cmovael %ecx, %eax
movl %eax, 0x66c5869(%rip)   # 0x66f9af4
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jb 0x342a3
movq %r14, %rdi
xorl %eax, %eax
callq 0x9f34
movl 0x66c5851(%rip), %eax   # 0x66f9af4
movq 0x66c584e(%rip), %rdi   # 0x66f9af8
movl %eax, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rsi
callq 0x4560
movq %rax, 0x66c5838(%rip)   # 0x66f9af8
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa6ed
movq 0x66c581e(%rip), %r13   # 0x66f9af8
leaq (%rbx,%rbx,2), %rax
leaq (,%rax,4), %rdi
addq %r13, %rdi
movl 0x66c5805(%rip), %ebx   # 0x66f9af4
movl %ebx, %eax
subl %r15d, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x4190
movl 0x66c57e7(%rip), %eax   # 0x66f9af0
movl %ebx, %r15d
cmpl %ebx, %eax
jae 0x34262
movl %eax, %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0x4(%rsp), %edx
movl %edx, (%r13,%rcx,4)
movl %ebp, 0x4(%r13,%rcx,4)
movl %r12d, 0x8(%r13,%rcx,4)
incl %eax
movl %eax, 0x66c57bb(%rip)   # 0x66f9af0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb332