Function at 0x4a6160
Capabilities:
Allocate thread local storage
Set environment variable
Set thread local storage value

Disassembly:
push 0xffffffffffffffff
push 0x5b00cf
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 8
push ebx
push ebp
push esi
mov esi, ecx
push edi
mov dword [esp + 0x10], esi
lea ebx, [esi + 8]
mov ecx, ebx
call sub.MFC42.DLL_CDWordArray::CDWordArray
lea edi, [esi + 0x28]
xor ebp, ebp
mov ecx, edi
mov dword [esp + 0x20], ebp
mov dword [esp + 0x14], edi
call fcn.00479be0
push bind
mov ecx, edi
mov byte [esp + 0x24], 1
call fcn.0047b470
push 0x6485c8
mov ecx, edi
call fcn.00479f60
mov dword [esi + 0x30b0], 0x5c0d6c
mov dword [esi + 0x30b4], ebp
mov dword [esi + 0x30c0], ebp
mov dword [esi + 0x30bc], ebp
mov dword [esi + 0x30b8], ebp
push 0xa
lea ecx, [esi + 0x30c4]
mov byte [esp + 0x24], 3
call sub.MFC42.DLL_CMapStringToPtr::CMapStringToPtr
mov dword [esi + 0x30e0], 0x5d63e0
mov dword [esi + 0x30ec], ebp
mov dword [esi + 0x30f0], ebp
mov dword [esi + 0x30e8], ebp
mov dword [esi + 0x30e4], ebp
mov dword [esi + 0x30f4], ebp
mov dword [esi + 0x30f8], 0xa
lea edi, [esi + 0x3100]
mov byte [esp + 0x20], 5
mov dword [esp + 0x14], edi
lea ecx, [edi + 0x20]
call sub.MFC42.DLL_CString::CString_3
mov eax, ebp
mov dword [edi + 4], ebp
mov dword [edi], ebp
mov dword [edi + 0x1c], ebp
mov dword [edi + 0x2c], ebp
mov dword [edi + 0x18], ebp
or al, 0xf0
mov dword [edi + 0x28], ebp
push 0x659680
lea ecx, [edi + 0x20]
mov byte [esp + 0x24], 6
mov dword [edi + 0x28], eax
call fcn.004be14e
mov dword [edi + 0x24], ebp
mov dword [esi + 0x3140], 0x5d63cc
mov dword [esi + 0x3144], ebp
mov dword [esi + 0x3148], 0x11
mov dword [esi + 0x314c], ebp
mov dword [esi + 0x3150], ebp
mov dword [esi + 0x3154], ebp
mov dword [esi + 0x3158], 0xa
lea edi, [esi + 0x315c]
mov byte [esp + 0x20], 8
mov ecx, edi
mov dword [esp + 0x14], edi
call fcn.004642d0
mov byte [esp + 0x20], 9
lea ecx, [edi + 0xc4]
call sub.MFC42.DLL_CString::CString_3
lea ecx, [edi + 0xc8]
mov byte [esp + 0x20], 0xa
call sub.MFC42.DLL_CString::CString_3
lea ecx, [edi + 0xcc]
mov byte [esp + 0x20], 0xb
call fcn.00401582
lea ecx, [edi + 0xe4]
mov byte [esp + 0x20], 0xc
call sub.MFC42.DLL_CStringArray::CStringArray
lea ecx, [edi + 0xf8]
mov byte [esp + 0x20], 0xd
call fcn.004022b6
lea ecx, [edi + 0x14c]
mov byte [esp + 0x20], 0xe
call sub.MFC42.DLL_CStringArray::CStringArray
lea ecx, [edi + 0x160]
mov byte [esp + 0x20], 0xf
call sub.MFC42.DLL_CStringArray::CStringArray
lea ecx, [edi + 0x174]
mov byte [esp + 0x20], 0x10
call fcn.00401fcd
mov dword [edi], 0x5bed4c
mov dword [edi + 0xc0], ebp
mov dword [edi + 0x14], 1
mov ecx, 0x10
xor eax, eax
add edi, 0x10c
rep stosd dword es:[edi], eax
lea eax, [esi + 0x32ec]
mov byte [esp + 0x20], 0x11
push eax
mov dword [esi], 0x5d63c8
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
push 0xffffffffffffffff
push 0x2000
mov ecx, ebx
call sub.MFC42.DLL_CDWordArray::SetSize
mov dword [esi + 0x1c], ebp
mov dword [esi + 0x24], ebp
mov eax, dword [esi + 0x3144]
cmp eax, ebp
je 0x4a639a
push eax
call sub.MFC42.DLL_operatordelete
add esp, 4
mov dword [esi + 0x3144], ebp
push 0x1000
call sub.MFC42.DLL_operatornew
mov edi, eax
mov ecx, 0x400
xor eax, eax
mov dword [esi + 0x3144], edi
rep stosd dword es:[edi], eax
add esp, 4
mov dword [esi + 0x3148], 0x400
mov dword [esi + 0x3304], ebp
mov dword [esi + 0x313c], ebp
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov edx, dword [esp + 0x28]
lea ecx, [esi + 4]
mov dword [esi + 0x30fc], eax
push edx
mov dword [ecx], ebp
lea ecx, [esi + 0x3100]
call fcn.004a64a0
mov edx, dword [esi + 0x3130]
mov eax, dword [esi + 0x315c]
lea ecx, [esi + 0x315c]
push edx
call dword [eax + 0x28]
cmp dword [0x67d380], ebp
jne 0x4a645c
call dword [sym.imp.KERNEL32.dll_TlsAlloc]
lea ecx, [esp + 0x28]
mov dword [0x67d380], eax
call sub.MFC42.DLL_CString::CString_3
mov eax, dword [0x67d380]
lea ecx, [esp + 0x28]
push eax
push 0x646848
push ecx
mov byte [esp + 0x2c], 0x12
call sub.MFC42.DLL_CString::Format_1
mov edx, dword [esp + 0x34]
add esp, 0xc
push edx
push str.QVMInstanceTlsIndex
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
lea ecx, [esp + 0x28]
mov byte [esp + 0x20], 0x11
call sub.MFC42.DLL_CString::CString
mov eax, dword [0x67d380]
push esi
push eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov ecx, dword [esp + 0x18]
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x14
ret 4