Function at 0x410310
Capabilities:
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xc4
mov eax, dword [0x59ece0]
xor eax, esp
mov dword [esp + 0xc0], eax
mov al, byte [ebp + 0xc]
mov byte [esp + 0x54], al
mov eax, dword [ebp + 0x14]
mov dword [esp + 0x20], ecx
mov ecx, dword [ebp + 0x18]
mov dword [esp + 0x28], edx
mov edx, dword [ebp + 0x1c]
push ebx
mov ebx, dword [ebp + 8]
mov dword [esp + 0x44], eax
mov eax, dword [ebp + 0x20]
mov dword [esp + 0x3c], ecx
mov ecx, dword [ebp + 0x24]
mov dword [esp + 0x6c], edx
mov dl, byte [ebp + 0x28]
push esi
push edi
mov edi, dword [ebp + 0x10]
mov dword [esp + 0x5c], ebx
mov dword [esp + 0x54], eax
mov dword [esp + 0x58], ecx
mov byte [esp + 0x30], dl
mov dword [esp + 0x10], 0
call fcn.00402410
mov esi, eax
fild qword [esi]
fldz
fucompp
fnstsw ax
test ah, 0x44
jnp 0x4103b2
lea eax, [esp + 0x10]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov ecx, dword [esp + 0x14]
mov edx, dword [esp + 0x10]
push ecx
push edx
mov eax, esi
call fcn.00401860
mov dword [esp + 0x38], eax
mov dword [esp + 0x3c], edx
jmp 0x4103bb
lea esi, [esp + 0x38]
call fcn.00401800
xor esi, esi
push ebx
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x20], esi
mov dword [esp + 0x24], esi
mov dword [esp + 0x28], esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esp + 0x2c]
cmp byte [eax], 0
jne 0x410428
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esp + 0x1c]
cmp eax, esi
je 0x41040e
lea edi, [eax + 4]
push 0xffffffffffffffff
push edi
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
dec eax
jne 0x41040e
cmp edi, esi
je 0x41040e
lea ecx, [edi - 4]
cmp ecx, esi
je 0x41040e
mov edx, dword [ecx]
mov eax, dword [edx]
push 1
call eax
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0xc0]
xor ecx, esp
call fcn.0049d4b1
mov esp, ebp
pop ebp
ret 0x24
mov ecx, dword [ebx + 0x28]
sub ecx, dword [ebx + 0x24]
lea esi, [ebx + 0x24]
sar ecx, 6
cmp ecx, 0x7a120
jb 0x410465
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x41040e
lea esi, [eax + 4]
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
dec eax
jne 0x41040e
test esi, esi
je 0x41040e
lea ecx, [esi - 4]
test ecx, ecx
jmp 0x410404
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov ecx, dword [0x623e60]
push ecx
mov dword [esp + 0x2c], eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [esp + 0xc], eax
call fcn.00410cf0
mov edx, dword [eax]
push edx
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov ecx, dword [esp + 0xc]
cmp ecx, eax
je 0x410593
test ecx, ecx
je 0x410593
cmp byte [ecx], 0
je 0x410593
call fcn.00410cf0
mov ecx, dword [esp + 0xc]
mov edx, dword [eax]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
jne 0x4104c7
call fcn.0041d9a0
lea ecx, [esp + 0x28]
push ecx
lea edx, [esp + 0x14]
lea eax, [ebx + 0x74]
push edx
call fcn.00409a80
mov eax, dword [esp + 0x10]
cmp eax, dword [ebx + 0x78]
jne 0x410504
mov ecx, dword [esp + 0xc]
push ecx
push ecx
lea edx, [esp + 0x30]
push edx
lea ecx, [ebx + 0x74]
call fcn.004109e0
add esp, 4
mov ecx, eax
call fcn.00402680
jmp 0x410593
xor eax, eax
push 0x5980e8
lea ecx, [esp + 0x7c]
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
call fcn.00407c00
mov eax, dword [esp + 0x10]
add eax, 0xc
push eax
lea ecx, [esp + 0x84]
mov dword [esp + 0x14], eax
call fcn.004060d0
lea eax, [esp + 0x78]
push eax
lea ecx, [esp + 0x84]
push ecx
lea eax, [esp + 0x6c]
call fcn.00412e00
mov edx, dword [esp + 0x70]
mov ecx, dword [esp + 0x6c]
push edx
lea eax, [esp + 0x18]
call fcn.004114d0
add esp, 0xc
cmp eax, dword [esp + 0x68]
jne 0x410582
mov ecx, dword [esp + 0x10]
push 0x2c
call fcn.004107c0
mov eax, dword [esp + 0xc]
mov ecx, dword [esp + 0x10]
push eax
call fcn.00406640
mov eax, dword [esp + 0x64]
test eax, eax
je 0x410593
push eax
call fcn.0049d0c3
add esp, 4
test byte [esp + 0x30], 4
je 0x4105aa
mov edx, dword [ebx + 0xa4]
xor edi, dword [ebx + 0xa0]
xor dword [esp + 0x4c], edx
mov eax, dword [esp + 0x30]
mov ecx, dword [esp + 0x58]
mov edx, dword [esp + 0x54]
push eax
mov eax, dword [esp + 0x78]
push ecx
mov ecx, dword [esp + 0x4c]
mov ebx, dword [esi + 4]
push edx
mov edx, dword [esp + 0x58]
sub ebx, dword [esi]
push eax
mov eax, dword [esp + 0x44]
push ecx
mov ecx, dword [esp + 0x40]
push edx
mov edx, dword [esp + 0x78]
push edi
push eax
mov eax, dword [esp + 0x5c]
push ecx
mov ecx, dword [esp + 0x5c]
push edx
mov edx, dword [esp + 0x50]
push eax
push ecx
push edx
lea eax, [esp + 0xbc]
push eax
sar ebx, 6
call fcn.0040fa10
push esi
call fcn.00410810
mov eax, dword [esp + 0xb8]
test eax, eax
je 0x410630
lea edi, [eax + 4]
push 0xffffffffffffffff
push edi
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
dec eax
jne 0x410630
test edi, edi
je 0x410630
lea ecx, [edi - 4]
test ecx, ecx
je 0x410630
mov edx, dword [ecx]
mov eax, dword [edx + 8]
push 1
call eax
mov ecx, dword [esi + 4]
sub ecx, dword [esi]
and ecx, 0xffffffc0
cmp ecx, 0x1e84800
jne 0x410662
mov eax, dword [esp + 0x18]
add eax, 0x1c
cmp dword [eax], 0
je 0x410662
cmp dword [esp + 0x24], 0
jne 0x41065d
push eax
lea edi, [esp + 0x20]
call fcn.0040fe90
or dword [esp + 0x24], 1
mov edi, dword [esp + 0x5c]
mov edx, dword [esp + 0x2c]
cmp dword [edi + 0xac], edx
jne 0x410695
mov eax, dword [esp + 0x34]
push eax
lea ecx, [edi + 0xb0]
push ecx
call fcn.00403270
add esp, 8
test al, al
je 0x410695
push 2
lea esi, [esp + 0x1c]
call fcn.0040fe60
push edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [esp + 0x24], 0
je 0x4106b4
mov eax, dword [esp + 0x1c]
lea edx, [esp + 0x24]
push edx
push eax
call dword [esp + 0x28]
add esp, 8
mov esi, dword [esp + 0x1c]
test esi, esi
je 0x4106de
push 0xffffffffffffffff
add esi, 4
push esi
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
dec eax
jne 0x4106de
test esi, esi
je 0x4106de
lea ecx, [esi - 4]
test ecx, ecx
je 0x4106de
mov edx, dword [ecx]
mov eax, dword [edx]
push 1
call eax
mov ecx, dword [esp + 0xcc]
pop edi
pop esi
mov eax, ebx
pop ebx
xor ecx, esp
call fcn.0049d4b1
mov esp, ebp
pop ebp
ret 0x24