Function at 0x508620
Capabilities:
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x644f90
mov eax, dword fs:[0]
push eax
push ecx
push ebx
push esi
push edi
mov eax, dword [0x6e1c7c]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, ecx
mov dword [edi], vtable.nbase::MessageLoop.0
xor esi, esi
mov ecx, edi
call fcn.00508be0
mov ecx, edi
call fcn.00509520
mov ecx, edi
call fcn.00508be0
test al, al
je 0x50866f
inc esi
cmp esi, 0x64
jl 0x508650
lea esi, [edi + 0x9c]
xor ebx, ebx
test esi, esi
je 0x50867e
inc dword [esi + 4]
mov edx, dword [edi + 0xa8]
mov eax, edx
mov ecx, dword [edi + 0xa4]
sub eax, ecx
sar eax, 2
test eax, eax
je 0x5086cc
mov eax, edx
sub eax, ecx
sar eax, 2
cmp ebx, eax
jb 0x5086a3
inc ebx
jmp 0x5086c1
mov eax, dword [ecx + ebx*4]
inc ebx
mov dword [ebp - 0x10], eax
test eax, eax
je 0x5086c1
mov eax, dword [eax]
mov ecx, dword [ebp - 0x10]
call dword [eax]
mov edx, dword [edi + 0xa8]
mov ecx, dword [edi + 0xa4]
mov eax, edx
sub eax, ecx
sar eax, 2
cmp ebx, eax
jb 0x508695
mov dword [ebp - 4], 0
test esi, esi
je 0x5086e6
dec dword [esi + 4]
cmp dword [esi + 4], 1
jge 0x5086e6
mov eax, dword [esi]
mov ecx, esi
call dword [eax]
mov dword [ebp - 4], 0xffffffff
mov ebx, dword [edi + 0xb0]
mov eax, dword [ebx]
mov edx, dword [eax + 0x18]
cmp eax, vtable.nbase::MessageLoopProxy.0
jne 0x508b73
lea esi, [ebx + 0xc]
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [ebx + 0x24], 0
test esi, esi
je 0x50871f
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [edi + 0xb0], 0
or ebx, 0xffffffff
mov esi, dword [edi + 0xb4]
mov dword [edi + 0xb4], 0
test esi, esi
je 0x50875f
mov eax, ebx
lock xadd dword [esi + 4], eax
jne 0x50875f
mov eax, dword [esi]
mov ecx, esi
call dword [eax]
mov eax, ebx
lock xadd dword [esi + 8], eax
jne 0x50875f
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 4]
call fcn.00509c30
push 0
push dword [eax]
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov esi, dword [edi + 0xb4]
test esi, esi
je 0x508797
mov eax, ebx
lock xadd dword [esi + 4], eax
jne 0x508797
mov eax, dword [esi]
mov ecx, esi
call dword [eax]
mov eax, ebx
lock xadd dword [esi + 8], eax
jne 0x508797
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 4]
mov eax, dword [edi + 0xa4]
test eax, eax
je 0x5087f2
mov ecx, dword [edi + 0xac]
sub ecx, eax
and ecx, 0xfffffffc
cmp ecx, 0x1000
jb 0x5087ca
mov edx, dword [eax - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x508b6e
mov eax, edx
push ecx
push eax
call fcn.0060223e
mov dword [edi + 0xa4], 0
add esp, 8
mov dword [edi + 0xa8], 0
mov dword [edi + 0xac], 0
mov eax, dword [edi + 0x90]
test eax, eax
je 0x50884d
mov ecx, dword [edi + 0x98]
sub ecx, eax
and ecx, 0xfffffffc
cmp ecx, 0x1000
jb 0x508825
mov edx, dword [eax - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x508b6e
mov eax, edx
push ecx
push eax
call fcn.0060223e
mov dword [edi + 0x90], 0
add esp, 8
mov dword [edi + 0x94], 0
mov dword [edi + 0x98], 0
mov ecx, dword [edi + 0x6c]
test ecx, ecx
je 0x5088c4
mov edx, dword [edi + 0x70]
push ecx
call fcn.0050a4a0
mov ecx, dword [edi + 0x74]
mov eax, 0x92492493
mov esi, dword [edi + 0x6c]
add esp, 4
sub ecx, esi
imul ecx
add edx, ecx
sar edx, 5
mov eax, edx
shr eax, 0x1f
add eax, edx
lea ecx, [eax*8]
sub ecx, eax
shl ecx, 3
cmp ecx, 0x1000
jb 0x5088a5
mov edx, dword [esi - 4]
add ecx, 0x23
sub esi, edx
lea eax, [esi - 4]
cmp eax, 0x1f
ja 0x508b6e
mov esi, edx
push ecx
push esi
call fcn.0060223e
mov dword [edi + 0x6c], 0
add esp, 8
mov dword [edi + 0x70], 0
mov dword [edi + 0x74], 0
mov ecx, dword [edi + 0x68]
test ecx, ecx
je 0x508915
nop dword [eax + eax]
mov eax, dword [edi + 0x64]
dec eax
add ecx, eax
mov eax, dword [edi + 0x60]
dec eax
and ecx, eax
mov eax, dword [edi + 0x5c]
mov esi, dword [eax + ecx*4]
mov ecx, dword [esi + 0x34]
add esi, 0x10
test ecx, ecx
je 0x508901
mov edx, dword [ecx]
cmp ecx, esi
setne al
movzx eax, al
push eax
call dword [edx + 0x10]
mov dword [esi + 0x24], 0
add dword [edi + 0x68], 0xffffffff
jne 0x50890e
mov dword [edi + 0x64], 0
mov ecx, dword [edi + 0x68]
test ecx, ecx
jne 0x5088d0
mov esi, dword [edi + 0x60]
test esi, esi
je 0x50893a
nop dword [eax]
mov eax, dword [edi + 0x5c]
dec esi
mov eax, dword [eax + esi*4]
test eax, eax
je 0x508936
push 0x38
push eax
call fcn.0060223e
add esp, 8
test esi, esi
jne 0x508920
mov eax, dword [edi + 0x5c]
test eax, eax
je 0x50896f
mov ecx, dword [edi + 0x60]
shl ecx, 2
cmp ecx, 0x1000
jb 0x508965
mov edx, dword [eax - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x508b6e
mov eax, edx
push ecx
push eax
call fcn.0060223e
add esp, 8
mov dword [edi + 0x60], 0
mov dword [edi + 0x5c], 0
push 8
push dword [edi + 0x58]
call fcn.0060223e
mov dword [edi + 0x58], 0
add esp, 8
mov ecx, dword [edi + 0x54]
test ecx, ecx
je 0x5089e9
mov edx, ecx
nop word [eax + eax]
mov eax, dword [edi + 0x50]
dec eax
add ecx, eax
mov eax, dword [edi + 0x4c]
dec eax
and ecx, eax
mov eax, dword [edi + 0x48]
mov esi, dword [eax + ecx*4]
mov ecx, dword [esi + 0x34]
add esi, 0x10
test ecx, ecx
je 0x5089d4
mov edx, dword [ecx]
cmp ecx, esi
setne al
movzx eax, al
push eax
call dword [edx + 0x10]
mov dword [esi + 0x24], 0
mov edx, dword [edi + 0x54]
lea eax, [edx - 1]
mov dword [edi + 0x54], eax
test eax, eax
jne 0x5089e1
mov dword [edi + 0x50], eax
mov ecx, eax
mov edx, eax
test ecx, ecx
jne 0x5089a0
mov esi, dword [edi + 0x4c]
test esi, esi
je 0x508a0a
mov eax, dword [edi + 0x48]
dec esi
mov eax, dword [eax + esi*4]
test eax, eax
je 0x508a06
push 0x38
push eax
call fcn.0060223e
add esp, 8
test esi, esi
jne 0x5089f0
mov eax, dword [edi + 0x48]
test eax, eax
je 0x508a3f
mov ecx, dword [edi + 0x4c]
shl ecx, 2
cmp ecx, 0x1000
jb 0x508a35
mov edx, dword [eax - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x508b6e
mov eax, edx
push ecx
push eax
call fcn.0060223e
add esp, 8
mov dword [edi + 0x4c], 0
mov dword [edi + 0x48], 0
push 8
push dword [edi + 0x44]
call fcn.0060223e
add esp, 8
mov dword [edi + 0x44], 0
lea eax, [edi + 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
mov ecx, dword [edi + 0x28]
test ecx, ecx
je 0x508abd
mov edx, ecx
mov eax, dword [edi + 0x24]
dec eax
add ecx, eax
mov eax, dword [edi + 0x20]
dec eax
and ecx, eax
mov eax, dword [edi + 0x1c]
mov esi, dword [eax + ecx*4]
mov ecx, dword [esi + 0x34]
add esi, 0x10
test ecx, ecx
je 0x508aa8
mov edx, dword [ecx]
cmp ecx, esi
setne al
movzx eax, al
push eax
call dword [edx + 0x10]
mov dword [esi + 0x24], 0
mov edx, dword [edi + 0x28]
lea eax, [edx - 1]
mov dword [edi + 0x28], eax
test eax, eax
jne 0x508ab5
mov dword [edi + 0x24], eax
mov ecx, eax
mov edx, eax
test ecx, ecx
jne 0x508a74
mov esi, dword [edi + 0x20]
test esi, esi
je 0x508ade
mov eax, dword [edi + 0x1c]
dec esi
mov eax, dword [eax + esi*4]
test eax, eax
je 0x508ada
push 0x38
push eax
call fcn.0060223e
add esp, 8
test esi, esi
jne 0x508ac4
mov eax, dword [edi + 0x1c]
test eax, eax
je 0x508b0f
mov ecx, dword [edi + 0x20]
shl ecx, 2
cmp ecx, 0x1000
jb 0x508b05
mov edx, dword [eax - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x508b6e
mov eax, edx
push ecx
push eax
call fcn.0060223e
add esp, 8
mov dword [edi + 0x20], 0
mov dword [edi + 0x1c], 0
push 8
push dword [edi + 0x18]
call fcn.0060223e
mov dword [edi + 0x18], 0
add esp, 8
mov esi, dword [edi + 0x10]
test esi, esi
je 0x508b56
mov eax, ebx
lock xadd dword [esi + 4], eax
jne 0x508b56
mov eax, dword [esi]
mov ecx, esi
call dword [eax]
lock xadd dword [esi + 8], ebx
dec ebx
jne 0x508b56
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 4]
mov dword [edi], vtable.nbase::MessagePump::Delegate.0
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
call fcn.00621ffe
mov ecx, ebx
call edx
jmp 0x50871f