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

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbp
push rbx
sub rsp, 0x58
mov qword [rsp + 0x50], r9
mov qword [rsp + 0x48], r8
mov byte [rsp + 0x27], dl
mov rsi, rcx
mov rax, qword [rcx]
lea r15, [rsp + 0x2a]
lea r14, [0x1401a7090]
xor ebp, ebp
lea r12, [0x1401ccaf0]
mov r13, rax
test rax, rax
jne 0x140081a06
jmp 0x1400819eb
cmp byte [rsp + 0x27], 0
je 0x140081fe7
mov rax, r13
mov ecx, 2
lock cmpxchg qword [rsi], rcx
je 0x140081ec4
mov r13, rax
test rax, rax
je 0x1400819eb
cmp r13, 1
je 0x1400819e0
cmp r13, 3
je 0x140081fd6
mov eax, r13d
and eax, 3
cmp eax, 2
je 0x140081a3f
jmp 0x140081fe7
mov eax, r13d
and eax, 3
cmp eax, 2
jne 0x140081eb0
mov ecx, dword [0x1401a70a8]
test ecx, ecx
je 0x140081a69
dec ecx
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jb 0x140081a80
mov rdi, rax
cmp qword [rax + 8], 0
je 0x140081a80
add rdi, 0x10
jmp 0x140081b30
mov rcx, r14
call fcn.140082e00
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jae 0x140081a56
nop
mov ecx, dword [0x1401a70a8]
test ecx, ecx
je 0x140081ada
dec ecx
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
jne 0x140081af0
movzx eax, byte [0x14024a149]
mov edx, 0x18
xor ecx, ecx
call fcn.140080d30
test rax, rax
je 0x140081fe7
mov rbx, rax
mov qword [rax], r14
mov qword [rax + 8], 0
mov ecx, dword [0x1401a70a8]
test ecx, ecx
je 0x140081c04
dec ecx
mov rdx, rbx
call sub.KERNEL32.dll_TlsSetValue
jmp 0x140081afd
mov rcx, r14
call fcn.140082e00
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
je 0x140081a96
nop
mov rbx, rax
cmp rax, 1
je 0x140081fe7
lea rdi, [rbx + 0x10]
mov rcx, qword [rbx + 0x10]
cmp qword [rbx + 8], 0
mov qword [rbx + 8], 1
mov qword [rbx + 0x10], 0
je 0x140081b30
test rcx, rcx
je 0x140081b30
lock dec qword [rcx]
jne 0x140081b30
call fcn.1400c5730
nop dword [rax]
mov rcx, qword [rdi]
test rcx, rcx
jne 0x140081bac
movzx eax, byte [0x14024a149]
mov edx, 0x30
xor ecx, ecx
call fcn.140080d30
test rax, rax
je 0x140081fe7
mov rcx, rax
mov qword [rax], 1
mov qword [rax + 8], 1
mov qword [rax + 0x18], 0
mov rax, qword [0x14024a108]
nop word cs:[rax + rax]
mov rdx, rax
inc rdx
je 0x140081fe7
lock cmpxchg qword [0x14024a108], rdx
jne 0x140081b80
mov qword [rcx + 0x10], rdx
mov byte [rcx + 0x28], 0
cmp qword [rdi], 0
jne 0x140081fe7
mov qword [rdi], rcx
lock inc qword [rcx]
jle 0x140081fe7
mov rax, r13
add rax, 0xfffffffffffffffe
mov qword [rsp + 0x28], rcx
mov byte [rsp + 0x38], 0
mov qword [rsp + 0x30], rax
mov rax, r13
lock cmpxchg qword [rsi], r15
je 0x140081e80
mov r13, rax
mov rax, qword [rsp + 0x28]
test rax, rax
je 0x140081a30
lock dec qword [rax]
jne 0x140081a30
mov rcx, qword [rsp + 0x28]
call fcn.1400c5730
jmp 0x140081a30
mov rcx, r14
call fcn.140082e00
mov ecx, eax
jmp 0x140081ad0
mov ecx, dword [0x1401a70a8]
test ecx, ecx
je 0x140081c4a
dec ecx
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jb 0x140081c60
mov rdi, rax
cmp qword [rax + 8], 0
je 0x140081c60
add rdi, 0x10
jmp 0x140081d20
mov rcx, r14
call fcn.140082e00
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jae 0x140081c37
nop
mov ecx, dword [0x1401a70a8]
test ecx, ecx
je 0x140081c84
dec ecx
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
je 0x140081ca0
mov rbx, rax
cmp rax, 1
jne 0x140081ce2
jmp 0x140081fe7
mov rcx, r14
call fcn.140082e00
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
jne 0x140081c76
nop dword [rax + rax]
movzx eax, byte [0x14024a149]
mov edx, 0x18
xor ecx, ecx
call fcn.140080d30
test rax, rax
je 0x140081fe7
mov rbx, rax
mov qword [rax], r14
mov qword [rax + 8], 0
mov ecx, dword [0x1401a70a8]
test ecx, ecx
je 0x140081e70
dec ecx
mov rdx, rbx
call sub.KERNEL32.dll_TlsSetValue
lea rdi, [rbx + 0x10]
mov rcx, qword [rbx + 0x10]
cmp qword [rbx + 8], 0
mov qword [rbx + 8], 1
mov qword [rbx + 0x10], 0
je 0x140081d20
test rcx, rcx
je 0x140081d20
lock dec qword [rcx]
jne 0x140081d20
call fcn.1400c5730
nop word cs:[rax + rax]
mov r13, qword [rdi]
test r13, r13
jne 0x140081d9d
movzx eax, byte [0x14024a149]
mov edx, 0x30
xor ecx, ecx
call fcn.140080d30
test rax, rax
je 0x140081fe7
mov r13, rax
mov qword [rax], 1
mov qword [rax + 8], 1
mov qword [rax + 0x18], 0
mov rax, qword [0x14024a108]
nop word cs:[rax + rax]
mov rcx, rax
inc rcx
je 0x140081fe7
lock cmpxchg qword [0x14024a108], rcx
jne 0x140081d70
mov qword [r13 + 0x10], rcx
mov byte [r13 + 0x28], 0
cmp qword [rdi], 0
jne 0x140081fe7
mov qword [rdi], r13
lock inc qword [r13]
jle 0x140081fe7
lock dec byte [r13 + 0x28]
je 0x140081ddd
lea rdi, [r13 + 0x28]
mov rbx, qword [0x14024a128]
test rbx, rbx
je 0x140081df5
nop
mov r8d, 1
mov rcx, rdi
mov rdx, r12
mov r9d, 0xffffffff
call rbx
mov al, 1
lock cmpxchg byte [rdi], bpl
jne 0x140081dc0
lock dec qword [r13]
jne 0x140081e80
mov rcx, r13
call fcn.1400c5730
jmp 0x140081e80
mov rcx, qword [0x1401a70b8]
cmp rcx, 0xffffffffffffffff
jne 0x140081e4e
mov qword [rsp + 0x40], 0xffffffffffffffff
mov rax, qword [str.___b_]
lea rcx, [rsp + 0x40]
mov edx, 0xc0000000
xor r8d, r8d
xor r9d, r9d
call rax
test eax, eax
jne 0x140081fe7
mov rcx, qword [rsp + 0x40]
mov rax, 0xffffffffffffffff
lock cmpxchg qword [0x1401a70b8], rcx
je 0x140081e4e
mov rbx, rax
call sub.KERNEL32.dll_CloseHandle
mov rcx, rbx
mov rax, qword [0x1401a70b0]
mov rdx, rdi
xor r8d, r8d
xor r9d, r9d
call rax
xor eax, eax
xchg byte [rdi], al
lock dec qword [r13]
jne 0x140081e80
jmp 0x140081de8
mov rcx, r14
call fcn.140082e00
mov ecx, eax
jmp 0x140081cda
movzx eax, byte [rsp + 0x38]
test al, al
je 0x140081c20
mov rax, qword [rsp + 0x28]
test rax, rax
je 0x140081eb0
lock dec qword [rax]
jne 0x140081eb0
mov rcx, qword [rsp + 0x28]
call fcn.1400c5730
nop word [rax + rax]
mov rax, qword [rsi]
mov r13, rax
test rax, rax
jne 0x140081a06
jmp 0x1400819eb
cmp r13, 1
mov qword [rsp + 0x28], 3
sete byte [rsp + 0x30]
lea rdx, [rsp + 0x28]
mov rcx, qword [rsp + 0x48]
mov rax, qword [rsp + 0x50]
call qword [rax + 0x20]
mov rax, qword [rsp + 0x28]
xchg qword [rsi], rax
mov ecx, eax
and ecx, 3
cmp ecx, 2
jne 0x140081fe7
add rax, 0xfffffffffffffffe
je 0x140081fd6
lea rsi, [rsp + 0x28]
jmp 0x140081f1c
mov rax, r15
test r15, r15
je 0x140081fd6
mov rdi, qword [rax]
mov r15, qword [rax + 8]
mov qword [rax], 0
test rdi, rdi
je 0x140081fe7
mov byte [rax + 0x10], 1
mov al, 1
xchg byte [rdi + 0x28], al
cmp al, 0xff
jne 0x140081f55
lea rbx, [rdi + 0x28]
mov rax, qword [0x14024a130]
test rax, rax
je 0x140081f65
mov rcx, rbx
call rax
lock dec qword [rdi]
jne 0x140081f10
mov rcx, rdi
call fcn.1400c5730
jmp 0x140081f10
mov rcx, qword [0x1401a70b8]
cmp rcx, 0xffffffffffffffff
jne 0x140081fb8
mov qword [rsp + 0x28], 0xffffffffffffffff
mov rax, qword [str.___b_]
mov rcx, rsi
mov edx, 0xc0000000
xor r8d, r8d
xor r9d, r9d
call rax
test eax, eax
jne 0x140081fe7
mov rcx, qword [rsp + 0x28]
mov rax, 0xffffffffffffffff
lock cmpxchg qword [0x1401a70b8], rcx
je 0x140081fb8
mov r14, rax
call sub.KERNEL32.dll_CloseHandle
mov rcx, r14
mov rax, qword [0x1401a70e0]
mov rdx, rbx
xor r8d, r8d
xor r9d, r9d
call rax
lock dec qword [rdi]
jne 0x140081f10
jmp 0x140081f5b
add rsp, 0x58
pop rbx
pop rbp
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret
ud2