Function at 0x40d210
Capabilities:
Get thread local storage value

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x4c
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x30], edx
test ecx, ecx
je 0x40d534
mov eax, dword [esp + 0x30]
mov edx, dword [ecx]
test eax, eax
je 0x40d386
add edx, dword [eax]
jo 0x40d550
test edx, edx
js 0x40d562
mov ecx, 0x4a2d80
call fcn.00409ca0
mov esi, dword [esp + 0x2c]
mov ecx, eax
test esi, esi
je 0x40d3ba
mov eax, dword [esp + 0x2c]
mov eax, dword [eax]
mov dword [esp + 0x34], eax
sub eax, 1
seto bl
mov dword [esp + 0x38], eax
movzx ebx, bl
jo 0x40d550
mov ebp, ecx
jmp 0x40d2e5
add dword [esi - 8], 8
mov dword [ebp + ebx*4 + 8], esi
test edi, edi
je 0x40d2dc
mov eax, dword [edi - 8]
lea edx, [edi - 8]
mov dword [esp + 0x34], edx
sub eax, 8
mov dword [edi - 8], eax
cmp eax, 7
ja 0x40d2dc
mov esi, dword [0x49c308]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov dword [esp], esi
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov esi, eax
mov dword [esp], edi
add esi, 0x2c
call dword [sym.imp.KERNEL32.dll_SetLastError]
sub esp, 4
mov edx, dword [esp + 0x34]
mov dword [esp], esi
mov dword [esp + 4], edx
call fcn.00405190
add ebx, 1
jo 0x40d550
cmp dword [esp + 0x38], ebx
jl 0x40d3b8
test ebp, ebp
je 0x40d3a0
mov eax, dword [ebp]
cmp ebx, eax
jae 0x40d555
mov eax, dword [esp + 0x2c]
mov eax, dword [eax]
cmp ebx, eax
jae 0x40d555
mov eax, dword [esp + 0x2c]
mov edi, dword [ebp + ebx*4 + 8]
mov esi, dword [eax + ebx*4 + 8]
test esi, esi
je 0x40d284
mov edx, dword [esi + 4]
test edx, edx
js 0x40d280
mov ecx, dword [esi]
mov eax, 7
mov dword [esp], 0x472020
cmp ecx, eax
cmovl ecx, eax
add esi, 8
lea eax, [ecx + 9]
mov dword [esp + 0x34], ecx
mov dword [esp + 4], eax
call fcn.004081c0
mov ecx, dword [esp + 0x34]
mov edx, eax
mov dword [eax + 4], ecx
mov eax, dword [esi - 8]
lea ecx, [edx + 8]
mov dword [esp + 0x34], edx
mov dword [edx], eax
add eax, 1
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov dword [esp], ecx
call sub.msvcrt.dll_memcpy
mov esi, dword [esp + 0x34]
jmp 0x40d284
test edx, edx
js 0x40d562
mov ecx, 0x4a2d80
call fcn.00409ca0
mov ecx, eax
jmp 0x40d25d
mov eax, 0xffffffff
mov dword [esp + 4], eax
mov dword [esp], ebx
call fcn.0040a570
lea esi, [esi]
mov ecx, ebp
mov ebx, dword [esp + 0x30]
test ebx, ebx
je 0x40d52a
mov eax, dword [esp + 0x30]
mov eax, dword [eax]
sub eax, 1
seto bl
mov dword [esp + 0x34], eax
movzx ebx, bl
jo 0x40d550
mov edx, ecx
jmp 0x40d44d
add dword [esi - 8], 8
mov dword [edx + edi*4 + 8], esi
test ebp, ebp
je 0x40d444
mov eax, dword [ebp - 8]
lea edi, [ebp - 8]
sub eax, 8
mov dword [ebp - 8], eax
cmp eax, 7
ja 0x40d444
mov esi, dword [0x49c308]
mov dword [esp + 0x38], edx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebp, eax
mov dword [esp], esi
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov esi, eax
mov dword [esp], ebp
add esi, 0x2c
call dword [sym.imp.KERNEL32.dll_SetLastError]
sub esp, 4
mov dword [esp + 4], edi
mov dword [esp], esi
call fcn.00405190
mov edx, dword [esp + 0x38]
add ebx, 1
jo 0x40d550
cmp dword [esp + 0x34], ebx
jl 0x40d528
mov eax, dword [esp + 0x2c]
mov edi, ebx
test eax, eax
je 0x40d469
add edi, dword [eax]
jo 0x40d550
test edx, edx
je 0x40d510
mov eax, dword [edx]
cmp edi, eax
jae 0x40d55d
mov eax, dword [esp + 0x30]
mov eax, dword [eax]
cmp ebx, eax
jae 0x40d555
mov eax, dword [esp + 0x30]
mov ebp, dword [edx + edi*4 + 8]
mov esi, dword [eax + ebx*4 + 8]
test esi, esi
je 0x40d3ec
mov eax, dword [esi + 4]
test eax, eax
js 0x40d3e8
mov ecx, dword [esi]
mov eax, 7
mov dword [esp], 0x472020
mov dword [esp + 0x3c], edx
cmp ecx, eax
cmovl ecx, eax
add esi, 8
lea eax, [ecx + 9]
mov dword [esp + 0x38], ecx
mov dword [esp + 4], eax
call fcn.004081c0
mov ecx, dword [esp + 0x38]
mov edx, eax
mov dword [eax + 4], ecx
mov eax, dword [esi - 8]
lea ecx, [edx + 8]
mov dword [esp + 0x38], edx
mov dword [edx], eax
add eax, 1
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov dword [esp], ecx
call sub.msvcrt.dll_memcpy
mov esi, dword [esp + 0x38]
mov edx, dword [esp + 0x3c]
jmp 0x40d3ec
mov eax, 0xffffffff
mov dword [esp + 4], eax
mov dword [esp], edi
call fcn.0040a570
lea esi, [esi]
mov ecx, edx
add esp, 0x4c
mov eax, ecx
pop ebx
pop esi
pop edi
pop ebp
ret
test edx, edx
je 0x40d53f
mov edx, dword [edx]
jmp 0x40d23d
add esp, 0x4c
mov ecx, 0x4a2d80
pop ebx
pop esi
pop edi
pop ebp
jmp fcn.00409ca0
call fcn.00409ba0
sub eax, 1
jmp 0x40d3a5
sub eax, 1
jmp 0x40d515
mov dword [esp], edx
sar edx, 0x1f
mov dword [esp + 0x10], 0x7fffffff
mov dword [esp + 0x14], 0
mov dword [esp + 8], 0
mov dword [esp + 0xc], 0
mov dword [esp + 4], edx
call fcn.0040b690
lea esi, [esi]
lea esi, [esi]
nop