// File: FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: AddStyleToStyleArray(unsigned int, unsigned int, int)
void	AddStyleToStyleArray(const unsigned p1, const unsigned p2, const int style)
{
	if (style == -1)
		return;
	//make thread safe
	ThreadLock();
	
	//realloc if needed
	while( s_style_count >= s_max_style_count )
	{
		unsigned int old_max_count = s_max_style_count;
#ifdef HLRAD_TRANSPARENCY_FAST
		s_max_style_count = qmax (64u, (unsigned int)((double)s_max_style_count * 1.41));
#else
		s_max_style_count += STYLE_LIST_GROWTH;
#endif
#ifdef ZHLT_64BIT_FIX
		if (s_max_style_count >= (unsigned int)INT_MAX)
		{
			Error ("AddStyleToStyleArray: array size exceeded INT_MAX");
		}
#endif
		
		s_style_list = (styleList_t *)realloc( s_style_list, sizeof(styleList_t) * s_max_style_count );
#ifdef HLRAD_HLASSUMENOMEMORY
		hlassume (s_style_list != NULL, assume_NoMemory);
#endif
		
#ifdef HLRAD_TRANSPARENCY_FAST
		memset( &s_style_list[old_max_count], 0, sizeof(styleList_t) * (s_max_style_count - old_max_count) );
#else
		memset( &s_style_list[old_max_count], 0, sizeof(styleList_t) * STYLE_LIST_GROWTH );
#endif
	}
	
	s_style_list[s_style_count].p1 = p1;
	s_style_list[s_style_count].p2 = p2;
	s_style_list[s_style_count].style = (char)style;
	
	s_style_count++;
	
	//unlock list
	ThreadUnlock();
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x14(%rsp)
movl %esi, 0x10(%rsp)
movl %edx, 0xc(%rsp)
cmpl $-0x1, 0xc(%rsp)
jne 0x6648c
jmp 0x665ef
callq 0xd220
movl 0x66c96a9(%rip), %eax   # 0x672fb40
cmpl 0x66c96a7(%rip), %eax   # 0x672fb44
jb 0x66589
movl 0x66c969b(%rip), %eax   # 0x672fb44
movl %eax, 0x8(%rsp)
movl 0x66c9691(%rip), %eax   # 0x672fb44
cvtsi2sd %rax, %xmm0
movsd 0xb930(%rip), %xmm1     # 0x71df0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %ecx
movl $0x40, %eax
cmpl %ecx, %eax
jbe 0x664df
movl $0x40, %eax
movl %eax, 0x4(%rsp)
jmp 0x664ff
movl 0x66c965f(%rip), %eax   # 0x672fb44
cvtsi2sd %rax, %xmm0
movsd 0xb8fe(%rip), %xmm1     # 0x71df0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x66c963b(%rip)   # 0x672fb44
cmpl $0x7fffffff, 0x66c9631(%rip) # imm = 0x7FFFFFFF
jb 0x66523
leaq 0xb988(%rip), %rdi      # 0x71ea4
movb $0x0, %al
callq 0xb580
movq 0x66c961e(%rip), %rdi   # 0x672fb48
movl 0x66c9614(%rip), %eax   # 0x672fb44
imulq $0xc, %rax, %rsi
callq 0x4590
movq %rax, 0x66c9608(%rip)   # 0x672fb48
cmpq $0x0, 0x66c9600(%rip)   # 0x672fb48
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movq 0x66c95e6(%rip), %rdi   # 0x672fb48
movl 0x8(%rsp), %eax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movl 0x66c95d1(%rip), %eax   # 0x672fb44
subl 0x8(%rsp), %eax
movl %eax, %eax
imulq $0xc, %rax, %rdx
xorl %esi, %esi
callq 0x41b0
jmp 0x66491
movl 0x14(%rsp), %ecx
movq 0x66c95b4(%rip), %rax   # 0x672fb48
movl 0x66c95a6(%rip), %edx   # 0x672fb40
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl 0x10(%rsp), %ecx
movq 0x66c959a(%rip), %rax   # 0x672fb48
movl 0x66c958c(%rip), %edx   # 0x672fb40
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl 0xc(%rsp), %eax
movb %al, %cl
movq 0x66c957d(%rip), %rax   # 0x672fb48
movl 0x66c956f(%rip), %edx   # 0x672fb40
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x8(%rax)
movl 0x66c955f(%rip), %eax   # 0x672fb40
addl $0x1, %eax
movl %eax, 0x66c9556(%rip)   # 0x672fb40
callq 0xd240
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)