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

Disassembly:
push r14
push r13
push r12
push rbx
sub rsp, 0x28
test edx, edx
jne 0x140005068
test r8, r8
je 0x1400050a8
mov eax, 1
add rsp, 0x28
pop rbx
pop r12
pop r13
pop r14
ret
cmp edx, 1
je 0x1400050d0
cmp edx, 3
jne 0x140005054
mov rbx, qword [0x14000e600]
mov rax, qword [rbx]
test rax, rax
je 0x140005320
cmp qword [rax + 0x30], 0
je 0x1400050f0
mov rax, qword [rax + 0x30]
cmp dword [rax], 0xffffffff
je 0x140005054
mov rdx, qword [rbx]
cmp qword [rdx + 0x30], 0
je 0x140005100
mov rax, qword [rdx + 0x30]
jmp 0x14000510b
mov rcx, qword [0x1400111f8]
test rcx, rcx
je 0x140005054
call qword [sym.imp.KERNEL32.dll_RemoveVectoredExceptionHandler]
mov qword [0x1400111f8], 0
jmp 0x140005054
lea rdx, [sym.SetThreadName_VEH]
mov ecx, 1
call qword [sym.imp.KERNEL32.dll_AddVectoredExceptionHandler]
mov qword [0x1400111f8], rax
jmp 0x140005054
lea rdx, [0x14000d078]
mov qword [rax + 0x30], rdx
mov rax, rdx
jmp 0x140005090
lea rax, [0x14000d078]
mov qword [rdx + 0x30], rax
mov ecx, dword [rax]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov r12, rax
test rax, rax
je 0x140005054
test byte [rax + 0x40], 0x30
je 0x1400051d0
mov rcx, qword [rax + 0x1d8]
test rcx, rcx
je 0x14000513a
call sym._pthread_cleanup_dest.part.0
mov rcx, qword [r12 + 0x28]
test rcx, rcx
je 0x14000516d
mov r13, qword [sym.imp.KERNEL32.dll_CloseHandle]
call r13
mov rcx, qword [r12 + 0x30]
test rcx, rcx
je 0x14000515b
call r13
mov qword [r12 + 0x30], 0
mov qword [r12 + 0x28], 0
lea rcx, [r12 + 0x38]
call sym.pthread_mutex_destroy
lea rcx, [r12 + 0x68]
call sym.pthread_spin_destroy
cmp eax, 1
je 0x1400053a1
cmp qword [r12 + 0x1d0], 0
mov qword [r12 + 0x68], 0xffffffffffffffff
jne 0x1400051a6
mov rcx, r12
call sym.push_pthread_mem.part.0
mov rax, qword [rbx]
test rax, rax
je 0x1400052ef
cmp qword [rax + 0x30], 0
je 0x140005308
mov rax, qword [rax + 0x30]
mov ecx, dword [rax]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
jmp 0x140005054
mov rcx, qword [rax + 0x30]
mov eax, dword [rax + 0xbc]
test eax, eax
jne 0x1400052b0
test rcx, rcx
je 0x1400051ed
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rcx, qword [r12 + 0x1d8]
mov qword [r12 + 0x30], 0
mov dword [r12 + 0xbc], 1
test rcx, rcx
je 0x140005214
call sym._pthread_cleanup_dest.part.0
lea r13, [r12 + 0x38]
lea r14, [r12 + 0x68]
test byte [r12 + 0x44], 4
je 0x140005388
mov rcx, qword [r12 + 0x28]
mov dword [r12], 0xdeadbeef
test rcx, rcx
je 0x140005242
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [r12 + 0x28], 0
mov rcx, r13
call sym.pthread_mutex_destroy
mov rcx, r14
call sym.pthread_spin_destroy
cmp eax, 1
je 0x1400053a1
cmp qword [r12 + 0x1d0], 0
mov qword [r12 + 0x68], 0xffffffffffffffff
jne 0x140005280
mov rcx, r12
call sym.push_pthread_mem.part.0
mov rax, qword [rbx]
test rax, rax
jne 0x1400051b2
call sym.__shmem3_winpthreads_tdm_init_local_region
cmp qword [rax + 0x30], 0
mov rax, qword [rbx]
je 0x140005308
test rax, rax
jne 0x1400051bd
call sym.__shmem3_winpthreads_tdm_init_local_region
jmp 0x1400051bd
test rcx, rcx
je 0x1400052bb
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [r12 + 0x30], 0
lea rcx, [r12 + 0x38]
call sym.pthread_mutex_destroy
lea rcx, [r12 + 0x68]
call sym.pthread_spin_destroy
cmp eax, 1
je 0x1400053a1
mov qword [r12 + 0x68], 0xffffffffffffffff
jmp 0x140005054
call sym.__shmem3_winpthreads_tdm_init_local_region
mov r8, rax
mov rax, qword [rbx]
cmp qword [r8 + 0x30], 0
jne 0x14000529b
nop dword [rax]
lea rdx, [0x14000d078]
mov qword [rax + 0x30], rdx
mov rax, rdx
jmp 0x1400051c1
call sym.__shmem3_winpthreads_tdm_init_local_region
cmp qword [rax + 0x30], 0
mov rax, qword [rbx]
je 0x1400050f0
test rax, rax
jne 0x14000508c
call sym.__shmem3_winpthreads_tdm_init_local_region
mov rax, qword [rax + 0x30]
cmp dword [rax], 0xffffffff
je 0x140005054
mov rdx, qword [rbx]
test rdx, rdx
jne 0x140005098
call sym.__shmem3_winpthreads_tdm_init_local_region
mov rdx, qword [rbx]
cmp qword [rax + 0x30], 0
je 0x140005100
test rdx, rdx
jne 0x14000509f
call sym.__shmem3_winpthreads_tdm_init_local_region
mov rax, qword [rax + 0x30]
jmp 0x14000510b
mov rcx, r13
call sym.pthread_mutex_destroy
mov rcx, r14
call sym.pthread_spin_destroy
cmp eax, 1
jne 0x1400052e1
call sym.replace_spin_keys.part.0
nop
nop word [rax + rax]