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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
test ebx, ebx
je 0x413733
xor edx, edx
lea eax, [ebx + 0x1c]
nop dword [eax]
xor edi, edi
mov dword [ebp - 0x1c], eax
inc edx
mov dword [ebp - 4], edi
mov dword [ebp - 8], edx
lea esi, [ebp - 0x1c]
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x14], edi
mov dword [ebp - 0x18], edi
xchg dword [eax], esi
test esi, esi
je 0x41357e
lea ecx, [ebp - 0x1c]
lea eax, [esi + 4]
xchg dword [eax], ecx
or edx, 0xffffffff
lea ecx, [esi + 0xc]
xor eax, eax
lock cmpxchg dword [ecx], edx
test eax, eax
je 0x413542
cmp eax, 0xffffffff
je 0x413542
push eax
call dword [sym.imp.KERNEL32.dll_SetEvent]
xor eax, eax
lea ecx, [ebp - 0x14]
lock xadd dword [ecx], eax
test eax, eax
jne 0x41357e
push eax
push eax
push eax
push eax
call dword [sym.imp.KERNEL32.dll_CreateEventW]
mov esi, eax
test esi, esi
je 0x41357e
mov ecx, esi
lea edx, [ebp - 0x14]
xor eax, eax
lock cmpxchg dword [edx], ecx
test eax, eax
jne 0x413577
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebx + 0x30]
lea ecx, [ebp - 0x1c]
mov dword [ebx + 0x34], eax
call fcn.00412540
nop dword [eax]
lea eax, [ebx + 0x1c]
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x1c], eax
lea esi, [ebp - 0x1c]
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x18], 0
xchg dword [eax], esi
test esi, esi
je 0x413614
lea ecx, [ebp - 0x1c]
lea eax, [esi + 4]
xchg dword [eax], ecx
or edx, 0xffffffff
lea ecx, [esi + 0xc]
xor eax, eax
lock cmpxchg dword [ecx], edx
test eax, eax
je 0x4135d8
cmp eax, 0xffffffff
je 0x4135d8
push eax
call dword [sym.imp.KERNEL32.dll_SetEvent]
xor eax, eax
lea ecx, [ebp - 0x14]
lock xadd dword [ecx], eax
test eax, eax
jne 0x413614
push eax
push eax
push eax
push eax
call dword [sym.imp.KERNEL32.dll_CreateEventW]
mov esi, eax
test esi, esi
je 0x413614
mov ecx, esi
lea edx, [ebp - 0x14]
xor eax, eax
lock cmpxchg dword [edx], ecx
test eax, eax
jne 0x41360d
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov esi, dword [ebx + 0x34]
test esi, esi
je 0x41371d
mov edx, dword [esi + 4]
lea ecx, [ebp - 0x2c]
add edx, 8
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x2c], edx
xor eax, eax
mov dword [ebp - 0x24], 0
mov dword [ebp - 0x28], 0
lock cmpxchg dword [edx], ecx
test eax, eax
je 0x41365f
lea ecx, [ebp - 0x1c]
call fcn.00412540
push 0
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x413590
mov eax, dword [esi + 8]
mov dword [ebx + 0x34], eax
mov edi, dword [esi + 4]
mov eax, dword [edi + 4]
push dword [edi]
mov dword [ebp - 0xc], eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
push 0
push dword [edi]
mov ebx, eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test ebx, ebx
je 0x4136b2
cmp dword [ebp - 8], 4
jg 0x4136b2
lea ecx, [ebp - 0x1c]
call fcn.00412540
lea ecx, [ebp - 0x2c]
call fcn.00412540
mov edi, dword [ebp - 4]
inc edi
push ebx
mov dword [ebp - 4], edi
call dword [ebp - 0xc]
mov ebx, dword [ebp + 8]
add esp, 4
jmp 0x413590
mov ecx, dword [esi + 0x10]
mov eax, dword [esi + 8]
test ecx, ecx
je 0x4136bf
mov dword [ecx + 8], eax
test eax, eax
je 0x4136c6
mov dword [eax + 0x10], ecx
mov ecx, dword [esi]
cmp dword [ecx + 0x30], esi
jne 0x4136d0
mov dword [ecx + 0x30], eax
mov ecx, dword [esi]
cmp dword [ecx + 0x34], esi
jne 0x4136da
mov dword [ecx + 0x34], eax
mov ecx, dword [esi + 0x14]
mov eax, dword [esi + 0xc]
test ecx, ecx
je 0x4136e7
mov dword [ecx + 0xc], eax
test eax, eax
je 0x4136ee
mov dword [eax + 0x14], ecx
mov ecx, dword [esi + 4]
cmp dword [ecx + 0xc], esi
jne 0x4136f9
mov dword [ecx + 0xc], eax
push esi
call fcn.0041c2bf
add esp, 4
lea ecx, [ebp - 0x1c]
call fcn.00412540
lea ecx, [ebp - 0x2c]
call fcn.00412540
mov ebx, dword [ebp + 8]
mov edi, dword [ebp - 4]
jmp 0x413590
lea ecx, [ebp - 0x1c]
call fcn.00412540
mov edx, dword [ebp - 8]
lea eax, [ebx + 0x1c]
test edi, edi
jne 0x413500
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret