Function at 0x4a5800
Capabilities:
Get thread local storage value

Disassembly:
mov eax, dword [0x526ad4]
sub esp, 0x20
push ebx
push ebp
push esi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov ebx, eax
test ebx, ebx
jne 0x4a5826
pop edi
pop esi
pop ebp
mov eax, 5
pop ebx
add esp, 0x20
ret
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x40]
xor eax, eax
xor edi, edi
mov ax, word [ecx*2 + 0x51d3a4]
xor ebp, ebp
mov dword [esp + 0x2c], eax
xor eax, eax
mov ax, word [edx*2 + 0x51d3a4]
mov dword [esp + 0x14], edi
mov dword [esp + 0x28], eax
mov eax, dword [ebx + 0xab6]
test eax, eax
mov dword [esp + 0x10], ebp
mov dword [esp + 0x24], 1
mov dword [esp + 0x18], eax
jle 0x4a5d26
cmp dword [ebx], 0
jne 0x4a5d26
cmp ebp, 1
jae 0x4a58a9
lea esi, [ebx + 0x9088]
push ebx
push esi
call fcn.004a24e0
mov edx, dword [esp + 0x18]
xor eax, eax
mov ax, word [esi]
mov ecx, ebp
shl eax, cl
add ebp, 8
add esp, 8
or edx, eax
cmp ebp, 1
mov dword [esp + 0x10], edx
jb 0x4a5884
test byte [esp + 0x10], 1
je 0x4a595b
mov esi, dword [esp + 0x10]
mov ecx, dword [esp + 0x18]
mov eax, dword [ebx + 0x44]
shr esi, 1
dec ebp
dec ecx
test eax, eax
mov dword [esp + 0x10], esi
mov dword [esp + 0x18], ecx
je 0x4a58e8
mov eax, dword [ebx + 0x48]
test eax, eax
je 0x4a58e8
mov eax, dword [ebx + 0x8cea]
test eax, eax
ja 0x4a58e8
mov dword [esp + 0x18], 0
cmp ebp, 8
jae 0x4a591a
lea esi, [ebx + 0x9088]
push ebx
push esi
call fcn.004a24e0
xor ecx, ecx
mov eax, dword [esp + 0x18]
mov cx, word [esi]
add esp, 8
mov edx, ecx
mov ecx, ebp
shl edx, cl
add ebp, 8
or eax, edx
cmp ebp, 8
mov dword [esp + 0x10], eax
jb 0x4a58f3
mov al, byte [esp + 0x10]
mov byte [edi + ebx + 0xcd6], al
inc edi
cmp edi, 0x8000
mov dword [esp + 0x14], edi
jne 0x4a5948
push ebx
push edi
call fcn.004a3900
add esp, 8
xor eax, eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x14], eax
mov edi, eax
mov ecx, dword [esp + 0x10]
shr ecx, 8
mov dword [esp + 0x10], ecx
sub ebp, 8
jmp 0x4a5d1a
mov edx, dword [esp + 0x10]
shr edx, 1
dec ebp
mov dword [esp + 0x10], edx
cmp ebp, 6
jae 0x4a5998
lea esi, [ebx + 0x9088]
push ebx
push esi
call fcn.004a24e0
xor ecx, ecx
mov edi, dword [esp + 0x18]
mov cx, word [esi]
add esp, 8
mov edx, ecx
mov ecx, ebp
shl edx, cl
add ebp, 8
or edi, edx
cmp ebp, 6
mov dword [esp + 0x10], edi
jb 0x4a5971
mov ecx, dword [esp + 0x10]
sub ebp, 6
mov eax, ecx
and eax, 0x3f
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x40]
shr ecx, 6
cmp ebp, eax
mov dword [esp + 0x10], ecx
jae 0x4a59e5
lea esi, [ebx + 0x9088]
push ebx
push esi
call fcn.004a24e0
mov edx, dword [esp + 0x18]
xor eax, eax
mov ax, word [esi]
mov ecx, ebp
shl eax, cl
add ebp, 8
add esp, 8
or edx, eax
mov eax, dword [esp + 0x40]
cmp ebp, eax
mov dword [esp + 0x10], edx
jb 0x4a59bd
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x28]
mov edx, dword [esp + 0x38]
not eax
and eax, ecx
lea ecx, [eax + eax*2]
xor eax, eax
mov al, byte [edx + ecx*2]
lea edi, [edx + ecx*2]
mov esi, eax
cmp esi, 0x10
jbe 0x4a5a7f
cmp esi, 0x63
je 0x4a5d41
mov eax, dword [esp + 0x10]
xor ecx, ecx
mov cl, byte [edi + 1]
sub esi, 0x10
shr eax, cl
sub ebp, ecx
cmp ebp, esi
mov dword [esp + 0x10], eax
jae 0x4a5a58
lea eax, [ebx + 0x9088]
push ebx
push eax
call fcn.004a24e0
xor ecx, ecx
mov eax, dword [esp + 0x18]
mov cx, word [ebx + 0x9088]
add esp, 8
mov edx, ecx
mov ecx, ebp
shl edx, cl
add ebp, 8
or eax, edx
cmp ebp, esi
mov dword [esp + 0x10], eax
jb 0x4a5a28
mov ecx, dword [esp + 0x10]
xor eax, eax
mov ax, word [esi*2 + 0x51d3a4]
not ecx
and eax, ecx
xor ecx, ecx
lea edx, [eax + eax*2]
mov eax, dword [edi + 2]
mov cl, byte [eax + edx*2]
lea edi, [eax + edx*2]
mov esi, ecx
cmp esi, 0x10
ja 0x4a5a07
xor edx, edx
xor eax, eax
mov dl, byte [edi + 1]
mov ax, word [edi + 2]
mov edi, dword [esp + 0x14]
mov esi, edx
mov edx, dword [esp + 0x10]
mov ecx, esi
shr edx, cl
mov ecx, dword [esp + 0x1c]
sub edi, eax
mov eax, dword [esp + 0x3c]
sub ebp, esi
sub edi, ecx
cmp ebp, eax
mov dword [esp + 0x10], edx
jae 0x4a5ade
lea esi, [ebx + 0x9088]
push ebx
push esi
call fcn.004a24e0
xor ecx, ecx
mov eax, dword [esp + 0x18]
mov cx, word [esi]
add esp, 8
mov edx, ecx
mov ecx, ebp
shl edx, cl
add ebp, 8
or eax, edx
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x3c]
cmp ebp, eax
jb 0x4a5ab4
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x2c]
not eax
and eax, ecx
mov ecx, dword [esp + 0x34]
lea eax, [eax + eax*2]
lea edx, [ecx + eax*2]
xor eax, eax
mov dword [esp + 0x20], edx
mov al, byte [edx]
mov esi, eax
cmp esi, 0x10
jbe 0x4a5b93
cmp esi, 0x63
je 0x4a5d41
mov eax, dword [esp + 0x10]
xor ecx, ecx
mov cl, byte [edx + 1]
sub esi, 0x10
shr eax, cl
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x10], eax
mov eax, ecx
sub ebp, eax
cmp ebp, esi
jae 0x4a5b62
lea eax, [ebx + 0x9088]
push ebx
push eax
call fcn.004a24e0
xor ecx, ecx
mov eax, dword [esp + 0x18]
mov cx, word [ebx + 0x9088]
add esp, 8
mov edx, ecx
mov ecx, ebp
shl edx, cl
add ebp, 8
or eax, edx
cmp ebp, esi
mov dword [esp + 0x10], eax
jb 0x4a5b2e
mov edx, dword [esp + 0x20]
mov ecx, dword [esp + 0x10]
xor eax, eax
mov ax, word [esi*2 + 0x51d3a4]
not ecx
and eax, ecx
mov ecx, dword [edx + 2]
xor edx, edx
lea eax, [eax + eax*2]
mov dl, byte [ecx + eax*2]
lea eax, [ecx + eax*2]
mov esi, edx
mov dword [esp + 0x20], eax
cmp esi, 0x10
mov edx, eax
ja 0x4a5b07
mov eax, dword [esp + 0x10]
xor ecx, ecx
mov cl, byte [edx + 1]
mov dword [esp + 0x1c], ecx
sub ebp, ecx
shr eax, cl
xor ecx, ecx
mov cx, word [edx + 2]
test esi, esi
mov dword [esp + 0x10], eax
mov dword [esp + 0x20], ecx
je 0x4a5c02
cmp ebp, 8
jae 0x4a5bea
lea esi, [ebx + 0x9088]
push ebx
push esi
call fcn.004a24e0
mov edx, dword [esp + 0x18]
xor eax, eax
mov ax, word [esi]
mov ecx, ebp
shl eax, cl
add ebp, 8
add esp, 8
or edx, eax
cmp ebp, 8
mov dword [esp + 0x10], edx
jb 0x4a5bc1
mov ecx, dword [esp + 0x20]
mov eax, dword [esp + 0x10]
mov edx, eax
and edx, 0xff
shr eax, 8
add ecx, edx
mov dword [esp + 0x10], eax
sub ebp, 8
mov edx, dword [esp + 0x18]
mov eax, dword [ebx + 0x44]
sub edx, ecx
test eax, eax
mov dword [esp + 0x18], edx
je 0x4a5c2c
mov eax, dword [ebx + 0x48]
test eax, eax
je 0x4a5c2c
mov eax, dword [ebx + 0x8cea]
test eax, eax
ja 0x4a5c2c
mov dword [esp + 0x18], 0
mov eax, dword [esp + 0x14]
and edi, 0x7fff
cmp edi, eax
mov dword [esp + 0x1c], edi
mov esi, edi
ja 0x4a5c42
mov esi, eax
mov edx, 0x8000
sub edx, esi
cmp edx, ecx
jbe 0x4a5c4f
mov edx, ecx
sub ecx, edx
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0x24]
test ecx, ecx
je 0x4a5c92
cmp eax, edi
ja 0x4a5c92
mov esi, dword [esp + 0x14]
mov ecx, edx
xor eax, eax
lea edi, [esi + ebx + 0xcd6]
mov esi, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, esi
and ecx, 3
rep stosb byte es:[edi], al
mov ecx, dword [esp + 0x14]
mov edi, dword [esp + 0x1c]
add ecx, edx
add edi, edx
mov dword [esp + 0x14], ecx
mov eax, ecx
jmp 0x4a5ceb
mov ecx, eax
sub ecx, edi
cmp ecx, edx
jb 0x4a5cd4
mov ecx, edx
lea esi, [ebx + edi + 0xcd6]
lea edi, [ebx + eax + 0xcd6]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x1c]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x14]
add ecx, edx
add eax, edx
mov dword [esp + 0x1c], eax
mov dword [esp + 0x14], ecx
mov edi, dword [esp + 0x1c]
mov eax, ecx
jmp 0x4a5ceb
mov cl, byte [ebx + edi + 0xcd6]
mov byte [ebx + eax + 0xcd6], cl
inc eax
inc edi
dec edx
jne 0x4a5cd4
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x20]
cmp eax, 0x8000
jne 0x4a5d0e
push ebx
push eax
call fcn.004a3900
mov ecx, dword [esp + 0x28]
add esp, 8
xor eax, eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x14], eax
test ecx, ecx
jne 0x4a5c2c
mov edi, dword [esp + 0x14]
mov eax, dword [esp + 0x18]
test eax, eax
jg 0x4a5870
push ebx
push edi
call fcn.004a3900
mov eax, dword [ebx + 0x44]
add esp, 8
test eax, eax
je 0x4a5d4e
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x20
ret
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x20
ret
mov eax, dword [ebx + 0xab2]
pop edi
neg eax
sbb eax, eax
pop esi
pop ebp
and eax, 5
pop ebx
add esp, 0x20
ret