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

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff0
sub esp, 0x70
mov eax, dword [ebp + 8]
mov esi, dword [eax]
test esi, esi
je 0x40a326
dec esi
push esi
call sub.kernel32.dll_TlsGetValue
cmp eax, 1
ja 0x40a31e
je 0x40a31c
mov eax, dword [ebp + 0xc]
test eax, eax
je 0x40a1b6
mov edi, dword [eax]
mov dword [eax], 0
test edi, edi
jne 0x40a2b8
xorps xmm0, xmm0
movups xmmword [esp + 0x40], xmm0
movups xmmword [esp + 0x30], xmm0
lea edi, [esp + 0x30]
lea ebx, [esp + 0x18]
push 0x20
push edi
push ebx
call fcn.0040fe50
add esp, 0xc
test eax, eax
jne 0x40a350
movups xmm0, xmmword [esp + 0x30]
movups xmm1, xmmword [esp + 0x40]
movaps xmmword [esp + 0x20], xmm0
movaps xmmword [esp + 0x50], xmm1
push 4
push 0x56ffcc
call fcn.0040ba10
add esp, 8
mov dword [esp + 0x14], eax
lea eax, [0x56ffd0]
push 4
push eax
call fcn.0040ba10
add esp, 8
mov ebx, eax
mov eax, dword [0x593ab0]
movzx eax, byte [eax]
push 8
push 0x158
call fcn.00409a80
add esp, 8
test eax, eax
je 0x40a39c
mov edi, eax
mov dword [eax], 1
mov dword [eax + 4], 1
add eax, 8
push 0x100
push 0
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
movaps xmm0, xmmword [esp + 0x20]
movaps xmm2, xmmword [esp + 0x50]
mov eax, dword [esp + 0x14]
movaps xmm1, xmmword [0x5700c0]
mov dword [edi + 0x108], 0x40
movups xmmword [edi + 0x110], xmm0
movups xmmword [edi + 0x120], xmm2
mov dword [edi + 0x130], 0
mov dword [edi + 0x134], 0
mov dword [edi + 0x138], eax
mov dword [edi + 0x13c], ebx
movups xmmword [edi + 0x140], xmm1
mov dword [edi + 0x150], 0
mov eax, dword [0x593ab0]
movzx eax, byte [eax]
push 4
push 8
call fcn.00409a80
add esp, 8
test eax, eax
je 0x40a342
mov dword [eax], edi
mov dword [eax + 4], esi
push esi
mov ebx, eax
call sub.kernel32.dll_TlsGetValue
mov edi, eax
mov dword [esp + 0x20], ebx
push ebx
push esi
call sub.kernel32.dll_TlsSetValue
test edi, edi
je 0x40a316
mov eax, dword [edi]
dec dword [eax]
jne 0x40a309
dec dword [eax + 4]
jne 0x40a309
push 8
push 0x158
push eax
call main
add esp, 0xc
push 4
push 8
push edi
call main
add esp, 0xc
mov eax, dword [esp + 0x20]
jmp 0x40a31e
xor eax, eax
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
push eax
call fcn.004ab560
add esp, 4
mov esi, eax
push esi
call sub.kernel32.dll_TlsGetValue
cmp eax, 1
jbe 0x40a199
jmp 0x40a31e
push 8
push 4
call fcn.004ce360
add esp, 8
jmp 0x40a39a
lea ecx, [esp + 0xc]
mov dword [esp + 0xc], eax
mov dword [esp + 0x30], 0x5701d0
mov dword [esp + 0x34], 1
mov dword [esp + 0x40], 0
mov dword [esp + 0x38], ebx
mov dword [esp + 0x10], edx
mov dword [esp + 0x3c], 1
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], 0x40fbb0
push 0x570240
push edi
call fcn.004d9c00
add esp, 8
ud2
push 0x158
push 8
call fcn.004ce360
mov ebx, dword [esp + 0x10]
mov esi, eax
mov edi, dword [esp + 0xc]
mov eax, dword [ebx]
test eax, eax
je 0x40a3be
push edi
call eax
add esp, 4
mov eax, dword [ebx + 4]
test eax, eax
je 0x40a3d2
push dword [ebx + 8]
push eax
push edi
call main
add esp, 0xc
push esi
call fcn.004f2f90
mov eax, dword [ebx + 4]
test eax, eax
je 0x40a3ec
push dword [ebx + 8]
push eax
push edi
call main
add esp, 0xc
call fcn.004d9ee0
mov esi, eax
mov ecx, edi
call 0x40a400
push esi
call fcn.004f2f90
dec dword [ecx]
je 0x40a405
ret
dec dword [ecx + 4]
jne 0x40a404
push ebp
mov ebp, esp
push 8
push 0x158
push ecx
call main
add esp, 0xc
pop ebp
ret