Function at 0x4caa20
Capabilities:
Get thread local storage value

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 8
push ebx
mov ebx, dword [ebp + 8]
push esi
mov esi, dword [ebx + 0x14]
push edi
mov edi, dword [ebp + 0x10]
cmp edi, esi
jb 0x4caa50
mov eax, dword [ebx + 0x10]
lea ecx, [esi + eax*4]
cmp edi, ecx
jae 0x4caa50
pop edi
pop esi
mov eax, 0x8007054f
pop ebx
mov esp, ebp
pop ebp
ret 0x14
mov eax, dword [edi]
mov ecx, dword [eax + 0x10]
mov edx, dword [ebx + 0x10]
cmp ecx, edx
jae 0x4caa66
cmp dword [esi + ecx*4], eax
jne 0x4caa66
mov dword [ebp - 4], ecx
jmp 0x4caa8c
mov edi, edx
test edi, edi
jbe 0x4caa7e
lea ecx, [esi + edi*4]
nop
sub ecx, 4
sub edi, 1
cmp dword [ecx], eax
je 0x4caa81
test edi, edi
ja 0x4caa70
sub edi, 1
cmp edi, 0xffffffff
mov dword [ebp - 4], edi
je 0x4caa42
mov edi, dword [ebp + 0x10]
mov eax, 1
cmp dword [ebp + 0xc], eax
jbe 0x4caabe
mov ecx, dword [ebp - 4]
lea ecx, [esi + ecx*4 + 4]
lea ecx, [ecx]
mov ebx, dword [ebp - 4]
add ebx, eax
cmp ebx, edx
jae 0x4caa42
mov ebx, dword [ecx]
cmp ebx, dword [edi + eax*4]
jne 0x4caa42
add eax, 1
add ecx, 4
cmp eax, dword [ebp + 0xc]
jb 0x4caaa0
mov ebx, dword [ebp + 8]
mov edi, dword [ebp + 0x14]
mov eax, dword [edi + 0x10]
cmp eax, edx
jae 0x4caad4
cmp dword [esi + eax*4], edi
jne 0x4caad4
mov edi, eax
mov dword [ebp + 8], edi
jmp 0x4caaff
mov ecx, edx
test ecx, ecx
jbe 0x4caaee
lea eax, [esi + ecx*4]
lea ecx, [ecx]
sub eax, 4
sub ecx, 1
cmp dword [eax], edi
je 0x4caaf1
test ecx, ecx
ja 0x4caae0
sub ecx, 1
cmp ecx, 0xffffffff
mov dword [ebp + 8], ecx
je 0x4caa42
mov edi, ecx
mov eax, dword [ebp + 0x18]
sub edx, edi
cmp eax, edx
ja 0x4caa42
test eax, eax
jbe 0x4cac1d
lea edx, [edi*4]
mov dword [ebp - 8], eax
mov eax, dword [0x776138]
mov dword [ebp + 0x14], edx
mov ecx, dword [ebx + 0x14]
mov edx, dword [ebp + 0x14]
mov esi, dword [edx + ecx]
test esi, esi
je 0x4cac0f
cmp word [esi + 0x3c], 0
je 0x4cab83
test eax, eax
jge 0x4cab46
xor eax, eax
jmp 0x4cab4d
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
movzx ecx, word [esi + 0x3c]
cmp ecx, dword [eax + 0x120]
ja 0x4cab75
mov edx, dword [esi + 4]
mov eax, dword [eax + 0x11c]
shl ecx, 4
test edx, edx
lea eax, [ecx + eax - 0x10]
je 0x4cab75
mov ecx, dword [eax + 4]
mov dword [edx], ecx
mov dword [eax + 4], edx
xor eax, eax
mov word [esi + 0x3c], ax
mov dword [esi + 4], eax
mov eax, dword [0x776138]
cmp word [esi + 0x3e], 0
je 0x4cabcf
test eax, eax
jge 0x4cab92
xor eax, eax
jmp 0x4cab99
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
movzx ecx, word [esi + 0x3e]
cmp ecx, dword [eax + 0x120]
ja 0x4cabc1
mov edx, dword [esi + 0xc]
mov eax, dword [eax + 0x11c]
shl ecx, 4
test edx, edx
lea eax, [ecx + eax - 0x10]
je 0x4cabc1
mov ecx, dword [eax + 4]
mov dword [edx], ecx
mov dword [eax + 4], edx
xor eax, eax
mov word [esi + 0x3e], ax
mov dword [esi + 0xc], eax
mov eax, dword [0x776138]
test eax, eax
jl 0x4cac0f
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov edi, eax
test edi, edi
je 0x4cac07
push 0x40
push 0xfe
push esi
call sub.msvcrt.dll_memset
mov dword [esi], 0
mov eax, dword [edi + 0x14]
add esp, 0xc
test eax, eax
je 0x4cac01
mov dword [eax], esi
jmp 0x4cac04
mov dword [edi + 0x10], esi
mov dword [edi + 0x14], esi
mov edi, dword [ebp + 8]
mov eax, dword [0x776138]
add dword [ebp + 0x14], 4
sub dword [ebp - 8], 1
jne 0x4cab26
mov esi, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [ebx + 0x10]
add edx, esi
cmp edx, eax
jae 0x4cac4d
mov ecx, dword [ebx + 0x14]
sub eax, esi
sub eax, dword [ebp + 0xc]
add eax, eax
add eax, eax
push eax
lea eax, [ecx + edx*4]
push eax
lea ecx, [ecx + esi*4]
push ecx
call sub.msvcrt.dll_memmove
add esp, 0xc
or dword [ebx + 0x18], 1
mov ecx, dword [ebp + 0xc]
sub dword [ebx + 0x10], ecx
cmp ecx, dword [ebp + 0x18]
mov eax, dword [ebx + 0x10]
je 0x4cac86
mov edx, dword [ebp + 0x18]
mov ecx, dword [ebx + 0x14]
sub eax, edi
sub eax, edx
add eax, eax
add eax, eax
push eax
add edx, edi
lea eax, [ecx + edx*4]
mov edx, dword [ebp + 0xc]
push eax
lea eax, [edi + edx]
lea ecx, [ecx + eax*4]
push ecx
call sub.msvcrt.dll_memmove
add esp, 0xc
or dword [ebx + 0x18], 1
xor eax, eax
cmp dword [ebp + 0xc], eax
jbe 0x4cacb9
lea ecx, [edi*4]
jmp 0x4cac99
mov edi, dword [ebp + 8]
mov edx, dword [ebp + 0x10]
lea esi, [eax + edi]
mov edi, dword [edx + eax*4]
mov dword [edi + 0x10], esi
mov edx, dword [edx + eax*4]
mov esi, dword [ebx + 0x14]
mov dword [ecx + esi], edx
add eax, 1
add ecx, 4
cmp eax, dword [ebp + 0xc]
jb 0x4cac96
mov eax, dword [ebp + 0xc]
sub eax, dword [ebp + 0x18]
or dword [ebx + 0x18], 6
add dword [ebx + 0x10], eax
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0x14