// File: /workspace/github_cpp_makefile_star2_O2/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, (%rsp)
callq 0x9e0c
xorl %r15d, %r15d
xorl %r12d, %r12d
pushq $0x40
popq %r13
movl 0x66c6eee(%rip), %ebx   # 0x66f6b24
cmpq %rbx, %r12
jae 0x2fc5e
movq 0x66c6ee6(%rip), %rsi   # 0x66f6b28
addq %r15, %rsi
movq %r14, %rdi
callq 0x1e86c
testb %al, %al
jne 0x2fd6d
incq %r12
addq $0xc, %r15
jmp 0x2fc30
movl 0x66c6ebb(%rip), %r12d  # 0x66f6b20
cmpl %r12d, %ebx
jb 0x2fd33
movl %r12d, %ebx
cvtsi2sd %rbx, %xmm0
mulsd 0xa0ca(%rip), %xmm0     # 0x39d48
cvttsd2si %xmm0, %rcx
cmpl $0x41, %ecx
movl %r13d, %eax
cmovael %ecx, %eax
movl %eax, 0x66c6e8e(%rip)   # 0x66f6b20
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jb 0x2fcae
leaq 0xa18d(%rip), %rdi      # 0x39e2e
xorl %eax, %eax
callq 0x8b2f
movl 0x66c6e72(%rip), %eax   # 0x66f6b20
movq 0x66c6e73(%rip), %rdi   # 0x66f6b28
movl %eax, %eax
imulq $0xc, %rax, %rsi
callq 0x4580
movq %rax, 0x66c6e61(%rip)   # 0x66f6b28
xorl %edi, %edi
testq %rax, %rax
setne %dil
pushq $0x1
popq %rsi
callq 0x92cb
movq 0x66c6e49(%rip), %r15   # 0x66f6b28
imulq $0xc, %rbx, %rdi
addq %r15, %rdi
movl 0x66c6e34(%rip), %ebp   # 0x66f6b20
movl %ebp, %eax
subl %r12d, %eax
imulq $0xc, %rax, %rdx
xorl %esi, %esi
callq 0x41a0
movl 0x66c6e22(%rip), %ebx   # 0x66f6b24
testl %r12d, %r12d
movl %ebp, %r12d
jne 0x2fc65
movsd 0x6dba(%rip), %xmm0     # 0x36ad0
movsd %xmm0, (%r15)
movl $0x3f800000, 0x8(%r15)  # imm = 0x3F800000
incl %ebx
movl %ebx, 0x66c6df9(%rip)   # 0x66f6b24
movl %ebp, %r12d
jmp 0x2fc65
movss (%r14), %xmm0
movq 0x66c6de9(%rip), %rax   # 0x66f6b28
movl %ebx, %ecx
imulq $0xc, %rcx, %rcx
movss %xmm0, (%rax,%rcx)
movss 0x4(%r14), %xmm0
movss %xmm0, 0x4(%rax,%rcx)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%rax,%rcx)
leal 0x1(%rbx), %eax
movl %eax, 0x66c6db9(%rip)   # 0x66f6b24
jmp 0x2fd70
movl %r12d, %ebx
movl 0x66c6d8e(%rip), %ebp   # 0x66f6b04
leaq 0x9fe7(%rip), %r14      # 0x39d64
pushq $0x1
popq %r15
movl 0x66c6d79(%rip), %eax   # 0x66f6b00
cmpl %ebp, %eax
jb 0x2fe1f
movl %ebp, %r12d
cvtsi2sd %r12, %xmm0
mulsd 0x9fa9(%rip), %xmm0     # 0x39d48
cvttsd2si %xmm0, %rcx
cmpl $0x41, %ecx
movl %r13d, %eax
cmovael %ecx, %eax
movl %eax, 0x66c6d51(%rip)   # 0x66f6b04
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jb 0x2fdcb
movq %r14, %rdi
xorl %eax, %eax
callq 0x8b2f
movl 0x66c6d39(%rip), %eax   # 0x66f6b04
movq 0x66c6d36(%rip), %rdi   # 0x66f6b08
movl %eax, %eax
imulq $0xc, %rax, %rsi
callq 0x4580
movq %rax, 0x66c6d24(%rip)   # 0x66f6b08
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl %r15d, %esi
callq 0x92cb
imulq $0xc, %r12, %rdi
addq 0x66c6d08(%rip), %rdi   # 0x66f6b08
movl 0x66c6cfd(%rip), %r12d  # 0x66f6b04
movl %r12d, %eax
subl %ebp, %eax
imulq $0xc, %rax, %rdx
xorl %esi, %esi
callq 0x41a0
movl %r12d, %ebp
jmp 0x2fd81
movq 0x66c6ce2(%rip), %rcx   # 0x66f6b08
imulq $0xc, %rax, %rdx
movl (%rsp), %esi
movl %esi, (%rcx,%rdx)
movl 0x4(%rsp), %esi
movl %esi, 0x4(%rcx,%rdx)
movl %ebx, 0x8(%rcx,%rdx)
incl %eax
movl %eax, 0x66c6cbc(%rip)   # 0x66f6b00
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9e1d