Function at 0x4bea12
Capabilities:
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff8
sub esp, 0x50
mov eax, dword [0x541168]
mov edi, ecx
test eax, eax
je 0x4becdf
dec eax
push eax
call sub.kernel32.dll_TlsGetValue
cmp eax, 1
jbe 0x4bea46
mov esi, eax
mov eax, dword [eax]
or eax, dword [esi + 4]
jne 0x4bec9b
mov eax, dword [0x541168]
test eax, eax
je 0x4becee
dec eax
push eax
call sub.kernel32.dll_TlsGetValue
cmp eax, 1
je 0x4beb19
mov esi, eax
test eax, eax
jne 0x4beaaa
mov al, byte [0x5c91e8]
mov ecx, 0x18
mov edx, 8
call fcn.0041aa20
test eax, eax
je 0x4bedcd
mov esi, eax
xor eax, eax
mov dword [esi + 4], eax
mov dword [esi], eax
mov dword [esi + 0x10], 0x541168
mov eax, dword [0x541168]
test eax, eax
je 0x4bed87
dec eax
push esi
push eax
call sub.kernel32.dll_TlsSetValue
call fcn.00485a80
mov ecx, dword [eax + 8]
mov edx, dword [eax + 0xc]
mov dword [esp + 0x10], ecx
mov dword [esp + 0xc], edx
lock dec dword [eax]
jne 0x4beac9
mov ecx, eax
call fcn.0046eef4
call fcn.004bedde
mov ebx, eax
push eax
call sub.kernel32.dll_AcquireSRWLockExclusive
mov eax, dword [0x5c91e0]
test eax, 0x7fffffff
jne 0x4becfd
xor eax, eax
mov cl, byte [ebx + 4]
test cl, cl
jne 0x4beda5
mov edx, dword [ebx + 0x30]
mov dword [esp + 0x34], edi
mov dword [esp + 0x1c], esi
mov dword [esp + 0x18], eax
test edx, edx
je 0x4beb20
lea ecx, [edx - 1]
mov dword [ebx + 0x30], ecx
mov ecx, dword [ebx + 0x28]
mov eax, dword [ecx + edx*4 - 4]
mov dword [esp + 0x14], eax
jmp 0x4beb2b
xor eax, eax
jmp 0x4bec9e
mov eax, dword [ebx + 0x34]
mov dword [esp + 0x14], eax
inc eax
mov dword [ebx + 0x34], eax
mov ecx, dword [ebx + 0x18]
mov edx, dword [ebx + 0x1c]
mov edi, dword [ebx + 0x20]
mov esi, dword [ebx + 0x24]
mov dword [esp + 8], ecx
mov dword [esp + 4], edx
push dword [esp + 0xc]
push dword [esp + 0x14]
push esi
push edi
call fcn.004521da
add esp, 0x10
cmp dword [ebx + 0x10], 0
je 0x4bed09
mov ecx, dword [ebx + 0xc]
mov esi, dword [ebx + 8]
pcmpeqd xmm1, xmm1
mov dword [esp + 0x28], ebx
mov dword [esp + 0x20], 0
mov dword [esp + 8], 0
mov dword [esp + 4], ecx
and ecx, eax
shr eax, 0x19
lea edx, [esi - 0x10]
mov dword [esp + 0x24], esi
movd xmm0, eax
mov dword [esp + 0x30], eax
punpcklbw xmm0, xmm0
pshuflw xmm0, xmm0, 0
pshufd xmm0, xmm0, 0
movdqu xmm2, xmmword [esi + ecx]
movdqa xmm3, xmm2
pcmpeqb xmm3, xmm0
pmovmskb esi, xmm3
test si, si
je 0x4bebe5
bsf edi, esi
lea ebx, [esi - 1]
mov eax, edx
add edi, ecx
and ebx, esi
and edi, dword [esp + 4]
mov esi, edi
shl esi, 4
sub eax, esi
mov esi, dword [eax + 4]
mov eax, dword [eax]
xor esi, dword [esp + 0xc]
xor eax, dword [esp + 0x10]
or eax, esi
mov eax, dword [esp + 0x14]
mov esi, ebx
jne 0x4bebb0
jmp 0x4bec41
cmp dword [esp + 8], 1
mov eax, 1
mov dword [esp + 8], eax
je 0x4bec11
pmovmskb eax, xmm2
xor ebx, ebx
test eax, eax
setne bl
bsf eax, eax
add eax, ecx
mov dword [esp + 8], ebx
and eax, dword [esp + 4]
mov dword [esp + 0x2c], eax
mov ebx, dword [esp + 0x28]
mov esi, dword [esp + 0x24]
pcmpeqb xmm2, xmm1
pmovmskb eax, xmm2
test eax, eax
jne 0x4bed29
mov eax, dword [esp + 0x20]
lea ecx, [ecx + eax + 0x10]
add eax, 0x10
and ecx, dword [esp + 4]
mov dword [esp + 0x20], eax
jmp 0x4beb9f
mov ecx, dword [esp + 0x24]
mov esi, dword [esp + 0x1c]
mov ebx, dword [esp + 0x28]
neg edi
shl edi, 4
mov dword [ecx + edi - 8], eax
mov edi, eax
mov eax, dword [esp + 0x18]
mov ecx, ebx
movzx edx, al
call fcn.004bee2a
mov eax, dword [esi]
mov ecx, dword [esi + 4]
mov edx, dword [esi + 8]
mov dword [esp + 0x38], eax
or eax, ecx
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x40], edx
mov edx, dword [esp + 0x10]
mov ecx, dword [esp + 0xc]
mov dword [esi], edx
mov dword [esi + 4], ecx
mov dword [esi + 8], edi
je 0x4bec97
lea ecx, [esp + 0x38]
call fcn.004bee58
mov edi, dword [esp + 0x34]
mov eax, dword [esi + 8]
mov edx, dword [edi + 8]
lea ecx, [edx - 1]
and ecx, eax
cmp edx, ecx
jbe 0x4bed96
mov eax, dword [edi]
shl ecx, 6
lea esi, [eax + ecx]
mov eax, dword [eax + ecx]
test al, 8
jne 0x4becd6
mov ecx, eax
add ecx, 0x10
jb 0x4becd6
lock cmpxchg dword [esi], ecx
jne 0x4becd6
mov eax, edi
mov edx, esi
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
mov ecx, esi
call fcn.004740d3
jmp 0x4becca
mov ecx, 0x541168
call fcn.004832d0
jmp 0x4bea2e
mov ecx, 0x541168
call fcn.004832d0
jmp 0x4bea54
call fcn.00487de0
xor al, 1
jmp 0x4beae8
mov edx, dword [esp + 8]
mov ecx, ebx
add ecx, 8
push esi
push edi
push dword [esp + 0xc]
mov esi, eax
call fcn.00452458
mov eax, esi
add esp, 0xc
jmp 0x4beb5b
mov edx, dword [esp + 0x2c]
mov al, byte [esi + edx]
test al, al
js 0x4bed42
movdqa xmm0, xmmword [esi]
pmovmskb eax, xmm0
bsf edx, eax
mov al, byte [esi + edx]
and al, 1
mov ecx, dword [esp + 0x30]
mov edi, dword [esp + 0x10]
movzx eax, al
sub dword [ebx + 0x10], eax
lea eax, [edx - 0x10]
and eax, dword [esp + 4]
mov byte [esi + edx], cl
shl edx, 4
mov byte [eax + esi + 0x10], cl
mov eax, esi
inc dword [ebx + 0x14]
mov ecx, dword [esp + 0xc]
sub eax, edx
neg edx
mov dword [eax - 0x10], edi
mov edi, dword [esp + 0x14]
mov dword [eax - 0xc], ecx
mov dword [esi + edx - 8], edi
mov esi, dword [esp + 0x1c]
jmp 0x4bec58
mov ecx, 0x541168
call fcn.004832d0
jmp 0x4beaa3
push 0x56ddbc
call fcn.00444440
add esp, 4
ud2
lea esi, [esp + 0x38]
mov ecx, str.called__Result::unwrap____on_an__Err__value
mov edx, 0x2b
mov dword [esi], ebx
mov byte [esi + 4], al
push 0x56dffc
push 0x56db14
push esi
call fcn.00447310
add esp, 0xc
ud2
mov ecx, 8
mov edx, 0x18
call fcn.0041b1c0
ud2