Function at 0x4c8be7
Capabilities:
Allocate thread local storage
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x2c
cmp dword [0x73cf58], 0
mov ebp, dword [esp + 0x40]
jne 0x4c8c13
cmp dword [ebp + 8], 0
jne 0x4c8c0b
mov eax, ebp
call fcn.004d2f10
mov dword [ebp + 8], eax
mov eax, dword [ebp + 8]
jmp 0x4c8e12
mov esi, dword [ebp + 8]
test esi, esi
jne 0x4c8d55
cmp dword [0x671d4c], 0
jne 0x4c8cc2
mov dword [esp], 0x671d50
call sub.KERNEL32.DLL_InterlockedIncrement
test eax, eax
push edx
jne 0x4c8cb9
mov dword [0x73c5ac], 0xffffffff
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0xffff
mov dword [esp + 4], 0
mov dword [esp], 0
call sub.KERNEL32.DLL_CreateSemaphoreA
sub esp, 0x10
mov dword [0x73c5b0], eax
call sub.KERNEL32.DLL_TlsAlloc
cmp eax, 0xffffffff
je 0x4c8c93
mov dword [esp + 4], 0x4c8bb0
mov dword [esp], eax
mov dword [0x73c5b8], eax
call fcn.004cdd1c
jmp 0x4c8c98
call sub.KERNEL32.DLL_GetLastError
test eax, eax
jne 0x4c8dcc
mov dword [0x671d4c], 1
jmp 0x4c8cc2
mov dword [esp], 0
call sub.KERNEL32.DLL_Sleep
push edi
cmp dword [0x671d4c], 0
je 0x4c8cac
cmp dword [0x73cf58], 0
je 0x4c8d04
mov dword [esp], 0x73c5ac
call sub.KERNEL32.DLL_InterlockedIncrement
test eax, eax
push esi
je 0x4c8d04
mov eax, dword [0x73c5b0]
mov dword [esp + 4], 0xffffffff
mov dword [esp], eax
call sub.KERNEL32.DLL_WaitForSingleObject
test eax, eax
push ebx
push ebx
je 0x4c8d04
mov dword [esp], 0x73c5ac
call sub.KERNEL32.DLL_InterlockedDecrement
push ecx
mov esi, dword [ebp + 8]
test esi, esi
jne 0x4c8d1b
mov esi, dword [0x73c5b4]
inc esi
mov dword [0x73c5b4], esi
mov dword [ebp + 8], esi
cmp dword [0x73cf58], 0
je 0x4c8d55
mov dword [esp], 0x73c5ac
call sub.KERNEL32.DLL_InterlockedDecrement
test eax, eax
push edx
js 0x4c8d55
mov eax, dword [0x73c5b0]
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], eax
call sub.KERNEL32.DLL_ReleaseSemaphore
sub esp, 0xc
mov ebx, dword [0x73c5b8]
call sub.KERNEL32.DLL_GetLastError
mov dword [esp], ebx
mov edi, eax
call sub.KERNEL32.DLL_TlsGetValue
push ecx
mov ebx, eax
mov dword [esp], edi
call sub.KERNEL32.DLL_SetLastError
test ebx, ebx
push edi
jne 0x4c8d9a
lea eax, [esi + 0x21]
mov dword [esp + 4], 4
mov dword [esp], eax
call sub.MSVCRT.DLL_calloc
test eax, eax
mov ebx, eax
je 0x4c8dcc
lea eax, [esi + 0x20]
mov dword [ebx], eax
jmp 0x4c8de2
mov edi, dword [ebx]
cmp esi, edi
jbe 0x4c8dfe
lea ecx, [edi + edi]
cmp esi, ecx
lea eax, [esi + 0x20]
cmova ecx, eax
lea eax, [ecx*4 + 4]
mov dword [esp], ebx
mov dword [esp + 0x1c], ecx
mov dword [esp + 4], eax
call sub.MSVCRT.DLL_realloc
mov ecx, dword [esp + 0x1c]
test eax, eax
mov ebx, eax
jne 0x4c8dd1
call sub.MSVCRT.DLL_abort
mov dword [eax], ecx
lea edx, [eax + edi*4 + 4]
sub ecx, edi
shl ecx, 2
xor eax, eax
mov edi, edx
rep stosb byte es:[edi], al
mov eax, dword [0x73c5b8]
mov dword [esp + 4], ebx
mov dword [esp], eax
call sub.KERNEL32.DLL_TlsSetValue
test eax, eax
push edx
push edx
jne 0x4c8dfe
call sub.KERNEL32.DLL_GetLastError
dec esi
mov eax, dword [ebx + esi*4 + 4]
test eax, eax
jne 0x4c8e12
mov eax, ebp
call fcn.004d2f10
mov dword [ebx + esi*4 + 4], eax
add esp, 0x2c
pop ebx
pop esi
pop edi
pop ebp
ret