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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x10], 0xffffffff
cmp dword [ebp + 0xc], 0
jne 0x4979b0
cmp dword [ebp + 0x10], 0
jne 0x4979a6
mov eax, dword [0x53e318]
test eax, eax
je 0x4979a6
mov eax, dword [0x53e318]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_RemoveVectoredExceptionHandler]
call eax
sub esp, 4
mov dword [0x53e318], 0
call fcn.0049780d
jmp 0x497c35
cmp dword [ebp + 0xc], 1
jne 0x4979d9
mov dword [esp + 4], 0x4970f0
mov dword [esp], 1
mov eax, dword [sym.imp.KERNEL32.dll_AddVectoredExceptionHandler]
call eax
sub esp, 8
mov dword [0x53e318], eax
jmp 0x497c35
cmp dword [ebp + 0xc], 3
jne 0x497c35
mov eax, dword [0x53c384]
cmp eax, 0xffffffff
je 0x497a02
mov eax, dword [0x53c384]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_TlsGetValue]
call eax
sub esp, 4
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
je 0x497ad0
mov eax, dword [ebp - 0xc]
movzx eax, byte [eax + 0x20]
and eax, 0x30
test al, al
je 0x497ad0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0xb4]
mov dword [esp], eax
call fcn.0049877e
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x14]
test eax, eax
je 0x497a7d
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x14]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
sub esp, 4
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
test eax, eax
je 0x497a69
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [eax + 0x18], 0
mov eax, dword [ebp - 0xc]
mov dword [eax + 0x14], 0
mov eax, dword [ebp - 0xc]
add eax, 0x1c
mov dword [esp], eax
call fcn.004b96a9
mov eax, dword [ebp - 0xc]
lea edx, [eax + 0x38]
mov eax, dword [ebp - 0x10]
mov dword [esp + 4], eax
mov dword [esp], edx
call fcn.00497813
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call fcn.00497630
mov dword [ebp - 0xc], 0
mov eax, dword [0x53c384]
mov edx, dword [ebp - 0xc]
mov dword [esp + 4], edx
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_TlsSetValue]
call eax
sub esp, 8
jmp 0x497c35
cmp dword [ebp - 0xc], 0
je 0x497be5
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x68]
test eax, eax
jne 0x497be5
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
test eax, eax
je 0x497b05
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [eax + 0x18], 0
mov eax, dword [ebp - 0xc]
mov dword [eax + 0x68], 1
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0xb4]
mov dword [esp], eax
call fcn.0049877e
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x24]
and eax, 4
test eax, eax
je 0x497bc0
mov eax, dword [ebp - 0xc]
mov dword [eax], 0xdeadbeef
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x14]
test eax, eax
je 0x497b61
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x14]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [eax + 0x14], 0
mov eax, dword [ebp - 0xc]
add eax, 0x1c
mov dword [esp], eax
call fcn.004b96a9
mov eax, dword [ebp - 0xc]
lea edx, [eax + 0x38]
mov eax, dword [ebp - 0x10]
mov dword [esp + 4], eax
mov dword [esp], edx
call fcn.00497813
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call fcn.00497630
mov dword [ebp - 0xc], 0
mov eax, dword [0x53c384]
mov edx, dword [ebp - 0xc]
mov dword [esp + 4], edx
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_TlsSetValue]
call eax
sub esp, 8
mov eax, 1
jmp 0x497c3a
mov eax, dword [ebp - 0xc]
add eax, 0x1c
mov dword [esp], eax
call fcn.004b96a9
mov eax, dword [ebp - 0xc]
lea edx, [eax + 0x38]
mov eax, dword [ebp - 0x10]
mov dword [esp + 4], eax
mov dword [esp], edx
call fcn.00497813
jmp 0x497c35
cmp dword [ebp - 0xc], 0
je 0x497c35
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
test eax, eax
je 0x497c08
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [eax + 0x18], 0
mov eax, dword [ebp - 0xc]
add eax, 0x1c
mov dword [esp], eax
call fcn.004b96a9
mov eax, dword [ebp - 0xc]
lea edx, [eax + 0x38]
mov eax, dword [ebp - 0x10]
mov dword [esp + 4], eax
mov dword [esp], edx
call fcn.00497813
mov eax, 1
leave
ret 0xc