Function at 0x40e4a4
Capabilities:
Allocate thread local storage
Get thread local storage value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xcc
push esi
mov dword [ebp - 0x1c], 0x91
mov dword [ebp - 0xc], 0xce
mov dword [ebp - 0x7c], 0xea
mov dword [ebp - 0x10], 0xa1
mov dword [ebp - 0x28], 0x36
mov dword [ebp - 8], 0xd7
mov eax, dword [0x421820]
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0x14]
sub ecx, 0x1e
mov dword [ebp - 0x14], ecx
cmp dword [ebp - 0x14], 0xd3
ja case.0x40e500.1
mov edx, dword [ebp - 0x14]
movzx eax, byte [edx + 0x40ec68]
jmp dword [eax*4 + 0x40ec44]
mov ecx, dword [ebp - 4]
push ecx
call fcn.00418e94
add esp, 4
push fcn.00418e94
mov edx, dword [0x4217e4]
push edx
call fcn.00415df4
add esp, 8
push fcn.0040bf14
mov eax, dword [0x42180c]
push eax
call fcn.00415df4
add esp, 8
jmp 0x40e669
mov dword [ebp - 0x74], 0x55
mov ecx, dword [0x42181c]
imul ecx, dword [ebp - 0x74]
mov dword [0x4217e4], ecx
mov edx, dword [0x421818]
push edx
call fcn.0040bf14
add esp, 4
jmp 0x40e669
mov eax, dword [0x4217f8]
xor eax, dword [0x42180c]
mov dword [0x421820], eax
push fcn.00418e94
mov ecx, dword [ebp - 4]
push ecx
call fcn.00415df4
add esp, 8
jmp 0x40e669
mov dword [ebp - 0x84], 0x3d
mov edx, dword [0x4217f4]
push edx
call dword [sym.imp.KERNEL32.dll_SetUnhandledExceptionFilter]
mov dword [0x421820], eax
push fcn.00418e94
mov eax, dword [ebp - 0x10]
push eax
call fcn.00415df4
add esp, 8
mov ecx, dword [ebp - 0x10]
push ecx
call fcn.0040bf14
add esp, 4
jmp 0x40e669
mov dword [ebp - 0x88], 0xca
mov edx, dword [ebp - 0x2c]
push edx
call fcn.0040bf14
add esp, 4
jmp 0x40e669
mov dword [ebp - 0x8c], 0x14
mov eax, dword [ebp - 0x10]
push eax
call fcn.00418e94
add esp, 4
mov ecx, dword [str.AJ]
push ecx
mov edx, dword [0x42180c]
push edx
call dword [sym.imp.OLEAUT32.dll_SafeArrayAllocDescriptor]
mov dword [0x4217f8], eax
mov eax, dword [0x421818]
push eax
mov ecx, dword [ebp - 0xc]
push ecx
call dword [sym.imp.GDI32.dll_SetArcDirection]
mov dword [ebp - 0x2c], eax
jmp 0x40e669
mov dword [ebp - 0x90], 0xb1
mov edx, dword [0x421824]
push edx
call fcn.0040bf14
add esp, 4
jmp 0x40e669
mov eax, dword [ebp - 4]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileType]
mov dword [0x4217fc], eax
jmp 0x40e669
mov ecx, dword [str.AJ]
push ecx
call dword [sym.imp.KERNEL32.dll_SetUnhandledExceptionFilter]
mov dword [ebp - 0x20], eax
mov edx, dword [0x4217e4]
mov dword [ebp - 0x18], edx
jmp 0x40e67d
mov eax, dword [ebp - 0x18]
add eax, 1
mov dword [ebp - 0x18], eax
mov ecx, dword [ebp - 0x18]
cmp ecx, dword [0x4217f8]
jae 0x40e7fb
push fcn.0040bf14
mov edx, dword [0x42180c]
push edx
call fcn.00415df4
add esp, 8
mov eax, dword [0x4217e8]
sub eax, dword [ebp - 0x54]
mov dword [0x421824], eax
mov eax, dword [0x421800]
xor edx, edx
div dword [str.AJ]
cmp dword [0x421824], eax
jne 0x40e6cb
mov dword [ebp - 0x30], 1
jmp 0x40e6d2
mov dword [ebp - 0x30], 0
mov ecx, dword [ebp - 0x20]
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileType]
test eax, eax
je 0x40e6fe
mov edx, dword [0x421804]
push edx
mov eax, dword [ebp - 0x18]
push eax
call dword [sym.imp.GDI32.dll_SelectObject]
test eax, eax
je 0x40e6fe
mov dword [ebp - 0x34], 1
jmp 0x40e705
mov dword [ebp - 0x34], 0
mov ecx, dword [ebp - 0x30]
cmp ecx, dword [ebp - 0x34]
jbe 0x40e716
mov dword [ebp - 0x38], 1
jmp 0x40e71d
mov dword [ebp - 0x38], 0
cmp dword [ebp - 0x38], 0
jne 0x40e763
push fcn.00418e94
mov edx, dword [ebp - 0x94]
push edx
call fcn.00415df4
add esp, 8
test eax, eax
je 0x40e756
mov eax, dword [0x421820]
push eax
call fcn.00418e94
add esp, 4
test eax, eax
je 0x40e756
mov dword [ebp - 0x3c], 1
jmp 0x40e75d
mov dword [ebp - 0x3c], 0
cmp dword [ebp - 0x3c], 0
je 0x40e79f
push fcn.0040bf14
mov ecx, dword [0x4217e4]
push ecx
call fcn.00415df4
add esp, 8
mov edx, dword [ebp - 0x50]
push edx
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.OLEAUT32.dll_SafeArrayAllocDescriptor]
mov dword [0x42180c], eax
mov ecx, dword [0x421808]
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileType]
mov dword [ebp - 4], eax
jmp 0x40e6a0
mov edx, dword [0x421820]
mov dword [0x421818], edx
mov eax, dword [0x421818]
mov dword [ebp - 0x20], eax
mov ecx, dword [ebp - 8]
push ecx
call fcn.00418e94
add esp, 4
cmp dword [ebp - 0x20], eax
jne 0x40e7e7
mov dword [ebp - 0x98], 0x95
mov dword [ebp - 0x9c], 0x70
mov edx, dword [ebp - 0x28]
push edx
call dword [sym.imp.USER32.dll_GetMenuItemCount]
mov dword [ebp - 0xc], eax
jmp 0x40e79f
mov eax, dword [ebp - 4]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileType]
mov dword [0x421824], eax
jmp 0x40e674
mov ecx, dword [0x42180c]
push ecx
mov edx, dword [ebp - 0xc]
push edx
mov eax, dword [0x421824]
push eax
mov ecx, dword [0x421814]
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [ebp + 0xc], eax
mov edx, dword [ebp - 8]
mov dword [ebp - 0x24], edx
jmp 0x40e82d
mov eax, dword [ebp - 0x24]
add eax, 1
mov dword [ebp - 0x24], eax
mov ecx, dword [ebp - 0x24]
cmp ecx, dword [ebp + 0xc]
jae 0x40e864
mov dword [ebp - 0xa0], 0xb
mov dword [ebp - 0x78], 0xab
mov edx, dword [0x4217f0]
push edx
call fcn.00418e94
add esp, 4
mov eax, dword [ebp - 0x28]
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [ebp - 0x78], eax
jmp 0x40e824
mov ecx, dword [ebp - 0x1c]
and ecx, dword [ebp - 0x7c]
mov dword [ebp - 0x70], ecx
mov edx, dword [ebp + 8]
push edx
mov eax, dword [ebp - 0x1c]
push eax
call dword [sym.imp.GDI32.dll_SetArcDirection]
cmp eax, dword [ebp - 0x70]
je 0x40e889
mov dword [ebp - 0x40], 1
jmp 0x40e890
mov dword [ebp - 0x40], 0
mov esi, dword [ebp - 0x10]
imul esi, dword [ebp - 4]
mov ecx, dword [0x421804]
push ecx
call fcn.00418e94
add esp, 4
cmp esi, eax
je 0x40e8b3
mov dword [ebp - 0x44], 1
jmp 0x40e8ba
mov dword [ebp - 0x44], 0
mov edx, dword [ebp - 0x40]
cmp edx, dword [ebp - 0x44]
jbe 0x40e8cb
mov dword [ebp - 0x48], 1
jmp 0x40e8d2
mov dword [ebp - 0x48], 0
mov eax, dword [0x4217fc]
push eax
call fcn.0040bf14
add esp, 4
test eax, eax
jne 0x40e900
push fcn.0040bf14
mov ecx, dword [ebp - 0x28]
push ecx
call dword [ebp + 0xc]
add esp, 8
test eax, eax
jne 0x40e900
mov dword [ebp - 0x4c], 0
jmp 0x40e907
mov dword [ebp - 0x4c], 1
mov edx, dword [ebp - 0x48]
cmp edx, dword [ebp - 0x4c]
je 0x40eb2a
push fcn.0040bf14
mov eax, dword [0x42180c]
push eax
call fcn.00415df4
add esp, 8
test eax, eax
jne 0x40e93e
mov ecx, dword [0x421808]
sub ecx, dword [0x4217f0]
mov dword [0x4217f0], ecx
je 0x40e964
mov dword [ebp - 0xa4], 0x74
mov edx, dword [ebp + 0xc]
push edx
call fcn.00418e94
add esp, 4
mov eax, dword [0x421800]
push eax
call fcn.0040bf14
add esp, 4
jmp 0x40e987
mov dword [ebp - 0xa8], 0x84
mov dword [ebp - 0xac], 0x1d
mov ecx, dword [0x421818]
add ecx, dword [ebp - 0x50]
mov dword [0x4217e4], ecx
mov edx, dword [0x4217f0]
push edx
call dword [sym.imp.KERNEL32.dll_GetFileType]
mov dword [0x4217f8], eax
mov eax, dword [0x4217fc]
push eax
call fcn.00418e94
add esp, 4
mov ecx, dword [ebp - 0x50]
push ecx
call dword [sym.imp.KERNEL32.dll_SetUnhandledExceptionFilter]
test eax, eax
je 0x40e9ea
mov edx, dword [0x42181c]
push edx
call fcn.00418e94
add esp, 4
test eax, eax
je 0x40e9ea
mov eax, dword [0x421818]
imul eax, dword [str.AJ]
mov dword [0x4217e0], eax
mov ecx, dword [0x42180c]
mov dword [ebp - 4], ecx
mov edx, dword [ebp - 4]
mov dword [ebp - 4], edx
jmp 0x40ea0f
mov dword [ebp - 0xb0], 0x48
mov eax, dword [ebp - 4]
or eax, dword [ebp - 0x2c]
mov dword [ebp - 0xb4], eax
mov ecx, dword [ebp - 0x2c]
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileType]
mov dword [0x4217f4], eax
mov edx, dword [ebp + 0xc]
add edx, dword [ebp - 8]
mov dword [ebp - 0x54], edx
je 0x40ea31
mov eax, dword [ebp - 8]
imul eax, dword [0x421808]
test eax, eax
je 0x40ea31
mov dword [ebp - 0x58], 1
jmp 0x40ea38
mov dword [ebp - 0x58], 0
cmp dword [ebp - 0x58], 0
je 0x40ea7b
mov ecx, dword [ebp - 0xc]
xor ecx, dword [0x421800]
jne 0x40ea65
mov edx, dword [0x4217f4]
push edx
call fcn.0040bf14
add esp, 4
test eax, eax
jne 0x40ea65
mov dword [ebp - 0x5c], 0
jmp 0x40ea6c
mov dword [ebp - 0x5c], 1
cmp dword [ebp - 0x5c], 0
je 0x40ea7b
mov dword [ebp - 0x60], 1
jmp 0x40ea82
mov dword [ebp - 0x60], 0
cmp dword [ebp - 0x60], 0
jne 0x40eac3
push fcn.00418e94
mov eax, dword [0x42180c]
push eax
call fcn.00415df4
add esp, 8
mov esi, eax
mov ecx, dword [ebp - 0xc]
push ecx
call fcn.0040bf14
add esp, 4
cmp esi, eax
jbe 0x40eab6
mov dword [ebp - 0x64], 1
jmp 0x40eabd
mov dword [ebp - 0x64], 0
cmp dword [ebp - 0x64], 0
je 0x40eaf9
mov dword [ebp - 0xb8], 0x93
mov edx, dword [0x421814]
push edx
call fcn.00418e94
add esp, 4
mov eax, dword [ebp + 8]
imul eax, dword [ebp - 0x1c]
mov dword [0x4217fc], eax
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_SetUnhandledExceptionFilter]
mov dword [0x4217e8], eax
jmp 0x40eb25
mov dword [ebp - 0xbc], 0xd4
mov dword [ebp - 0xc0], 0xa6
mov edx, dword [0x421804]
push edx
call fcn.0040bf14
add esp, 4
call dword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [ebp - 0x1c], eax
jmp 0x40ec2a
mov dword [ebp - 0x80], 0xaa
mov eax, dword [0x4217f0]
and eax, dword [ebp - 0x10]
mov dword [ebp - 0xc], eax
push fcn.00418e94
mov ecx, dword [ebp - 8]
push ecx
call fcn.00415df4
add esp, 8
mov edx, dword [ebp + 8]
push edx
call fcn.00418e94
add esp, 4
mov esi, eax
mov eax, dword [ebp - 0x20]
push eax
call fcn.0040bf14
add esp, 4
cmp esi, eax
jbe 0x40eb74
mov dword [ebp - 0x68], 1
jmp 0x40eb7b
mov dword [ebp - 0x68], 0
cmp dword [ebp - 0x68], 0
jne 0x40ebba
mov eax, dword [ebp - 0xc4]
xor edx, edx
div dword [0x421808]
mov esi, eax
mov ecx, dword [0x4217fc]
push ecx
call fcn.00418e94
add esp, 4
cmp esi, eax
jbe 0x40ebad
mov dword [ebp - 0x6c], 1
jmp 0x40ebb4
mov dword [ebp - 0x6c], 0
cmp dword [ebp - 0x6c], 0
je 0x40ebe2
mov dword [ebp - 0xc8], 0xb2
mov dword [ebp - 0xcc], 0xcd
mov edx, dword [0x4217f0]
xor edx, dword [0x4217e4]
mov dword [0x421804], edx
jmp 0x40ec1b
mov eax, dword [ebp - 0x80]
push eax
mov ecx, dword [ebp - 8]
push ecx
call dword [sym.imp.OLEAUT32.dll_SafeArrayAllocDescriptor]
mov dword [0x4217e0], eax
push fcn.00418e94
mov edx, dword [ebp - 0x70]
push edx
call fcn.00415df4
add esp, 8
mov eax, dword [0x4217e4]
mov ecx, 1
lock xadd dword [eax], ecx
inc ecx
mov dword [str.AJ], ecx
mov edx, dword [0x421820]
and edx, dword [0x421818]
mov dword [ebp - 8], edx
mov eax, dword [ebp + 0xc]
push eax
call fcn.00418e94
add esp, 4
mov eax, dword [ebp + 8]
add eax, dword [0x421800]
pop esi
mov esp, ebp
pop ebp
ret