Function at 0x5076ec
Capabilities:
Create thread
Resume thread

Disassembly:
push ebx
push esi
push edi
push ebp
add esp, 0xffffffd0
mov dword [0x71e190], eax
xor eax, eax
xor edx, edx
mov dword [0x71e194], eax
mov dword [0x71e18c], edx
lea ebp, [esp + 0x1c]
mov esi, 0x71e14c
mov ebx, 0x71e12c
call fcn.00507630
mov edi, eax
mov eax, dword [0x71e170]
dec edi
cmp eax, dword [0x71e174]
sete dl
and edx, 1
test dl, dl
je 0x50792c
lea ecx, [esp + 4]
push ecx
lea eax, [esp + 4]
push eax
call sub.KERNEL32.DLL_GetCurrentProcess
push eax
call sub.KERNEL32.DLL_GetProcessAffinityMask
xor edx, edx
mov dword [esp + 8], edx
mov ecx, dword [esp + 8]
mov eax, 1
shl eax, cl
and eax, dword [esp]
je 0x5077a4
mov edx, dword [0x71e174]
cmp edx, dword [0x71e184]
je 0x50778b
mov eax, dword [0x71e174]
mov dword [esp + 0xc], eax
mov ecx, dword [esp + 0xc]
mov eax, dword [esp + 8]
mov dword [ecx], eax
add dword [0x71e174], 4
jmp 0x5077a4
lea edx, [esp + 8]
mov ecx, dword [0x71e174]
push edx
push ecx
push 0x71e16c
call fcn.00426590
add esp, 0xc
inc dword [esp + 8]
cmp dword [esp + 8], 0x20
jl 0x507751
mov eax, dword [0x71e174]
cmp eax, dword [0x71e170]
sete dl
and edx, 1
test dl, dl
je 0x50792c
mov dword [esp + 0x10], 0x20
cmp eax, dword [0x71e184]
je 0x5077fa
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x18], ecx
mov eax, dword [esp + 0x18]
mov edx, dword [esp + 0x10]
mov dword [eax], edx
add dword [0x71e174], 4
jmp 0x50792c
lea ecx, [esp + 0x10]
push ecx
push eax
push 0x71e16c
call fcn.00426590
add esp, 0xc
jmp 0x50792c
push 0x18
call fcn.0055ffd8
pop ecx
mov dword [ebp], eax
mov eax, dword [ebp]
mov byte [eax], 0
push 0
push 0
push 0
push 0
call sub.KERNEL32.DLL_CreateEventA
mov edx, dword [ebp]
mov dword [edx + 8], eax
push 0
push 0
push 0
push 0
call sub.KERNEL32.DLL_CreateEventA
mov ecx, dword [ebp]
mov dword [ecx + 0xc], eax
push 0
push 4
mov eax, dword [ebp]
push eax
push 0x50769c
push 0
push 0
call sub.KERNEL32.DLL_CreateThread
mov edx, dword [ebp]
mov dword [edx + 4], eax
mov eax, dword [ebx + 8]
sub eax, dword [ebx + 4]
test eax, eax
jns 0x507872
add eax, 3
sar eax, 2
mov edx, dword [0x71e174]
sub edx, dword [0x71e170]
test edx, edx
jns 0x507888
add edx, 3
sar edx, 2
mov ecx, edx
xor edx, edx
div ecx
mov ecx, edx
shl ecx, 2
add ecx, dword [0x71e170]
mov eax, dword [ecx]
push eax
mov eax, dword [ebp]
mov edx, dword [eax + 4]
push edx
call sub.KERNEL32.DLL_SetThreadIdealProcessor
mov ecx, dword [ebp]
mov eax, dword [ecx + 4]
push eax
call sub.KERNEL32.DLL_ResumeThread
push 0xffffffffffffffff
mov edx, dword [ebp]
mov ecx, dword [edx + 0xc]
push ecx
call sub.KERNEL32.DLL_WaitForSingleObject
mov eax, dword [ebx + 8]
cmp eax, dword [ebx + 0x18]
je 0x5078e8
mov dword [esp + 0x20], eax
mov edx, dword [esp + 0x20]
mov dword [esp + 0x24], edx
mov ecx, dword [esp + 0x24]
mov eax, dword [ebp]
mov dword [ecx], eax
add dword [ebx + 8], 4
jmp 0x5078f3
push ebp
push eax
push ebx
call fcn.00507c84
add esp, 0xc
mov eax, dword [ebp]
add eax, 0xc
mov edx, dword [esi + 8]
cmp edx, dword [esi + 0x18]
je 0x50791e
mov ecx, dword [esi + 8]
mov dword [esp + 0x28], ecx
mov edx, dword [esp + 0x28]
mov dword [esp + 0x2c], edx
mov eax, dword [eax]
mov ecx, dword [esp + 0x2c]
mov dword [ecx], eax
add dword [esi + 8], 4
jmp 0x50792c
push eax
mov eax, dword [esi + 8]
push eax
push esi
call fcn.00507f78
add esp, 0xc
mov edx, dword [ebx + 8]
sub edx, dword [ebx + 4]
test edx, edx
jns 0x507939
add edx, 3
sar edx, 2
cmp edx, edi
jb 0x507812
jmp 0x50795d
mov eax, dword [eax - 4]
mov byte [eax], 1
mov ecx, dword [eax + 8]
push ecx
call sub.KERNEL32.DLL_SetEvent
sub dword [ebx + 8], 4
sub dword [esi + 8], 4
mov eax, dword [ebx + 8]
mov edx, eax
sub edx, dword [ebx + 4]
test edx, edx
jns 0x50796c
add edx, 3
sar edx, 2
cmp edx, edi
ja 0x507946
add esp, 0x30
pop ebp
pop edi
pop esi
pop ebx
ret