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

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x1c
mov eax, dword [0x4466c0]
mov edi, dword [ebp + 8]
test eax, eax
je 0x40d7a4
mov esi, dword [eax + 0x30]
test esi, esi
js 0x40d7c0
mov ebx, dword [eax + 0x30]
test ebx, ebx
jne 0x40d7e0
mov eax, dword [eax + 0x28]
mov dword [ebp - 0x10], eax
mov ecx, dword [edi + 0xc]
mov dword [ebp - 0x14], eax
test ecx, ecx
jne 0x40d798
lea edx, [ebp - 0x14]
mov eax, edi
call fcn.0040d2a0
cmp eax, 7
jne 0x40d85f
mov eax, dword [0x4466c0]
mov ebx, dword [ebp - 0x14]
test eax, eax
je 0x40d836
mov edx, dword [eax + 0x30]
test edx, edx
js 0x40d850
mov edi, dword [eax + 0x30]
test edi, edi
jne 0x40d810
mov dword [eax + 0x28], ebx
mov eax, dword [ebp - 0x14]
lea edx, [eax + 0x20]
mov ecx, dword [edx + 4]
mov ebp, dword [eax + 0x20]
mov esp, dword [edx + 8]
jmp ecx
lea edx, [ebp - 0x14]
mov eax, edi
call fcn.0040d4c0
jmp 0x40d755
call fcn.0040cd00
mov eax, dword [0x4466c0]
mov esi, dword [eax + 0x30]
test esi, esi
jns 0x40d730
lea esi, [esi]
call fcn.0040cfa0
mov eax, dword [0x4466c0]
mov ebx, dword [eax + 0x30]
test ebx, ebx
je 0x40d73b
lea esi, [esi]
lea edi, [edi]
mov ebx, dword [eax + 0x2c]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp], ebx
mov esi, eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov ebx, eax
mov dword [esp], esi
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, ebx
sub esp, 4
jmp 0x40d73e
mov eax, dword [eax + 0x2c]
mov dword [esp + 4], ebx
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
sub esp, 8
test eax, eax
jne 0x40d787
call dword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x40d787
call fcn.0040cd00
mov eax, dword [0x4466c0]
mov edx, dword [eax + 0x30]
test edx, edx
jns 0x40d779
nop
lea esi, [esi]
call fcn.0040cfa0
mov eax, dword [0x4466c0]
jmp 0x40d779
call sub.msvcrt.dll_abort
lea esi, [esi]
lea edi, [edi]
push ebp
mov ebp, esp
sub esp, 0x28
mov dword [ebp - 4], edi
mov edi, dword [ebp + 8]
mov dword [ebp - 0xc], ebx
mov dword [ebp - 8], esi
mov esi, dword [edi + 0xc]
test esi, esi
je 0x40d902
mov eax, dword [0x4466c0]
test eax, eax
je 0x40d8f6
mov ebx, dword [eax + 0x30]
test ebx, ebx
js 0x40d971
mov ecx, dword [eax + 0x30]
test ecx, ecx
jne 0x40d917
mov eax, dword [eax + 0x28]
mov dword [ebp - 0x10], eax
lea edx, [ebp - 0x14]
mov dword [ebp - 0x14], eax
mov eax, edi
call fcn.0040d4c0
cmp eax, 7
jne 0x40d98f
mov eax, dword [0x4466c0]
mov ebx, dword [ebp - 0x14]
test eax, eax
je 0x40d962
mov edx, dword [eax + 0x30]
test edx, edx
js 0x40d980
mov edi, dword [eax + 0x30]
test edi, edi
jne 0x40d943
mov dword [eax + 0x28], ebx
mov eax, dword [ebp - 0x14]
lea edx, [eax + 0x20]
mov ecx, dword [edx + 4]
mov ebp, dword [eax + 0x20]
mov esp, dword [edx + 8]
jmp ecx
call fcn.0040cd00
mov eax, dword [0x4466c0]
jmp 0x40d892
mov dword [esp], edi
call fcn.0040d330
mov ebx, dword [ebp - 0xc]
mov esi, dword [ebp - 8]
mov edi, dword [ebp - 4]
mov esp, ebp
pop ebp
ret
mov ebx, dword [eax + 0x2c]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp], ebx
mov esi, eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov ebx, eax
mov dword [esp], esi
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, ebx
sub esp, 4
jmp 0x40d8a7
mov eax, dword [eax + 0x2c]
mov dword [esp + 4], ebx
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
sub esp, 8
test eax, eax
jne 0x40d8e5
call dword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x40d8e5
call fcn.0040cd00
mov eax, dword [0x4466c0]
jmp 0x40d8d0
call fcn.0040cfa0
mov eax, dword [0x4466c0]
jmp 0x40d89d
call fcn.0040cfa0
mov eax, dword [0x4466c0]
jmp 0x40d8db
call sub.msvcrt.dll_abort
lea esi, [esi]
lea edi, [edi]