Function at 0x508f00
Capabilities:
Get thread local storage value

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
mov eax, dword [ebp + 0xc]
sub esp, 0xc
push esi
mov esi, dword [edi + 0x14]
cmp eax, esi
jb 0x508f29
mov ecx, dword [edi + 0x10]
lea edx, [esi + ecx*4]
cmp eax, edx
jae 0x508f29
mov eax, 0x8007054f
pop esi
mov esp, ebp
pop ebp
ret 0x10
mov ecx, dword [eax]
mov eax, dword [ecx + 0x10]
mov edx, dword [edi + 0x10]
cmp eax, edx
jae 0x508f3f
cmp dword [esi + eax*4], ecx
jne 0x508f3f
mov dword [ebp - 4], eax
jmp 0x508f5d
mov eax, edx
test eax, eax
jbe 0x508f54
lea esi, [esi + eax*4]
sub esi, 4
dec eax
cmp dword [esi], ecx
je 0x508f55
test eax, eax
ja 0x508f48
dec eax
mov dword [ebp - 4], eax
cmp eax, 0xffffffff
je 0x508f1d
mov esi, dword [ebp + 8]
mov eax, 1
push ebx
cmp esi, eax
jbe 0x508f92
mov ecx, dword [edi + 0x14]
mov ebx, dword [ebp - 4]
lea ecx, [ecx + ebx*4 + 4]
mov ebx, dword [ebp - 4]
add ebx, eax
cmp ebx, edx
jae 0x508fcb
mov edx, dword [ecx]
mov ebx, dword [ebp + 0xc]
cmp edx, dword [ebx + eax*4]
jne 0x508fcb
mov edx, dword [edi + 0x10]
inc eax
add ecx, 4
cmp eax, esi
jb 0x508f74
mov ecx, dword [ebp + 0x10]
mov ebx, dword [ecx + 0x10]
cmp ebx, edx
jae 0x508fa4
mov eax, dword [edi + 0x14]
cmp dword [eax + ebx*4], ecx
je 0x508fc2
mov ebx, edx
test ebx, ebx
jbe 0x508fbc
mov eax, dword [edi + 0x14]
lea eax, [eax + ebx*4]
sub eax, 4
dec ebx
cmp dword [eax], ecx
je 0x508fbd
test ebx, ebx
ja 0x508fb0
dec ebx
cmp ebx, 0xffffffff
je 0x508fcb
mov ecx, dword [ebp + 0x14]
sub edx, ebx
cmp ecx, edx
jbe 0x508fd8
pop ebx
mov eax, 0x8007054f
pop esi
mov esp, ebp
pop ebp
ret 0x10
test ecx, ecx
jbe 0x509053
lea eax, [ebx*4]
mov dword [ebp + 0x10], eax
mov dword [ebp - 8], ecx
lea esp, [esp]
mov ecx, dword [edi + 0x14]
mov edx, dword [ebp + 0x10]
mov esi, dword [edx + ecx]
test esi, esi
je 0x509043
call fcn.0050a890
mov eax, dword [0x551d48]
test eax, eax
jl 0x509043
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [ebp - 0xc], eax
test eax, eax
je 0x509043
push 0x44
push 0xfe
push esi
call sub.msvcrt.dll_memset
mov ecx, dword [ebp - 0xc]
mov dword [esi], 0
mov eax, dword [ecx + 0x18]
add esp, 0xc
test eax, eax
je 0x50903d
mov dword [eax], esi
jmp 0x509040
mov dword [ecx + 0x14], esi
mov dword [ecx + 0x18], esi
add dword [ebp + 0x10], 4
sub dword [ebp - 8], 1
jne 0x508ff0
mov esi, dword [ebp + 8]
mov ecx, dword [ebp + 0x14]
mov eax, dword [ebp - 4]
lea edx, [eax + esi]
mov eax, dword [edi + 0x10]
cmp edx, eax
jae 0x509087
sub eax, dword [ebp - 4]
mov ecx, dword [edi + 0x14]
sub eax, esi
add eax, eax
add eax, eax
push eax
mov eax, dword [ebp - 4]
lea edx, [ecx + edx*4]
push edx
lea ecx, [ecx + eax*4]
push ecx
call sub.msvcrt.dll_memmove
mov ecx, dword [ebp + 0x14]
add esp, 0xc
or dword [edi + 0x18], 1
sub dword [edi + 0x10], esi
mov eax, dword [edi + 0x10]
cmp esi, ecx
je 0x5090ba
mov edx, dword [edi + 0x14]
sub eax, ebx
sub eax, ecx
add eax, eax
add eax, eax
push eax
lea eax, [ebx + ecx]
lea ecx, [edx + eax*4]
push ecx
lea eax, [ebx + esi]
lea ecx, [edx + eax*4]
push ecx
call sub.msvcrt.dll_memmove
mov ecx, dword [ebp + 0x14]
add esp, 0xc
or dword [edi + 0x18], 1
xor eax, eax
test esi, esi
jbe 0x5090ee
lea ecx, [ebx*4]
mov esi, dword [ebp + 0xc]
mov esi, dword [esi + eax*4]
lea edx, [eax + ebx]
mov dword [esi + 0x10], edx
mov esi, dword [ebp + 0xc]
mov esi, dword [esi + eax*4]
mov edx, dword [edi + 0x14]
mov dword [ecx + edx], esi
inc eax
add ecx, 4
cmp eax, dword [ebp + 8]
jb 0x5090c7
mov esi, dword [ebp + 8]
mov ecx, dword [ebp + 0x14]
or dword [edi + 0x18], 6
sub esi, ecx
add dword [edi + 0x10], esi
pop ebx
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret 0x10