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

Disassembly:
push rbx
push rdi
sub rsp, 0x28
mov qword [rsp + 0x40], rbp
mov rbx, rcx
mov rcx, qword [rcx + 0x40]
mov qword [rsp + 0x50], r12
mov qword [rsp + 0x20], r13
test rcx, rcx
je 0x18021c01c
mov edx, 1
call fcn.18021bcd0
mov rcx, qword [rbx + 0xcc0]
test rcx, rcx
je 0x18021c038
add dword [rcx + 0x20], 0xffffffff
jne 0x18021c038
mov rax, qword [rcx]
mov edx, 1
call qword [rax]
mov rcx, qword [rbx + 0xcc8]
test rcx, rcx
je 0x18021c054
add dword [rcx + 0x20], 0xffffffff
jne 0x18021c054
mov rax, qword [rcx]
mov edx, 1
call qword [rax]
mov rcx, qword [rbx + 0xcd8]
test rcx, rcx
je 0x18021c06a
mov edx, 1
call fcn.18021bc50
mov rcx, qword [rbx + 0x48]
test rcx, rcx
je 0x18021c07d
mov edx, 1
call fcn.18021bd50
xor ebp, ebp
lea r12, [rbx + 0xce0]
mov qword [rsp + 0x48], rsi
lea r13d, [rbp + 0x7f]
nop
mov rdi, qword [r12]
test rdi, rdi
je 0x18021c10a
mov rcx, qword [rdi + 0x18]
test rcx, rcx
je 0x18021c0b2
add dword [rcx + 0x20], 0xffffffff
jne 0x18021c0b2
mov rax, qword [rcx]
mov edx, 1
call qword [rax]
mov rcx, qword [rdi + 0x20]
test rcx, rcx
je 0x18021c0cb
add dword [rcx + 0x20], 0xffffffff
jne 0x18021c0cb
mov rax, qword [rcx]
mov edx, 1
call qword [rax]
mov rcx, qword [rdi + 0x28]
test rcx, rcx
je 0x18021c0de
mov edx, 1
call fcn.18021b660
mov r8d, dword [rdi + 8]
mov rsi, qword [rdi]
mov edx, 0xfe
mov rcx, rdi
call fcn.18024adb8
mov qword [rdi], rbp
mov rax, qword [rsi + 8]
test rax, rax
je 0x18021c103
mov qword [rax], rdi
jmp 0x18021c106
mov qword [rsi], rdi
mov qword [rsi + 8], rdi
add r12, 8
sub r13, 1
jne 0x18021c090
mov r13, qword [rsp + 0x20]
mov r12, qword [rsp + 0x50]
cmp qword [rbx + 0x10e8], rbp
je 0x18021c182
nop dword [rax + rax]
mov rdi, qword [rbx + 0x10e8]
mov rcx, rdi
mov rax, qword [rdi + 0x100]
mov qword [rbx + 0x10e8], rax
call fcn.18021b7c0
mov r8d, dword [rdi + 8]
mov rsi, qword [rdi]
mov edx, 0xfe
mov rcx, rdi
call fcn.18024adb8
mov qword [rdi], rbp
mov rax, qword [rsi + 8]
test rax, rax
je 0x18021c172
mov qword [rax], rdi
jmp 0x18021c175
mov qword [rsi], rdi
mov qword [rsi + 8], rdi
cmp qword [rbx + 0x10e8], rbp
jne 0x18021c130
mov rdx, qword [rbx + 0x1140]
test rdx, rdx
je 0x18021c1ab
lea rdi, [0x180059314]
mov rsi, rdx
mov ecx, 2
repe cmpsb byte [rsi], byte [rdi]
je 0x18021c1ab
mov ecx, 4
call sub.msvcrt.dll_setlocale
mov rcx, qword [rbx + 0x1140]
mov rsi, qword [rsp + 0x48]
test rcx, rcx
je 0x18021c1c1
call sub.msvcrt.dll_free
cmp byte [rbx + 0x1148], bpl
je 0x18021c218
mov ecx, dword [0x18025e63c]
mov rdi, qword [rbx + 0x1150]
test ecx, ecx
js 0x18021c211
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
test rax, rax
je 0x18021c211
mov qword [rax + 0x40], rdi
add rax, 0x48
mov ecx, 0xf
nop word [rax + rax]
mov qword [rax], rbp
mov qword [rax + 8], rbp
add rax, 0x10
sub rcx, 1
jne 0x18021c200
mov byte [rbx + 0x1148], bpl
cmp dword [rbx + 0xca0], ebp
je 0x18021c267
mov ecx, dword [0x18025e63c]
test ecx, ecx
js 0x18021c233
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov rbp, rax
dec dword [rbp + 0x254]
cmp dword [rbp + 0x254], 0
jg 0x18021c267
mov rcx, qword [rbp]
test rcx, rcx
je 0x18021c251
call qword [sym.imp.KERNEL32.dll_HeapDestroy]
mov rcx, rbp
call sub.msvcrt.dll_free
mov ecx, dword [0x18025e63c]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
cmp qword [rbx + 0x58], 0
mov rbp, qword [rsp + 0x40]
je 0x18021c2a0
nop word [rax + rax]
mov rcx, qword [rbx + 0x58]
xor edx, edx
mov r8d, 0x8000
mov rax, qword [rcx]
mov qword [rbx + 0x58], rax
call qword [sym.imp.KERNEL32.dll_VirtualFree]
cmp qword [rbx + 0x58], 0
jne 0x18021c280
cmp qword [rbx + 0x20], 0
je 0x18021c2c6
nop word [rax + rax]
mov rcx, qword [rbx + 0x20]
mov rdi, qword [rcx]
call sub.msvcrt.dll_void___cdecl_operator_delete_void____ptr64_
mov qword [rbx + 0x20], rdi
cmp rdi, 0
jne 0x18021c2b0
mov rcx, qword [rbx + 8]
call sub.msvcrt.dll_void___cdecl_operator_delete_void____ptr64_
mov rcx, qword [rbx + 0x10]
add rsp, 0x28
pop rdi
pop rbx
jmp sub.msvcrt.dll_void___cdecl_operator_delete_void____ptr64_