Function at 0x40e670
Capabilities:
Get thread local storage value

Disassembly:
push ebp
push edi
mov edi, ecx
push esi
push ebx
sub esp, 0x3c
mov ecx, dword [ecx]
mov dword [esp + 0x18], edx
mov edx, 1
mov ebp, dword [esp + 0x50]
call fcn.00408ef0
mov dword [esp], edi
mov ebx, eax
call fcn.00406db0
test al, al
jne 0x40e6c8
test ebx, ebx
je 0x40e6a3
add dword [ebx - 8], 8
mov eax, dword [edi]
cmp eax, 0xfff
jbe 0x40e6c8
mov esi, dword [eax - 8]
lea edx, [eax - 8]
mov dword [esp + 0x20], edx
lea ecx, [esi - 8]
mov dword [eax - 8], ecx
cmp ecx, 7
jbe 0x40e91f
lea esi, [esi]
mov dword [edi], ebx
mov eax, dword [ebx]
mov esi, 0x7b
mov word [ebx + eax + 8], si
add dword [ebx], 1
mov eax, dword [ebp]
cmp eax, 4
je 0x40e8c8
jg 0x40e888
cmp eax, 1
je 0x40e8b0
cmp eax, 2
jne 0x40ea10
mov eax, dword [esp + 0x18]
mov dword [esp + 0x1c], 0
movzx eax, word [eax]
mov dword [esp + 0x18], eax
xor eax, eax
xor ebx, ebx
mov esi, eax
lea esi, [esi]
lea esi, [esi]
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x18]
mov ecx, ebx
shrd eax, edx, cl
shr edx, cl
test cl, 0x20
je 0x40e736
mov eax, edx
and eax, 1
je 0x40e822
test esi, esi
je 0x40e807
mov ecx, dword [edi]
mov edx, 2
call fcn.00408c60
mov dword [esp], edi
mov dword [esp + 0x20], eax
call fcn.00406db0
mov edx, dword [esp + 0x20]
test al, al
jne 0x40e7f0
test edx, edx
je 0x40e773
add dword [edx - 8], 8
mov eax, dword [edi]
cmp eax, 0xfff
jbe 0x40e7f0
lea ecx, [eax - 8]
mov dword [esp + 0x20], ecx
mov ecx, dword [eax - 8]
sub ecx, 8
mov dword [eax - 8], ecx
cmp ecx, 7
ja 0x40e7f0
mov ecx, dword [0x49c308]
mov dword [esp + 0x2c], edx
mov dword [esp + 0x28], ecx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x28]
mov dword [esp + 0x24], eax
mov dword [esp], ecx
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov edx, dword [esp + 0x24]
mov dword [esp + 0x28], eax
mov dword [esp], edx
call dword [sym.imp.KERNEL32.dll_SetLastError]
sub esp, 4
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x20]
add eax, 0x2c
mov dword [esp + 4], ecx
mov dword [esp], eax
call fcn.00405190
mov edx, dword [esp + 0x2c]
lea esi, [esi]
nop
mov dword [edi], edx
mov eax, dword [edx]
mov ecx, 0x202c
lea eax, [edx + eax + 8]
mov word [eax], cx
mov byte [eax + 2], 0
add dword [edx], 2
mov eax, dword [ebp + 0x10]
mov ecx, edi
add esi, 1
mov edx, dword [eax + 0x10]
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
add edx, ebx
call fcn.0040e400
sub esp, 4
add ebx, 1
cmp ebx, 0x40
jne 0x40e720
mov ecx, dword [edi]
mov edx, 1
call fcn.00408ef0
mov dword [esp], edi
mov ebx, eax
call fcn.00406db0
test al, al
jne 0x40e86a
test ebx, ebx
je 0x40e850
add dword [ebx - 8], 8
mov eax, dword [edi]
cmp eax, 0xfff
jbe 0x40e86a
mov esi, dword [eax - 8]
lea ebp, [eax - 8]
lea edx, [esi - 8]
mov dword [eax - 8], edx
cmp edx, 7
jbe 0x40e8dd
mov dword [edi], ebx
mov eax, dword [ebx]
mov edx, 0x7d
mov word [ebx + eax + 8], dx
add dword [ebx], 1
add esp, 0x3c
pop ebx
pop esi
pop edi
pop ebp
ret 4
cmp eax, 8
jne 0x40e968
mov eax, dword [esp + 0x18]
mov edx, dword [eax + 4]
mov eax, dword [eax]
mov dword [esp + 0x1c], edx
mov dword [esp + 0x18], eax
jmp 0x40e710
mov eax, dword [esp + 0x18]
mov dword [esp + 0x1c], 0
movzx eax, byte [eax]
mov dword [esp + 0x18], eax
jmp 0x40e710
mov eax, dword [esp + 0x18]
xor edx, edx
mov dword [esp + 0x1c], edx
mov eax, dword [eax]
mov dword [esp + 0x18], eax
jmp 0x40e710
mov esi, dword [0x49c308]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x18], eax
mov dword [esp], esi
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov esi, eax
mov edx, dword [esp + 0x18]
add esi, 0x2c
mov dword [esp], edx
call dword [sym.imp.KERNEL32.dll_SetLastError]
sub esp, 4
mov dword [esp + 4], ebp
mov dword [esp], esi
call fcn.00405190
jmp 0x40e86a
mov esi, dword [0x49c308]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x24], eax
mov dword [esp], esi
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
mov esi, eax
mov ecx, dword [esp + 0x24]
add esi, 0x2c
mov dword [esp], ecx
call dword [sym.imp.KERNEL32.dll_SetLastError]
sub esp, 4
mov edx, dword [esp + 0x20]
mov dword [esp], esi
mov dword [esp + 4], edx
call fcn.00405190
jmp 0x40e6c8
lea esi, [eax*8]
xor eax, eax
mov dword [esp + 0x20], esi
xor ebx, ebx
mov esi, eax
lea esi, [esi]
mov ecx, dword [esp + 0x18]
mov eax, ebx
sar eax, 3
movzx edx, byte [ecx + eax]
mov eax, ebx
and eax, 7
bt edx, eax
jae 0x40e9e2
test esi, esi
je 0x40e9c7
mov ecx, dword [edi]
mov edx, 2
call fcn.00408c60
mov ecx, edi
mov edx, eax
call fcn.00406e10
mov eax, dword [edi]
mov ecx, 0x202c
mov edx, dword [eax]
lea edx, [eax + edx + 8]
mov word [edx], cx
mov byte [edx + 2], 0
add dword [eax], 2
mov eax, dword [ebp + 0x10]
mov ecx, edi
add esi, 1
mov edx, dword [eax + 0x10]
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
add edx, ebx
call fcn.0040e400
sub esp, 4
add ebx, 1
cmp ebx, dword [esp + 0x20]
jne 0x40e980
cmp dword [ebp], 8
mov eax, esi
jg 0x40e82e
mov dword [esp + 0x18], 0
mov dword [esp + 0x1c], 0
jmp 0x40e712
lea esi, [eax*8]
test esi, esi
jg 0x40e96f
mov dword [esp + 0x18], 0
xor eax, eax
mov dword [esp + 0x1c], 0
jmp 0x40e712