Function at 0x4c9f40
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
push ebx
push esi
push edi
mov edi, ecx
cmp dword [edi + 0x40], 0
jne 0x4c9f5f
mov eax, 0x80004005
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
lea eax, [edi + 0x14]
push eax
mov dword [ebp - 0xc], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ecx, dword [edi + 0xc]
mov eax, dword [ebp + 8]
cmp eax, ecx
je 0x4ca05e
jge 0x4ca0a8
sub ecx, eax
mov dword [ebp + 8], 0
mov dword [ebp - 4], ecx
test ecx, ecx
jle 0x4ca05e
push dword [edi + 0x3c]
mov esi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
lea ebx, [edi + 0x38]
call dword [sym.imp.KERNEL32.dll_ResetEvent]
push 1
push ebx
call esi
push 0xffffffffffffffff
push 0
push 0
push dword [edi + 0x40]
call dword [sym.imp.KERNEL32.dll_PostQueuedCompletionStatus]
push dword [ebp + 0xc]
push dword [edi + 0x3c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
jne 0x4c9ff9
push 0
push ebx
call esi
test eax, eax
je 0x4ca001
push 0x102
call fcn.004cd1a0
add esp, 4
mov edi, eax
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
test eax, eax
jne 0x4ca08d
mov ecx, dword [edi + 0xc]
xor esi, esi
test ecx, ecx
jle 0x4ca04e
mov eax, dword [edi + 4]
mov edx, dword [edi + 0x10]
cmp dword [eax], edx
je 0x4ca01e
inc esi
add eax, 4
cmp esi, ecx
jl 0x4ca010
jmp 0x4ca04e
cmp esi, 0xffffffff
je 0x4ca04e
push esi
lea ecx, [edi + 4]
call fcn.004ca4f0
push 0xea60
mov ebx, dword [eax]
push ebx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x4ca074
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
lea ecx, [edi + 4]
call fcn.004ca8e0
mov ebx, dword [ebp + 8]
inc ebx
mov dword [ebp + 8], ebx
cmp ebx, dword [ebp - 4]
jl 0x4c9f94
xor edi, edi
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
push dword [ebp - 0xc]
mov edi, 0x80004005
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
call fcn.004650a0
push dword [ebp - 0xc]
mov edi, eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
sub eax, ecx
xor ebx, ebx
mov dword [ebp + 8], eax
test eax, eax
jle 0x4ca05e
push dword [edi + 0x3c]
call dword [sym.imp.KERNEL32.dll_ResetEvent]
lea eax, [ebp - 8]
push eax
push 0
push edi
push 0x4ca5e0
push dword [edi + 0x2c]
push 0
call fcn.00550c3a
mov esi, eax
add esp, 0x18
test esi, esi
je 0x4ca122
push dword [ebp + 0xc]
push dword [edi + 0x3c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x4ca114
lea eax, [ebp - 4]
mov dword [ebp - 4], esi
push eax
lea eax, [ebp - 8]
push eax
lea ecx, [edi + 4]
call fcn.004ca990
test eax, eax
jne 0x4ca109
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
inc ebx
cmp ebx, dword [ebp + 8]
jl 0x4ca0b3
jmp 0x4ca05e
cmp eax, 0x102
jne 0x4ca122
mov edi, 0x80070102
jmp 0x4ca129
call fcn.004650a0
mov edi, eax
test esi, esi
je 0x4ca060
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8