Function at 0x1401980f0
Capabilities:
Resume thread
Suspend thread

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x68
lea rax, [0x14020b9e8]
mov rsi, qword [rcx]
mov rdi, qword [rcx + 8]
lea rbx, [rsp + 0x40]
mov qword [rsp + 0x40], rax
mov qword [rsp + 0x58], 0
mov rcx, rbx
mov qword [rsp + 0x50], 0
mov qword [rsp + 0x48], 0
xchg qword [rax], rcx
test rcx, rcx
je 0x140198177
mov qword [rcx + 8], rbx
lea rdx, [rcx + 0x18]
xor eax, eax
mov rcx, 0xffffffffffffffff
lock cmpxchg qword [rdx], rcx
test rax, rax
mov rcx, rax
je 0x140198162
call qword [sym.imp.KERNEL32.dll_SetEvent]
lea r12, [rbx + 0x10]
xor ebp, ebp
lock xadd qword [r12], rbp
test rbp, rbp
je 0x140198354
test rsi, rsi
mov ebp, 3
je 0x14019818a
cmp edi, dword [rsi + 0x18]
je 0x140198390
mov r8, qword [rsp + 0x40]
lea rcx, [rbx + 8]
xor edx, edx
lock xadd qword [rcx], rdx
test rdx, rdx
mov rcx, rdx
je 0x140198400
add rcx, 0x10
xor eax, eax
mov rdx, 0xffffffffffffffff
lock cmpxchg qword [rcx], rdx
test rax, rax
mov rcx, rax
je 0x1401981c6
call qword [sym.imp.KERNEL32.dll_SetEvent]
test ebp, ebp
mov r14d, ebp
je 0x1401981e1
mov eax, r14d
add rsp, 0x68
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
lea rcx, [rsp + 0x30]
call sym.pthread_self
mov r12, qword [rsp + 0x30]
mov r13, qword [rsp + 0x38]
test r12, r12
je 0x140198430
mov qword [rsp + 0x58], 0
lea rax, [rsi + 0x38]
mov rcx, rbx
mov qword [rsp + 0x40], rax
mov qword [rsp + 0x50], 0
mov qword [rsp + 0x48], 0
xchg qword [rax], rcx
test rcx, rcx
je 0x140198266
mov qword [rcx + 8], rbx
lea rdx, [rcx + 0x18]
xor eax, eax
mov rcx, 0xffffffffffffffff
lock cmpxchg qword [rdx], rcx
test rax, rax
mov rcx, rax
je 0x140198251
call qword [sym.imp.KERNEL32.dll_SetEvent]
lea r15, [rbx + 0x10]
xor r14d, r14d
lock xadd qword [r15], r14
test r14, r14
je 0x1401983a0
mov eax, dword [rsi + 0x190]
test eax, eax
jne 0x1401982f3
mov r14d, dword [rsi + 0x18c]
test r14d, r14d
jne 0x1401982f3
mov eax, dword [rsi + 0x28]
cmp eax, 3
ja 0x1401982f3
cmp edi, r13d
jne 0x140198296
cmp r12, rsi
je 0x1401984bc
mov rdi, qword [rsi + 8]
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_SuspendThread]
xor edx, edx
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
jne 0x1401981cd
xor r8d, r8d
mov rdx, rdi
mov dword [rsi + 0x28], 4
mov dword [rsi + 0x18c], 1
lea rcx, [sym.ptw32_cancel_callback]
call qword [0x14020b9f0]
mov rcx, rbx
call sym.ptw32_mcs_lock_release
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_ResumeThread]
jmp 0x1401981cd
mov eax, dword [rsi + 0x28]
cmp eax, 2
jbe 0x1401983e0
mov eax, dword [rsi + 0x28]
cmp eax, 3
jbe 0x14019830c
mov ebp, 3
mov r8, qword [rsp + 0x40]
lea rcx, [rbx + 8]
xor edx, edx
lock xadd qword [rcx], rdx
test rdx, rdx
mov rcx, rdx
je 0x140198460
add rcx, 0x10
xor eax, eax
mov rdx, 0xffffffffffffffff
lock cmpxchg qword [rcx], rdx
test rax, rax
mov rcx, rax
mov r14d, ebp
je 0x1401981cd
call qword [sym.imp.KERNEL32.dll_SetEvent]
jmp 0x1401981cd
xor r9d, r9d
xor r8d, r8d
xor edx, edx
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateEventA]
mov r13, rax
mov rax, rbp
lock cmpxchg qword [r12], r13
test rax, rax
je 0x140198440
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x140198177
cmp qword [rsi + 8], 1
sbb ebp, ebp
and ebp, 3
jmp 0x14019818a
xor r8d, r8d
xor r9d, r9d
xor edx, edx
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateEventA]
mov r8, rax
mov rax, r14
lock cmpxchg qword [r15], r8
test rax, rax
je 0x140198490
mov rcx, r8
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [rsi + 0x190]
test eax, eax
jne 0x1401982f3
jmp 0x140198274
mov dword [rsi + 0x28], 3
mov rcx, qword [rsi + 0x40]
call qword [sym.imp.KERNEL32.dll_SetEvent]
test eax, eax
jne 0x14019830c
jmp 0x140198307
mov rax, rbx
lock cmpxchg qword [r8], rdx
cmp rbx, rax
je 0x1401981c6
lea rcx, [rbx + 0x18]
lock xadd qword [rcx], rdx
test rdx, rdx
je 0x140198453
lea rax, [rbx + 8]
xor ecx, ecx
lock xadd qword [rax], rcx
jmp 0x1401981a6
mov r14d, 0xc
jmp 0x1401981cd
mov edx, 0xffffffff
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
jmp 0x140198379
call sym.ptw32_mcs_flag_wait.part.0
jmp 0x14019841f
mov rax, rbx
lock cmpxchg qword [r8], rdx
cmp rbx, rax
je 0x1401984b4
lea rcx, [rbx + 0x18]
lock xadd qword [rcx], rdx
test rdx, rdx
je 0x1401984ad
add rbx, 8
xor ecx, ecx
lock xadd qword [rbx], rcx
jmp 0x140198328
mov rcx, r8
mov qword [rsp + 0x28], r8
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov r8, qword [rsp + 0x28]
jmp 0x1401983c4
call sym.ptw32_mcs_flag_wait.part.0
jmp 0x14019847b
mov r14d, ebp
jmp 0x1401981cd
mov rcx, rbx
mov dword [rsi + 0x28], 4
mov dword [rsi + 0x18c], 1
call sym.ptw32_mcs_lock_release
mov ecx, 2
call sym.ptw32_throw
nop