Function at 0x50ff40
Capabilities:
Create thread

Disassembly:
push 0xffffffffffffffff
push 0x56841e
mov eax, dword fs:[0]
push eax
push ebx
push ebp
push esi
push edi
mov eax, dword [0x5b3890]
xor eax, esp
push eax
lea eax, [esp + 0x14]
mov dword fs:[0], eax
xor edi, edi
test byte [0x5bee50], 1
mov esi, 1
jne 0x50ffd0
or dword [0x5bee50], esi
push 0x5bee1c
mov dword [0x5bee34], 0xbcdd
mov byte [0x5bee38], 0
mov dword [0x5bee40], edi
mov dword [0x5bee44], edi
mov dword [0x5bee48], 0xffffffff
mov byte [0x5bee4c], 1
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
push 0x56ab80
mov dword [0x5bee3c], edi
mov dword [0x5bee34], 0xbcaa
call fcn.005194de
add esp, 4
test byte [0x5bee50], 2
jne 0x50fffb
or dword [0x5bee50], 2
mov ecx, 0x5bedc8
mov dword [esp + 0x1c], edi
call fcn.004612c0
push 0x56abb0
call fcn.005194de
add esp, 4
mov ebp, dword [esp + 0x28]
mov dword [0x5bed9c], 0x5bedc8
push esi
cmp ebp, edi
jne 0x5100dc
mov ecx, 0x5bee34
call fcn.004017c0
push esi
mov ecx, 0x5bee34
mov dword [esp + 0x2c], 0x5bee1c
call fcn.004017c0
push 0x5bee1c
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
add dword [0x5bee3c], esi
mov dword [0x5bee40], 0x5850b0
mov dword [0x5bee44], 0x16b
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [0x5bee48], eax
mov eax, dword [0x5bed94]
mov dword [esp + 0x1c], esi
mov byte [0x5beda0], 1
cmp eax, edi
je 0x51007c
push edi
push esi
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
push 0x2710
push 0xffffffffffffffff
push 0x5bed98
call fcn.004b4f20
mov eax, dword [0x5bed94]
add esp, 0xc
cmp eax, edi
je 0x5100a6
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [0x5bed94], edi
mov ecx, 0x5bedc8
call fcn.0050f530
mov eax, dword [0x5bee3c]
sub eax, esi
cmp eax, edi
mov dword [0x5bee3c], eax
jg 0x5100cc
mov dword [0x5bee40], edi
mov dword [0x5bee44], edi
push 0x5bee1c
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x510288
mov ecx, 0x5bee00
call fcn.004017c0
push esi
mov ecx, 0x5bee00
mov dword [esp + 0x2c], 0x5bede8
call fcn.004017c0
mov ebx, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push 0x5bede8
call ebx
add dword [0x5bee08], esi
mov dword [0x5bee0c], 0x5850b0
mov dword [0x5bee10], 0x181
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [0x5bee14], eax
mov ecx, 0x5bedc8
mov dword [esp + 0x1c], 2
call fcn.0050fc00
mov esi, eax
mov eax, dword [esi]
mov edx, dword [eax]
mov ecx, esi
call edx
test ebp, ebp
jle 0x510166
jmp 0x510150
mov ecx, dword [esp + 0x24]
mov edx, dword [ecx + edi*4]
mov eax, dword [esi]
mov eax, dword [eax + 4]
push edx
mov ecx, esi
call eax
inc edi
cmp edi, ebp
jl 0x510150
mov eax, dword [0x5bee08]
dec eax
xor ecx, ecx
cmp eax, ecx
mov dword [0x5bee08], eax
jg 0x510183
mov dword [0x5bee0c], ecx
mov dword [0x5bee10], ecx
mov esi, dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0x5bede8
call esi
push 1
mov ecx, 0x5bee34
call fcn.004017c0
push 1
mov ecx, 0x5bee34
call fcn.004017c0
push 0x5bee1c
call ebx
inc dword [0x5bee3c]
mov dword [0x5bee40], 0x5850b0
mov dword [0x5bee44], 0x18c
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [0x5bee48], eax
mov eax, dword [0x5bed94]
xor edi, edi
mov byte [0x5beda0], 0
cmp eax, edi
jne 0x510232
push edi
push 1
push edi
push edi
call dword [sym.imp.KERNEL32.dll_CreateSemaphoreW]
mov dword [0x5bed94], eax
cmp eax, edi
jne 0x510232
mov eax, dword [0x5bee3c]
dec eax
cmp eax, edi
mov dword [0x5bee3c], eax
jg 0x510215
mov dword [0x5bee40], edi
mov dword [0x5bee44], edi
push 0x5bee1c
call esi
xor al, al
mov ecx, dword [esp + 0x14]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
cmp dword [0x5bed98], edi
jne 0x51025c
mov ecx, dword [esp + 0x2c]
push edi
push edi
push ecx
push 0x50fe10
push edi
push edi
call dword [sym.imp.KERNEL32.dll_CreateThread]
mov dword [0x5bed98], eax
cmp eax, edi
je 0x5101fa
mov eax, dword [0x5bed94]
push edi
push 1
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
mov eax, dword [0x5bee3c]
dec eax
cmp eax, edi
mov dword [0x5bee3c], eax
jg 0x510281
mov dword [0x5bee40], edi
mov dword [0x5bee44], edi
push 0x5bee1c
call esi
mov al, 1
mov ecx, dword [esp + 0x14]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret