Function at 0x517bf0
Capabilities:
Get thread local storage value

Disassembly:
sub esp, 0x18
push ebx
mov ebx, eax
push edi
mov edi, ebx
call fcn.004efa10
fld dword [ebx + 0x98]
fld dword [ebx + 0x8c]
lea edi, [ebx + 0x98]
lea edx, [ebx + 0x8c]
fucompp
mov ecx, eax
mov dword [esp + 0xc], ecx
mov dword [esp + 0x14], edi
fnstsw ax
mov dword [esp + 0x1c], edx
test ah, 0x44
jp 0x517c4b
fld dword [edi + 4]
fld dword [edx + 4]
fucompp
fnstsw ax
test ah, 0x44
jp 0x517c4b
fld dword [edi + 8]
fld dword [edx + 8]
fucompp
fnstsw ax
test ah, 0x44
jnp 0x517c58
push 0
mov eax, ebx
call fcn.00518950
test al, al
je 0x517c66
mov al, byte [ebx + 0xcd]
test al, al
je 0x5180a9
mov eax, dword [0x728c28]
cmp eax, 0xffffffff
push ebp
push esi
mov esi, dword [ebx + 0xf4]
je 0x517c8f
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517c8f
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517c98
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [0x728c28]
cmp eax, 0xffffffff
mov esi, dword [ebx + 0xec]
je 0x517cbf
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517cbf
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517cc8
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov esi, dword [ebx + 0x13c]
test esi, esi
mov ebp, dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov dword [esp + 0x10], esi
je 0x517e82
mov ecx, dword [esp + 0x14]
mov eax, dword [esi + 8]
mov edi, dword [eax]
push ecx
push 3
call fcn.00518b50
test al, al
jne 0x517e70
lea esi, [ebx + 0x138]
lea ecx, [esp + 0x10]
call fcn.00507ce0
mov edi, eax
mov ecx, dword [edi + 4]
mov esi, dword [edi]
mov ebp, dword [ecx + 0x7c]
mov eax, dword [esi + 0x24]
xor edx, edx
dec ebp
div ebp
xor edx, edx
add ecx, 0x14
mov ebp, eax
mov eax, dword [ecx + 0x6c]
dec eax
mov dword [esp + 0x18], eax
mov eax, dword [esi + 0x28]
mov esi, dword [esp + 0x18]
div esi
mov dword [esp + 0x20], ebp
push eax
push ebp
push ecx
mov dword [esp + 0x24], eax
push str.Queueing_cell__landscape_s__x_d__y_d__for_unloading
mov eax, 3
call fcn.00516e70
mov eax, dword [0x728c28]
mov esi, dword [ebx + 0xdc]
add esp, 0x10
cmp eax, 0xffffffff
je 0x517d76
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517d76
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517d7f
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov edx, dword [ebx + 0x108]
lea esi, [ebx + 0x108]
mov ecx, esi
call dword [edx + 4]
mov dword [eax + 8], edi
mov dword [eax], 0
mov ecx, dword [esi + 8]
mov dword [eax + 4], ecx
mov ecx, dword [esi + 8]
test ecx, ecx
je 0x517daa
mov dword [ecx], eax
jmp 0x517dad
mov dword [esi + 4], eax
mov edx, dword [esi + 0xc]
inc edx
mov dword [esi + 8], eax
mov dword [esi + 0xc], edx
mov ebp, dword [edi + 4]
mov edx, dword [ebx + 0x170]
lea esi, [ebx + 0x170]
push ebp
mov ecx, esi
call dword [edx + 4]
mov ecx, dword [esi + 8]
mov edi, dword [ecx + eax*4]
test edi, edi
je 0x517dec
mov eax, dword [edi + 4]
mov edx, dword [esi]
push eax
push ebp
mov ecx, esi
call dword [edx + 8]
test al, al
jne 0x517e37
mov edi, dword [edi]
test edi, edi
jne 0x517dd6
push ebp
push str.Context_expected__but_not_found_for_0x_x
mov eax, 2
call fcn.00516e70
add esp, 8
xor edi, edi
movzx edx, word [esp + 0x20]
movzx eax, word [esp + 0x18]
shl edx, 0x10
or edx, eax
push edx
lea esi, [edi + 0x10]
call fcn.004ff2b0
mov ecx, dword [edi + 0x20]
mov edx, dword [ecx + 0x38]
mov ebp, dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push edx
call ebp
mov eax, dword [ebx + 0xdc]
push eax
call ebp
mov esi, dword [esp + 0x10]
jmp 0x517e76
mov edi, dword [edi + 8]
test edi, edi
je 0x517dec
mov eax, dword [0x728c28]
cmp eax, 0xffffffff
mov ecx, dword [edi + 0x20]
mov esi, dword [ecx + 0x38]
je 0x517e65
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517e65
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517e01
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
jmp 0x517e01
mov esi, dword [esi]
mov dword [esp + 0x10], esi
test esi, esi
jne 0x517ce0
mov edi, dword [esp + 0x1c]
mov ecx, dword [ebx + 0xec]
push ecx
call ebp
mov edx, dword [ebx + 0xf4]
push edx
call ebp
mov ecx, dword [ebx + 0x80]
xor eax, eax
test ecx, ecx
mov dword [esp + 0x18], eax
jbe 0x51808c
mov ecx, dword [ebx + 0x78]
mov edi, dword [ecx + eax*4]
test edi, edi
je 0x518071
mov al, byte [edi + 0xa0]
test al, al
mov esi, dword [esp + 0x14]
je 0x518039
push 1
mov eax, edi
mov edx, esi
mov ecx, ebx
call fcn.005189d0
test al, al
jne 0x518039
mov eax, dword [0x728c28]
cmp eax, 0xffffffff
mov esi, dword [ebx + 0xec]
je 0x517f04
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517f04
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517f0d
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov edx, dword [ebx + 0x128]
lea esi, [ebx + 0x128]
mov ecx, esi
call dword [edx + 4]
mov dword [eax + 8], edi
mov dword [eax], 0
mov ecx, dword [esi + 8]
mov dword [eax + 4], ecx
mov ecx, dword [esi + 8]
test ecx, ecx
je 0x517f38
mov dword [ecx], eax
jmp 0x517f3b
mov dword [esi + 4], eax
mov edx, dword [esi + 0xc]
inc edx
mov dword [esi + 8], eax
mov dword [esi + 0xc], edx
mov eax, dword [0x728c28]
cmp eax, 0xffffffff
mov esi, dword [ebx + 0xdc]
je 0x517f6c
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517f6c
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517f75
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [ebx + 0x10c]
test eax, eax
mov dword [esp + 0x10], eax
je 0x517faf
mov ecx, dword [eax + 8]
cmp dword [ecx], 0
je 0x517fa5
cmp dword [ecx + 4], edi
jne 0x517fa5
lea esi, [ebx + 0x108]
lea ecx, [esp + 0x10]
call fcn.00507ce0
mov eax, dword [esp + 0x10]
jmp 0x517fab
mov eax, dword [eax]
mov dword [esp + 0x10], eax
test eax, eax
jne 0x517f83
mov eax, dword [0x728c28]
cmp eax, 0xffffffff
mov esi, dword [ebx + 0xf4]
je 0x517fd6
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x517fd6
or edx, 0xffffffff
mov ecx, esi
call fcn.004fc390
jmp 0x517fdf
push 0xffffffffffffffff
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [ebx + 0x13c]
test eax, eax
mov dword [esp + 0x10], eax
je 0x51801c
lea ecx, [ecx]
mov ecx, dword [eax + 8]
cmp dword [ecx], 0
je 0x518012
cmp dword [ecx + 4], edi
jne 0x518012
lea esi, [ebx + 0x138]
lea ecx, [esp + 0x10]
call fcn.00507ce0
mov eax, dword [esp + 0x10]
jmp 0x518018
mov eax, dword [eax]
mov dword [esp + 0x10], eax
test eax, eax
jne 0x517ff0
mov edx, dword [ebx + 0xf4]
push edx
call ebp
mov eax, dword [ebx + 0xdc]
push eax
call ebp
mov ecx, dword [ebx + 0xec]
push ecx
call ebp
jmp 0x518071
mov al, byte [edi + 0xa0]
test al, al
jne 0x518069
push 2
mov eax, edi
mov edx, esi
mov ecx, ebx
call fcn.005189d0
cmp al, 1
jne 0x518071
mov eax, edi
mov ecx, ebx
call fcn.0051b0f0
test al, al
jne 0x518069
push ebx
mov eax, edi
call fcn.0051aff0
push esi
push edi
push ebx
call fcn.005180b0
mov eax, dword [esp + 0x18]
mov ecx, dword [ebx + 0x80]
inc eax
cmp eax, ecx
mov dword [esp + 0x18], eax
jb 0x517ea8
mov edi, dword [esp + 0x1c]
mov eax, dword [ebx + 0x70]
test eax, eax
pop esi
pop ebp
jne 0x5180a9
mov eax, dword [esp + 0x1c]
mov edx, dword [eax]
mov ecx, dword [eax + 4]
mov dword [edi], edx
mov edx, dword [eax + 8]
mov dword [edi + 4], ecx
mov dword [edi + 8], edx
pop edi
pop ebx
add esp, 0x18
ret