Function at 0x140051350
Capabilities:
Get thread local storage value

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbx
sub rsp, 0x30
mov r15, rcx
mov rax, qword [0x140219028]
xor rax, rsp
mov qword [rsp + 0x28], rax
lea rax, fcn.140153df0
mov qword [rcx], rax
lea rax, [0x1401f3780]
mov qword [rcx + 8], rax
mov eax, dword [0x14022b0e0]
mov ecx, dword [0x140222a94]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140051710
lea rdi, [r15 + 8]
mov ecx, dword [0x14021aed0]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
and rax, 0xfffffffffffffffc
je 0x140051753
movsxd rcx, dword [0x14022b0d8]
shl rcx, 4
mov edx, dword [rax + rcx + 8]
cmp edx, dword [0x14022b0dc]
jne 0x140051753
mov rcx, qword [rax + rcx]
mov rdx, r15
call fcn.140024b40
call fcn.140021ec0
mov rcx, rax
mov rdx, rdi
xor r8d, r8d
call fcn.140031a90
mov r14, qword [r15 + 0x10]
add r14, 8
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_TryAcquireSRWLockExclusive]
test al, al
je 0x14005175a
mov rax, qword [r15 + 0x18]
test rax, rax
jne 0x140051767
call qword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov r9, qword [r15 + 0x10]
mov r10, qword [r9 + 0x328]
test r10, r10
je 0x14005156b
mov r8d, eax
movsxd r13, eax
mov rax, r10
shr rax, 1
movabs rcx, 0x5555555555555555
and rcx, rax
mov rax, r10
sub rax, rcx
movabs rcx, 0x3333333333333333
mov rdx, rax
and rdx, rcx
shr rax, 2
and rax, rcx
add rax, rdx
mov rcx, rax
shr rcx, 4
add rcx, rax
movabs rax, 0xf0f0f0f0f0f0f0f
and rax, rcx
movabs rsi, 0x101010101010101
imul rsi, rax
shr rsi, 0x38
cmp rsi, 1
ja 0x140051655
lea rcx, [r10 - 1]
and rcx, r13
mov r12, qword [r9 + 0x320]
mov rax, qword [r12 + rcx*8]
test rax, rax
je 0x14005156b
mov rbx, qword [rax]
test rbx, rbx
je 0x14005156b
lea r11, [r10 - 1]
mov rax, qword [rbx + 8]
cmp rax, r13
jne 0x1400516da
cmp dword [rbx + 0x10], r8d
jne 0x1400516fa
cmp esi, 1
ja 0x140051671
and r13, r11
mov rax, qword [r12 + r13*8]
mov rcx, rax
mov rax, qword [rax]
cmp rax, rbx
jne 0x1400514fd
lea rax, [r9 + 0x330]
cmp rcx, rax
jne 0x14005168a
mov rax, qword [rbx]
test rax, rax
jne 0x140051637
mov qword [r12 + r13*8], 0
mov rdi, qword [rbx]
test rdi, rdi
jne 0x14005160b
xor edi, edi
mov qword [rcx], rdi
mov qword [rbx], 0
dec qword [r9 + 0x338]
test rbx, rbx
je 0x14005156b
mov rcx, qword [rbx + 0x18]
test rcx, rcx
je 0x140051563
lock dec dword [rcx + 8]
je 0x1400517c4
mov rcx, rbx
call fcn.14011d780
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
mov rsi, qword [r15 + 0x10]
mov ecx, dword [0x14021aed0]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
and rax, 0xfffffffffffffffc
je 0x1400515b2
movsxd rcx, dword [rsi + 0x308]
shl rcx, 4
mov qword [rax + rcx], 0
mov ecx, dword [rsi + 0x30c]
movsxd rdx, dword [rsi + 0x308]
shl rdx, 4
mov dword [rax + rdx + 8], ecx
mov rdi, qword [r15 + 0x18]
mov qword [r15 + 0x18], 0
test rdi, rdi
jne 0x1400517a5
mov rcx, qword [r15 + 0x10]
movabs rax, 0xfffffffe00000000
and rax, rcx
cmp rax, qword [0x14021af08]
je 0x1400517ba
mov qword [r15 + 0x10], 0
mov rcx, qword [rsp + 0x28]
xor rcx, rsp
call fcn.14011fe20
nop
add rsp, 0x30
pop rbx
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret
mov rax, qword [rdi + 8]
cmp esi, 1
ja 0x1400516ae
and rax, r11
cmp rax, r13
je 0x14005153a
mov rdx, qword [r9 + 0x320]
mov qword [rdx + rax*8], rcx
mov rdi, qword [rbx]
jmp 0x14005153a
mov rax, qword [rax + 8]
cmp esi, 1
ja 0x1400516c4
and rax, r11
cmp rax, r13
je 0x14005152c
jmp 0x140051524
mov rcx, r13
cmp r10, r13
ja 0x1400514b2
mov rax, r13
xor edx, edx
div r10
mov rcx, rdx
jmp 0x1400514b2
cmp r10, r13
ja 0x1400514f9
mov rax, r13
xor edx, edx
div r10
mov r13, rdx
jmp 0x1400514f9
mov rax, qword [rcx + 8]
cmp esi, 1
jbe 0x14005170b
cmp rax, r10
jb 0x1400516a0
xor edx, edx
div r10
mov rax, rdx
cmp rax, r13
jne 0x140051518
jmp 0x14005152c
cmp rax, r10
jb 0x14005161b
xor edx, edx
div r10
mov rax, rdx
jmp 0x14005161b
cmp rax, r10
jb 0x140051647
xor edx, edx
div r10
mov rax, rdx
jmp 0x140051647
cmp esi, 1
ja 0x1400516e4
and rax, r11
jmp 0x1400516f1
cmp rax, r10
jb 0x1400516f1
xor edx, edx
div r10
mov rax, rdx
cmp rax, rcx
jne 0x14005156b
mov rbx, qword [rbx]
test rbx, rbx
jne 0x1400514d6
jmp 0x14005156b
and rax, r11
jmp 0x1400516a0
lea rcx, [0x14022b0e0]
call fcn.14011d638
cmp dword [0x14022b0e0], 0xffffffff
jne 0x1400513ab
mov qword [0x14022b0d8], 0
lea rcx, [0x14022b0d8]
xor edx, edx
call fcn.140012fc0
lea rcx, [0x14022b0e0]
call fcn.14011d5d8
jmp 0x1400513ab
xor ecx, ecx
jmp 0x1400513e4
mov rcx, r14
call fcn.1400fd520
jmp 0x140051418
mov rcx, qword [r15 + 0x10]
mov edx, dword [rcx + 0x37c]
cmp edx, dword [r15 + 0x28]
jne 0x140051425
mov rcx, qword [rcx + 0x20]
mov qword [r15 + 0x18], 0
lea r8, [rsp + 0x20]
mov qword [r8], rax
mov rdx, qword [r15 + 0x20]
mov rax, qword [rcx]
mov rax, qword [rax + 0x10]
call qword [0x14023a010]
jmp 0x140051425
mov rcx, rdi
call fcn.14017e7c0
mov rcx, rdi
call fcn.14011d780
jmp 0x1400515c7
call fcn.1400f23b0
jmp 0x1400515e5
add rcx, 8
add rcx, 0xfffffffffffffff8
call fcn.1400e9a50
jmp 0x140051563