// File: /workspace/github_cpp_makefile_star2_O1/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, 0x4(%rsp)
movl %edi, %ebp
callq 0xb411
movl 0x66c59a1(%rip), %eax   # 0x66fab14
testq %rax, %rax
je 0x3520a
movq 0x66c5995(%rip), %rcx   # 0x66fab18
movss (%r14), %xmm0
leaq 0x4(%rcx), %rdx
movb $0x1, %sil
xorl %r15d, %r15d
movaps 0x61a7(%rip), %xmm1     # 0x3b340
movsd 0x6957(%rip), %xmm2     # 0x3baf8
leaq (%r15,%r15,2), %rdi
movaps %xmm0, %xmm3
subss (%rcx,%rdi,4), %xmm3
andps %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
ucomisd %xmm2, %xmm3
ja 0x351ee
xorl %edi, %edi
cmpq $0x2, %rdi
je 0x351e3
movss 0x4(%r14,%rdi,4), %xmm3
subss (%rdx,%rdi,4), %xmm3
andps %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
incq %rdi
ucomisd %xmm2, %xmm3
jbe 0x351bc
decq %rdi
jmp 0x351e8
movl $0x2, %edi
cmpq $0x1, %rdi
ja 0x35200
incq %r15
addq $0xc, %rdx
cmpq %rax, %r15
setb %sil
jne 0x351a1
jmp 0x3520a
testb $0x1, %sil
jne 0x3532c
movl 0x66c58ff(%rip), %r12d  # 0x66fab10
cmpl %r12d, %eax
jb 0x352f1
leaq 0xad45(%rip), %r15      # 0x3ff66
movl %r12d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
mulsd 0xac4c(%rip), %xmm0     # 0x3fe80
cvttsd2si %xmm0, %rax
cmpl $0x41, %eax
movl $0x40, %ecx
cmovael %eax, %ecx
movl %ecx, 0x66c58c6(%rip)   # 0x66fab10
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jb 0x3525b
movq %r15, %rdi
xorl %eax, %eax
callq 0xa01c
movq 0x66c58b6(%rip), %rdi   # 0x66fab18
movl 0x66c58a8(%rip), %eax   # 0x66fab10
shlq $0x2, %rax
leaq (%rax,%rax,2), %rsi
callq 0x4570
movq %rax, 0x66c589c(%rip)   # 0x66fab18
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa7c9
movq 0x66c5882(%rip), %rbx   # 0x66fab18
leaq (,%r13,2), %rax
addq %r13, %rax
leaq (%rbx,%rax,4), %rdi
movl 0x66c5864(%rip), %r13d  # 0x66fab10
movl %r13d, %eax
subl %r12d, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x4190
testl %r12d, %r12d
jne 0x352df
movsd 0x7902(%rip), %xmm0     # 0x3cbd0
movsd %xmm0, (%rbx)
movl $0x3f800000, 0x8(%rbx)  # imm = 0x3F800000
incl 0x66c5835(%rip)         # 0x66fab14
movl 0x66c582f(%rip), %eax   # 0x66fab14
movl %r13d, %r12d
cmpl %r13d, %eax
jae 0x35221
movss (%r14), %xmm0
movq 0x66c581b(%rip), %rcx   # 0x66fab18
movl %eax, %edx
leaq (%rdx,%rdx,2), %rdx
movss %xmm0, (%rcx,%rdx,4)
movss 0x4(%r14), %xmm0
movss %xmm0, 0x4(%rcx,%rdx,4)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%rcx,%rdx,4)
leal 0x1(%rax), %ecx
movl %ecx, 0x66c57eb(%rip)   # 0x66fab14
movl %eax, %r15d
movl 0x66c57be(%rip), %eax   # 0x66faaf0
movl 0x66c57bb(%rip), %r12d  # 0x66faaf4
cmpl %r12d, %eax
jb 0x353f8
leaq 0xab53(%rip), %r14      # 0x3fe9c
movl %r12d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
mulsd 0xab24(%rip), %xmm0     # 0x3fe80
cvttsd2si %xmm0, %rax
cmpl $0x41, %eax
movl $0x40, %ecx
cmovael %eax, %ecx
movl %ecx, 0x66c5782(%rip)   # 0x66faaf4
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jb 0x35383
movq %r14, %rdi
xorl %eax, %eax
callq 0xa01c
movq 0x66c576e(%rip), %rdi   # 0x66faaf8
movl 0x66c5764(%rip), %eax   # 0x66faaf4
shlq $0x2, %rax
leaq (%rax,%rax,2), %rsi
callq 0x4570
movq %rax, 0x66c5754(%rip)   # 0x66faaf8
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa7c9
leaq (,%r13,2), %rdi
addq %r13, %rdi
shlq $0x2, %rdi
addq 0x66c572b(%rip), %rdi   # 0x66faaf8
movl 0x66c5721(%rip), %ebx   # 0x66faaf4
movl %ebx, %eax
subl %r12d, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x4190
movl 0x66c5703(%rip), %eax   # 0x66faaf0
movl %ebx, %r12d
cmpl %ebx, %eax
jae 0x35349
movq 0x66c56f9(%rip), %rcx   # 0x66faaf8
movl %eax, %edx
leaq (%rdx,%rdx,2), %rdx
movl %ebp, (%rcx,%rdx,4)
movl 0x4(%rsp), %esi
movl %esi, 0x4(%rcx,%rdx,4)
movl %r15d, 0x8(%rcx,%rdx,4)
incl %eax
movl %eax, 0x66c56d3(%rip)   # 0x66faaf0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb422