Function at 0x404840
Capabilities:
Get thread local storage value

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x40
mov dword [ebp - 0x1c], esp
mov dword [ebp - 0x10], 0xffffffff
mov dword [ebp - 0x14], 0x41fb00
lea eax, [ebp - 0x18]
mov ecx, dword fs:[0]
mov dword [ebp - 0x18], ecx
mov dword fs:[0], eax
lea eax, [ebp - 0x44]
mov dword [ebp - 0x44], 0x4011f0
mov dword [ebp - 0x4c], eax
mov dword [ebp - 0x48], 0x430fcc
push 0x41f7c0
push 0
call sub.KERNEL32.dll_AddVectoredExceptionHandler
test eax, eax
je 0x404ad5
mov dword [ebp - 0x38], 0x5000
mov ecx, dword [0x43aa14]
test ecx, ecx
jne 0x4048c7
mov ecx, 0x43254a
mov edx, 0x17
call fcn.004123d0
test eax, eax
mov ecx, 0x41f9c0
cmovne ecx, edx
mov eax, ecx
xchg dword [0x43aa14], eax
lea eax, [ebp - 0x38]
push eax
call ecx
test eax, eax
jne 0x4048df
call sub.KERNEL32.dll_GetLastError
cmp eax, 0x78
jne 0x404b95
call sub.KERNEL32.dll_GetProcessHeap
push 4
push 0
push eax
call sub.KERNEL32.dll_HeapAlloc
test eax, eax
je 0x404aee
lea ecx, [ebp - 0x38]
mov dword [eax], 0x6e69616d
mov dword [ebp - 0x38], eax
mov dword [ebp - 0x34], 4
mov dword [ebp - 0x30], 4
call fcn.00412020
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x3c], eax
mov eax, dword [0x43a064]
test eax, eax
jne 0x404939
mov ecx, 0x43a064
mov byte [ebp - 0x21], 1
mov dword [ebp - 0x10], 0
call fcn.00411cb0
push eax
call sub.KERNEL32.dll_TlsGetValue
cmp eax, 2
jb 0x404958
cmp dword [eax], 1
jne 0x404958
add eax, 4
mov ecx, dword [eax]
inc ecx
test ecx, ecx
jg 0x40497b
jmp 0x404aff
mov byte [ebp - 0x21], 1
mov dword [ebp - 0x10], 0
call fcn.00411e00
test eax, eax
je 0x404b78
mov ecx, dword [eax]
inc ecx
test ecx, ecx
jle 0x404aff
cmp dword [eax + 4], 0
jne 0x404b1c
mov eax, dword [ebp - 0x28]
mov dword [ebp - 0x38], eax
mov eax, dword [0x43a064]
test eax, eax
jne 0x4049a9
mov ecx, 0x43a064
mov byte [ebp - 0x22], 1
mov dword [ebp - 0x10], 1
call fcn.00411cb0
push eax
call sub.KERNEL32.dll_TlsGetValue
cmp eax, 2
jb 0x4049c6
cmp dword [eax], 1
jne 0x4049c6
add eax, 4
cmp dword [eax], 0
je 0x4049e7
jmp 0x404b40
mov byte [ebp - 0x22], 1
mov dword [ebp - 0x10], 1
call fcn.00411e00
test eax, eax
je 0x404b5d
cmp dword [eax], 0
jne 0x404b40
mov dword [eax], 0xffffffff
mov dword [ebp - 0x2c], eax
mov eax, dword [eax + 4]
test eax, eax
je 0x404a0e
lock dec dword [eax]
jne 0x404a0e
mov eax, dword [ebp - 0x2c]
mov dword [ebp - 0x10], 2
lea ecx, [eax + 4]
call fcn.00412270
mov eax, dword [ebp - 0x28]
mov ecx, dword [ebp - 0x2c]
mov dword [ecx + 4], eax
inc dword [ecx]
mov dword [ebp - 0x10], 3
mov ecx, dword [ebp - 0x4c]
mov edx, dword [ebp - 0x48]
call fcn.0041fa80
mov dword [ebp - 0x34], eax
xor eax, eax
mov dword [ebp - 0x38], eax
mov eax, dword [0x43aa0c]
cmp eax, 3
je 0x404a67
lea eax, [ebp - 0x20]
mov byte [ebp - 0x20], 1
mov byte [ebp - 0x23], 1
mov dword [ebp - 0x10], 5
lea edx, [ebp - 0x3c]
mov ecx, 0x43aa0c
mov dword [ebp - 0x3c], eax
push 0x432454
call fcn.0041e9b0
add esp, 4
mov eax, dword [ebp - 0x38]
mov ecx, dword [ebp - 0x34]
mov esi, 0x65
cmp eax, 1
cmovne esi, ecx
test eax, eax
je 0x404ac2
mov eax, dword [ebp - 0x30]
mov dword [ebp - 0x40], esi
mov dword [ebp - 0x10], 6
mov dword [ebp - 0x28], ecx
push ecx
mov dword [ebp - 0x2c], eax
call dword [eax]
add esp, 4
mov eax, dword [ebp - 0x2c]
mov esi, dword [ebp - 0x40]
mov edi, dword [ebp - 0x28]
cmp dword [eax + 4], 0
je 0x404ac2
cmp dword [eax + 8], 9
jae 0x404ab2
call sub.KERNEL32.dll_GetProcessHeap
push edi
jmp 0x404aba
call sub.KERNEL32.dll_GetProcessHeap
push dword [edi - 4]
push 0
push eax
call sub.KERNEL32.dll_HeapFree
mov eax, dword [ebp - 0x18]
mov dword fs:[0], eax
mov eax, esi
add esp, 0x40
pop esi
pop edi
pop ebx
pop ebp
ret
mov ecx, str.failed_to_install_exception_handler
mov edx, 0x23
push 0x4325cc
call fcn.00413080
add esp, 4
ud2
mov ecx, 4
mov edx, 1
call fcn.00404cd0
ud2
lea eax, [ebp - 0x20]
mov ecx, 0x431313
mov edx, 0x18
push 0x43132c
push eax
call fcn.00408870
add esp, 8
ud2
mov byte [ebp - 0x21], 1
mov dword [ebp - 0x10], 0
mov ecx, 0x4324bc
mov edx, 0x26
push 0x4324e4
call fcn.00413080
add esp, 4
ud2
lea eax, [ebp - 0x20]
mov ecx, str.already_borrowedP
mov edx, 0x10
push 0x43134c
push eax
call fcn.00408870
add esp, 8
ud2
mov eax, dword [ebp - 0x28]
lock dec dword [eax]
jne 0x404b78
lea ecx, [ebp - 0x38]
mov byte [ebp - 0x21], 0
mov dword [ebp - 0x10], 0
call fcn.00412270
lea eax, [ebp - 0x20]
mov ecx, str.cannot_access_a_TLS_value_during_or_after_it_is_destroyed
mov edx, 0x39
push 0x4315ac
push eax
call fcn.00408870
add esp, 8
ud2
mov ecx, 0x432561
mov edx, 0x34
push 0x432598
call fcn.00413080
add esp, 4
ud2