Function at 0x1400331d0
Capabilities:
Hijack thread execution
Resume thread
Suspend thread

Disassembly:
push r13
push r12
push rsi
push rbx
sub rsp, 0x4f8
mov rsi, rcx
test rcx, rcx
je 0x1400330be
lea r12, [0x140279208]
mov rcx, r12
call fcn.140030000
mov rcx, rsi
call fcn.140031420
mov rcx, r12
mov rbx, rax
call fcn.140030320
test rbx, rbx
je 0x1400330be
mov rcx, qword [rbx + 0x28]
lea rax, [rcx - 1]
cmp rax, 0xfffffffffffffffd
ja 0x1400330be
lea r12, [rsp + 0x20]
mov rdx, r12
call qword [sym.imp.KERNEL32.dll_GetHandleInformation]
test eax, eax
je 0x1400330be
lea r13, [rbx + 0x38]
mov rcx, r13
call fcn.140030000
call fcn.140031f80
test rax, rax
je 0x14003305b
cmp rsi, qword [rax + 0x1d8]
je 0x1400330d8
mov edx, dword [rbx + 0x44]
movzx eax, byte [rbx + 0x40]
and edx, 3
cmp edx, 3
je 0x140033130
test al, 3
jne 0x1400330b0
and eax, 0xfffffffc
or eax, 1
mov byte [rbx + 0x40], al
lock add dword [0x1403f49c8], 1
mov rcx, qword [rbx + 0x30]
test rcx, rcx
je 0x140033092
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, r13
call fcn.140030320
xor eax, eax
add rsp, 0x4f8
pop rbx
pop rsi
pop r12
pop r13
ret
mov rcx, r13
call fcn.140030320
test byte [rbx + 0x40], 0xc
je 0x14003309a
mov eax, 3
add rsp, 0x4f8
pop rbx
pop rsi
pop r12
pop r13
ret
movzx eax, byte [rbx + 0x40]
test al, 3
jne 0x1400330b0
and eax, 0xfffffffc
or eax, 1
mov byte [rbx + 0x40], al
lock add dword [0x1403f49c8], 1
mov rcx, qword [rbx + 0x30]
test rcx, rcx
je 0x140033100
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov eax, dword [rbx + 0x44]
mov edx, eax
and edx, 3
cmp edx, 3
jne 0x140033092
and eax, 0xfffffffe
mov rcx, r13
mov dword [rbx + 0x44], eax
movzx eax, byte [rbx + 0x40]
and eax, 0xfffffff3
or eax, 4
mov byte [rbx + 0x40], al
call fcn.140030320
call fcn.140032d30
nop dword [rax]
test al, 0xc
jne 0x1400330b0
test al, 0xf
jne 0x1400330be
mov rcx, qword [rbx + 0x28]
mov dword [rsp + 0x50], 0x100001
call qword [sym.imp.KERNEL32.dll_SuspendThread]
xor edx, edx
mov rcx, qword [rbx + 0x28]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
jne 0x140033092
mov rcx, qword [rbx + 0x28]
mov rdx, r12
call qword [sym.imp.KERNEL32.dll_GetThreadContext]
lea rax, [fcn.140032d30]
mov rcx, qword [rbx + 0x28]
mov rdx, r12
mov qword [rsp + 0x118], rax
call qword [sym.imp.KERNEL32.dll_SetThreadContext]
movzx eax, byte [rbx + 0x40]
and dword [rbx + 0x44], 0xfffffffe
and eax, 0xfffffff0
or eax, 5
mov byte [rbx + 0x40], al
lock add dword [0x1403f49c8], 1
mov rcx, qword [rbx + 0x30]
test rcx, rcx
je 0x1400331b6
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, r13
call fcn.140030320
mov rcx, qword [rbx + 0x28]
call qword [sym.imp.KERNEL32.dll_ResumeThread]
jmp 0x140033092
push r13
push r12
push rbx
sub rsp, 0x20
lea r13, [0x140279208]
mov r12, rcx
mov rcx, r13
mov ebx, edx
call fcn.140030000
mov rcx, r12
call fcn.140031420
test rax, rax
je 0x140033250
cmp qword [rax + 0x1d8], r12
jne 0x140033250
test byte [rax + 0x40], 0xc
jne 0x140033250
mov edx, dword [rax + 0xbc]
test edx, edx
jne 0x140033250
mov rax, qword [rax + 0x28]
sub rax, 1
cmp rax, 0xfffffffffffffffd
ja 0x140033250
mov rcx, r13
call fcn.140030320
test ebx, ebx
je 0x140033270
lea edx, [rbx - 2]
cmp edx, 0x15
ja 0x140033278
mov rcx, r12
add rsp, 0x20
pop rbx
pop r12
pop r13
jmp 0x140032fd0
mov rcx, r13
call fcn.140030320
mov eax, 3
add rsp, 0x20
pop rbx
pop r12
pop r13
ret
xor eax, eax
jmp 0x14003325d
mov eax, 0x16
jmp 0x14003325d