Function at 0x18013f000
Capabilities:
Create thread

Disassembly:
push rsi
push rdi
push r13
push r14
sub rsp, 0x48
cmp qword [rcx + 0x70], 0
mov r13d, r8d
mov r14d, edx
mov rdi, rcx
jne 0x18013f02b
mov eax, 0x80004005
add rsp, 0x48
pop r14
pop r13
pop rdi
pop rsi
ret
lea rax, [rcx + 0x28]
mov qword [rsp + 0x78], rbx
mov qword [rsp + 0x40], rbp
mov rcx, rax
mov qword [rsp + 0x38], r12
mov qword [rsp + 0x30], r15
mov qword [rsp + 0x88], rax
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov r15d, dword [rdi + 0x18]
cmp r14d, r15d
jne 0x18013f064
xor esi, esi
jmp 0x18013f284
jge 0x18013f17d
xor esi, esi
sub r15d, r14d
mov r12d, esi
test r15d, r15d
jle 0x18013f284
nop dword [rax + rax]
mov rcx, qword [rdi + 0x68]
call qword [sym.imp.KERNEL32.dll_ResetEvent]
mov eax, 1
or r9, 0xffffffffffffffff
xchg dword [rdi + 0x60], eax
mov rcx, qword [rdi + 0x70]
xor r8d, r8d
xor edx, edx
call qword [sym.imp.KERNEL32.dll_PostQueuedCompletionStatus]
mov rcx, qword [rdi + 0x68]
mov edx, r13d
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
jne 0x18013f0d3
mov eax, esi
xchg dword [rdi + 0x60], eax
test eax, eax
je 0x18013f0db
mov ecx, 0x102
call fcn.180144c20
mov esi, eax
jmp 0x18013f284
test eax, eax
jne 0x18013f171
movsxd r8, dword [rdi + 0x18]
mov ebx, esi
mov rcx, rsi
test r8d, r8d
jle 0x18013f140
mov rax, qword [rdi + 8]
mov edx, dword [rdi + 0x20]
cmp dword [rax], edx
je 0x18013f104
inc rcx
inc ebx
add rax, 4
cmp rcx, r8
jl 0x18013f0f0
jmp 0x18013f140
cmp ebx, 0xffffffff
je 0x18013f140
test ebx, ebx
js 0x18013f15b
cmp ebx, dword [rdi + 0x18]
jge 0x18013f15b
mov rax, qword [rdi + 0x10]
mov edx, 0xea60
mov rbp, qword [rax + rcx*8]
mov rcx, rbp
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x18013f151
mov rcx, rbp
call qword [sym.imp.KERNEL32.dll_CloseHandle]
lea rcx, [rdi + 8]
mov edx, ebx
call fcn.180140740
inc r12d
cmp r12d, r15d
jl 0x18013f080
jmp 0x18013f284
mov esi, 0x80004005
jmp 0x18013f284
xor r9d, r9d
xor r8d, r8d
mov ecx, 0xc000008c
lea edx, [r9 + 1]
call qword [sym.imp.KERNEL32.dll_RaiseException]
call fcn.180144c30
mov esi, eax
jmp 0x18013f284
xor esi, esi
sub r14d, r15d
mov ebp, esi
test r14d, r14d
jle 0x18013f284
nop dword [rax]
mov rcx, qword [rdi + 0x68]
call qword [sym.imp.KERNEL32.dll_ResetEvent]
mov edx, dword [rdi + 0x50]
lea rax, [rsp + 0x70]
mov qword [rsp + 0x28], rax
lea r8, [0x1801408c0]
mov r9, rdi
xor ecx, ecx
mov dword [rsp + 0x20], esi
call fcn.18017b9a4
mov rbx, rax
test rax, rax
je 0x18013f26d
mov rcx, qword [rdi + 0x68]
mov edx, r13d
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x18013f25f
mov eax, dword [rdi + 0x18]
mov rcx, qword [rdi + 8]
mov r8d, 4
inc eax
movsxd rdx, eax
call fcn.18017b848
test rax, rax
je 0x18013f249
mov rcx, qword [rdi + 0x10]
mov qword [rdi + 8], rax
mov eax, dword [rdi + 0x18]
inc eax
mov r8d, 8
movsxd rdx, eax
call fcn.18017b848
test rax, rax
je 0x18013f249
movsxd rdx, dword [rdi + 0x18]
mov qword [rdi + 0x10], rax
mov rax, qword [rdi + 8]
lea rcx, [rax + rdx*4]
test rcx, rcx
je 0x18013f234
mov eax, dword [rsp + 0x70]
mov dword [rcx], eax
mov rax, qword [rdi + 0x10]
lea rcx, [rax + rdx*8]
test rcx, rcx
je 0x18013f244
mov qword [rcx], rbx
inc dword [rdi + 0x18]
jmp 0x18013f252
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
inc ebp
cmp ebp, r14d
jl 0x18013f190
jmp 0x18013f284
cmp eax, 0x102
jne 0x18013f26d
mov edi, 0x80070102
jmp 0x18013f274
call fcn.180144c30
mov edi, eax
test rbx, rbx
je 0x18013f282
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov esi, edi
mov rcx, qword [rsp + 0x88]
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov r12, qword [rsp + 0x38]
mov rbp, qword [rsp + 0x40]
mov rbx, qword [rsp + 0x78]
mov r15, qword [rsp + 0x30]
mov eax, esi
add rsp, 0x48
pop r14
pop r13
pop rdi
pop rsi
ret