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

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x2c
mov edx, dword [0x414044]
mov eax, dword [esp + 0x40]
test edx, edx
jne 0x410324
mov eax, dword [eax + 8]
test eax, eax
je 0x410380
add esp, 0x2c
pop ebx
pop esi
pop edi
pop ebp
ret
mov esi, dword [eax + 8]
test esi, esi
je 0x410392
mov ebx, dword [0x41a3e0]
mov ebp, dword [sym.imp.KERNEL32.dll_GetLastError]
call ebp
mov edi, eax
mov dword [esp], ebx
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov ebx, eax
mov dword [esp], edi
call dword [sym.imp.KERNEL32.dll_SetLastError]
sub esp, 4
test ebx, ebx
je 0x410414
mov edx, dword [ebx]
cmp edx, esi
jb 0x410462
lea ebx, [ebx + esi*4]
mov eax, dword [ebx]
test eax, eax
jne 0x41031c
mov eax, dword [esp + 0x40]
call fcn.004101e0
mov dword [ebx], eax
jmp 0x41031c
mov eax, dword [esp + 0x40]
call fcn.004101e0
mov ecx, dword [esp + 0x40]
mov dword [ecx + 8], eax
jmp 0x41031c
mov ebp, dword [0x414044]
test ebp, ebp
je 0x4104d8
mov edi, dword [0x414054]
test edi, edi
je 0x410501
lock add dword [0x41a3e4], 1
jne 0x410538
mov eax, dword [esp + 0x40]
mov esi, dword [eax + 8]
test esi, esi
je 0x4104e7
mov eax, dword [0x414044]
test eax, eax
je 0x41032b
mov eax, 0xffffffff
lock xadd dword [0x41a3e4], eax
sub eax, 1
js 0x41032b
mov eax, dword [0x41a3e8]
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
sub esp, 0xc
jmp 0x41032b
lea eax, [esi + 0x21]
mov dword [esp + 4], 4
lea edx, [esi + 0x20]
mov dword [esp], eax
mov dword [esp + 0x18], edx
call fcn.00410668
mov edx, dword [esp + 0x18]
test eax, eax
mov ebx, eax
je 0x410566
mov dword [eax], edx
mov eax, dword [0x41a3e0]
mov dword [esp + 4], ebx
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
sub esp, 8
test eax, eax
jne 0x410367
call ebp
jmp 0x410367
lea ecx, [edx + edx]
lea eax, [esi + 0x20]
mov dword [esp], ebx
cmp esi, ecx
mov dword [esp + 0x1c], edx
cmova ecx, eax
lea eax, [ecx*4 + 4]
mov dword [esp + 0x18], ecx
mov dword [esp + 4], eax
call fcn.00410608
mov ebx, eax
test eax, eax
je 0x410566
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x1c]
mov dword [eax], ecx
sub ecx, edx
lea eax, [eax + edx*4 + 4]
shl ecx, 2
mov dword [esp + 4], 0
mov dword [esp + 8], ecx
mov dword [esp], eax
call fcn.00410610
jmp 0x41043e
call fcn.00410280
mov dword [0x414054], 1
mov edx, dword [0x414044]
test edx, edx
jne 0x4103ae
mov eax, dword [esp + 0x40]
mov esi, dword [eax + 8]
test esi, esi
jne 0x41032b
mov eax, dword [0x41a3dc]
lea esi, [eax + 1]
mov dword [0x41a3dc], esi
mov eax, dword [esp + 0x40]
mov dword [eax + 8], esi
jmp 0x4103cb
lock add dword [0x414058], 1
je 0x4104bb
mov esi, dword [0x414054]
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
test esi, esi
jne 0x4104ca
nop
lea esi, [esi]
mov dword [esp], 0
call ebx
mov ecx, dword [0x414054]
sub esp, 4
test ecx, ecx
je 0x410520
jmp 0x4104ca
mov eax, dword [0x41a3e8]
mov dword [esp + 4], 0xffffffff
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
sub esp, 8
test eax, eax
je 0x4103bc
lock sub dword [0x41a3e4], 1
jmp 0x4103bc
call fcn.00410670
nop
lea esi, [esi]
push ebx
mov eax, dword [esp + 8]
mov edx, dword [esp + 0xc]
mov ecx, dword [esp + 0x10]
mov ebx, dword [esp + 0x14]
cmp dword [eax], edx
jae 0x41058e
mov dword [eax], edx
mov dword [eax + 0xc], 0
cmp dword [eax + 4], ecx
jae 0x410596
mov dword [eax + 4], ecx
test ebx, ebx
je 0x41059e
cmp dword [eax], edx
je 0x4105a0
pop ebx
ret
mov dword [eax + 0xc], ebx
pop ebx
ret