Function at 0x140016964
Capabilities:
Allocate or change rwx memory

Disassembly:
mov qword [rsp + 0x10], rbx
mov qword [rsp + 8], rcx
push rsi
push rdi
push r14
sub rsp, 0x20
xor edi, edi
xor r8d, r8d
xor eax, eax
or r11, 0xffffffffffffffff
lea r14d, [rdi + 1]
mov r9d, r14d
lock cmpxchg qword [0x140165a00], r14
je 0x1400169b6
cmp rax, r11
lea rcx, [rax + 1]
cmove rcx, r9
cmove rax, r8
mov r9, rcx
mov r8, rax
lock cmpxchg qword [0x140165a00], r9
cmp rax, r8
jne 0x140016993
mov r8, qword [0x1401659f8]
mov ebx, 0x3ef
test r8, r8
je 0x140016aa0
cmp rdx, r8
jb 0x1400169dc
lea r9, [r8 + 0xfbc0]
cmp rdx, r9
jb 0x1400169e5
mov r8, qword [r8 + 0xfbd0]
jmp 0x1400169c2
xor eax, eax
lock cmpxchg qword [r9], r11
jne 0x1400169e5
sub rdx, r8
mov cl, 2
shr rdx, 6
lea rax, [rdx - 1]
test rax, rax
js 0x140016a0f
cmp byte [r8 + rax + 0xfc00], cl
jne 0x140016a0f
sub rax, r14
jns 0x140016a00
add rax, r14
cmp byte [rdx + r8 + 0xfc00], cl
jne 0x140016a29
add rdx, r14
cmp byte [r8 + rdx + 0xfc00], cl
je 0x140016a1c
cmp rax, rdx
jg 0x140016a4c
sub rdx, rax
lea rcx, [r8 + 0xfc00]
lea rcx, [rcx + rax]
add rdx, r14
je 0x140016a4c
mov byte [rcx], dil
add rcx, r14
sub rdx, r14
jne 0x140016a41
xor eax, eax
xor edx, edx
xchg qword [r9], rax
xor eax, eax
mov r10, r14
lock cmpxchg qword [r9], r14
je 0x140016a7e
cmp rax, r11
lea rcx, [rax + 1]
cmove rcx, r10
cmove rax, rdx
mov r10, rcx
mov rdx, rax
lock cmpxchg qword [r9], r10
cmp rax, rdx
jne 0x140016a5f
xor eax, eax
cmp byte [r8 + rax + 0xfc00], dil
jne 0x140016a95
add rax, r14
cmp rax, rbx
jb 0x140016a80
mov rax, r11
lock add qword [r9], r11
cmp rax, r11
cmove rdi, r8
lock add qword [0x140165a00], r11
test rdi, rdi
je 0x140016be6
xor esi, esi
xor eax, eax
lock cmpxchg qword [0x140165a00], r11
jne 0x140016ab3
mov rdx, qword [0x1401659f8]
lea r8, [0x1401659f8]
test rdx, rdx
je 0x140016b93
cmp rdx, rdi
jne 0x140016b36
xor r9d, r9d
mov r10, r14
xor eax, eax
lock cmpxchg qword [rdx + 0xfbc0], r14
je 0x140016b12
cmp rax, r11
lea rcx, [rax + 1]
cmove rcx, r10
cmove rax, r9
mov r10, rcx
mov r9, rax
lock cmpxchg qword [rdx + 0xfbc0], r10
cmp rax, r9
jne 0x140016aef
xor eax, eax
cmp byte [rdx + rax + 0xfc00], sil
jne 0x140016b29
add rax, r14
cmp rax, rbx
jb 0x140016b14
mov rax, r11
lock add qword [rdx + 0xfbc0], r11
cmp rax, r11
je 0x140016b45
mov r8, qword [r8]
add r8, 0xfbd0
mov rdx, qword [r8]
jmp 0x140016ace
cmp qword [0x140165a08], r14
mov rbx, qword [r8]
jbe 0x140016b67
mov rax, qword [rbx + 0xfbd0]
mov esi, r14d
mov qword [r8], rax
sub qword [0x140165a08], r14
jmp 0x140016b93
lea r9, [rsp + 0x40]
mov edx, 0x10000
mov r8d, 4
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_VirtualProtect]
nop dword [rax + rax]
and dword [rbx + 0xfbc8], esi
add qword [0x140165a10], r14
xor eax, eax
xchg qword [0x140165a00], rax
test esi, esi
je 0x140016be6
call qword [sym.imp.KERNEL32.dll_GetLastError]
nop dword [rax + rax]
lea rcx, [rdi + 0xfbe0]
mov ebx, eax
call qword [sym.imp.ntdll.dll_RtlDeleteFunctionTable]
nop dword [rax + rax]
xor edx, edx
mov r8d, 0x8000
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_VirtualFree]
nop dword [rax + rax]
mov ecx, ebx
call qword [sym.imp.KERNEL32.dll_SetLastError]
nop dword [rax + rax]
mov rbx, qword [rsp + 0x48]
add rsp, 0x20
pop r14
pop rdi
pop rsi
ret