Function at 0x180016400
Capabilities:
Allocate thread local storage

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rbp
mov qword [rsp + 0x18], rsi
push rdi
sub rsp, 0x20
cmp qword [rcx + 0x20], 0xffffffffffffffff
mov rbp, rdx
mov rbx, rcx
jne 0x180016428
xor al, al
jmp 0x180016662
xor edi, edi
cmp dword [rcx + 0x30], edi
jne 0x18001643d
xor eax, eax
lock cmpxchg dword [rcx + 0x58], edi
jne 0x180016421
cmp dword [rcx + 0x30], edi
je 0x180016446
xor eax, eax
lock cmpxchg dword [rcx + 0x60], edi
je 0x180016421
cmp dword [rdx + 8], edi
je 0x180016451
cmp qword [rdx + 0x18], rdi
je 0x180016421
mov ecx, dword [rcx + 0x5c]
or esi, 0xffffffff
cmp ecx, esi
je 0x180016461
call qword [sym.imp.KERNEL32.dll_TlsFree]
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [rbx + 0x5c], eax
cmp eax, esi
jne 0x1800164a0
mov r8, qword [rbx + 0x38]
test r8, r8
je 0x18001648d
mov rcx, qword [rbx + 0x20]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_HeapFree]
test eax, eax
je 0x180016421
mov qword [rbx + 0x38], rdi
jmp 0x180016421
mov ecx, 0x47
lea rdx, str._HeapFree__NULL_n
call fcn.180030818
jmp 0x180016421
mov rdx, qword [rbp + 0x10]
test rdx, rdx
je 0x18001658c
cmp qword [rdx], rdi
je 0x180016421
lea rsi, [rbx + 0x38]
cmp qword [rsi], rdi
je 0x1800164fd
mov rdx, qword [rdx]
mov rcx, qword [rsi]
call qword [sym.imp.msvcrt.dll_wcscmp]
test eax, eax
je 0x18001654e
cmp qword [rsi], rdi
je 0x1800164ec
mov r8, qword [rsi]
mov rcx, qword [rbx + 0x20]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_HeapFree]
test eax, eax
je 0x1800164fd
mov qword [rsi], rdi
jmp 0x1800164fd
lea rdx, str._HeapFree__NULL_n
mov ecx, 0x58
call fcn.180030818
mov rcx, qword [rbp + 0x10]
mov rcx, qword [rcx]
call qword [sym.imp.msvcrt.dll_wcslen]
mov rcx, qword [rbp]
mov edx, 8
lea r8, [rax*4 + 4]
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov qword [rsi], rax
test rax, rax
je 0x180016421
mov rcx, qword [rbp + 0x10]
mov rcx, qword [rcx]
call qword [sym.imp.msvcrt.dll_wcslen]
mov rdx, qword [rbp + 0x10]
mov rcx, qword [rsi]
mov rdx, qword [rdx]
lea r8, [rax + 1]
call qword [sym.imp.msvcrt.dll_wcsncpy]
mov rax, qword [rbp + 0x10]
mov ecx, dword [rax + 8]
mov dword [rbx + 0x40], ecx
mov rax, qword [rbp + 0x10]
mov ecx, dword [rax + 0x18]
mov dword [rbx + 0x50], ecx
mov rax, qword [rbp + 0x10]
mov ecx, dword [rax + 0x14]
mov dword [rbx + 0x4c], ecx
mov rax, qword [rbp + 0x10]
mov ecx, dword [rax + 0xc]
mov dword [rbx + 0x44], ecx
mov rax, qword [rbp + 0x10]
mov ecx, dword [rax + 0x1c]
mov dword [rbx + 0x54], ecx
mov rax, qword [rbp + 0x10]
mov ecx, dword [rax + 0x10]
mov dword [rbx + 0x48], ecx
jmp 0x1800165fa
mov eax, 0x1000
lea rsi, [rbx + 0x38]
mov dword [rbx + 0x40], 3
mov dword [rbx + 0x4c], 0xff
mov dword [rbx + 0x44], 6
mov dword [rbx + 0x48], 0x4e20
mov dword [rbx + 0x50], eax
mov dword [rbx + 0x54], eax
cmp qword [rsi], rdi
je 0x1800165d2
mov r8, qword [rsi]
mov rcx, qword [rbx + 0x20]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_HeapFree]
test eax, eax
je 0x1800165d2
mov qword [rsi], rdi
mov rcx, qword [rbx + 0x20]
mov rdx, rsi
call fcn.180030c74
test al, al
je 0x180016421
mov r8, qword [rsi]
lea rdx, str.PipeName___s_n
mov ecx, 0x83
call fcn.180030818
cmp qword [rbx + 0x68], 0xffffffffffffffff
mov eax, dword [rbp + 8]
mov dword [rbx + 0x30], eax
mov rax, qword [rbp + 0x18]
mov qword [rbx + 0x28], rax
jne 0x180016656
xor r9d, r9d
xor r8d, r8d
xor edx, edx
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateEventW]
mov qword [rbx + 0x68], rax
test rax, rax
jne 0x180016656
cmp qword [rsi], rdi
je 0x18001664c
mov r8, qword [rsi]
mov rcx, qword [rbx + 0x20]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_HeapFree]
test eax, eax
je 0x180016421
mov qword [rsi], rdi
jmp 0x180016421
mov ecx, 0x8e
jmp 0x180016492
cmp dword [rbx + 0x30], edi
mov al, 1
setne dil
mov dword [rbx + 0x60], edi
mov rbx, qword [rsp + 0x30]
mov rbp, qword [rsp + 0x38]
mov rsi, qword [rsp + 0x40]
add rsp, 0x20
pop rdi
ret