Function at 0x41039e
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
and dword [ebp - 4], 0
push esi
push edi
xor edi, edi
cmp dword [0x43e450], edi
jne 0x4103b9
call fcn.0040ffa2
mov esi, dword [0x43e454]
test esi, esi
je 0x4105aa
push ebx
push 0x20
push 1
call fcn.00425484
mov ebx, eax
pop ecx
pop ecx
test ebx, ebx
je 0x41059f
mov eax, dword [ebp + 8]
mov dword [ebx + 4], eax
mov eax, dword [ebp + 0xc]
mov dword [ebx + 8], eax
mov eax, dword [ebp + 0x10]
mov dword [ebx + 0xc], eax
mov eax, dword [ebp + 0x14]
mov dword [ebx + 0x10], eax
lea eax, [esi + 0x81c]
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea ecx, [esi + 0x818]
mov eax, dword [ecx]
mov dword [ebx], eax
mov eax, dword [ebp + 0x1c]
mov dword [ebx + 0x1c], eax
inc dword [esi + 0x808]
mov eax, dword [esi + 0x808]
cdq
sub eax, edx
mov dword [ecx], ebx
sar eax, 1
add eax, 2
cmp dword [esi + 0x80c], eax
jle 0x410466
mov ecx, ebx
test ecx, ecx
je 0x410466
lea edx, [esi + 0x818]
cmp dword [ecx + 0x14], 0
je 0x41045e
cmp dword [ecx + 0x18], 0
je 0x41045e
mov eax, dword [ecx]
mov dword [edx], eax
mov dword [ecx], edi
mov edi, ecx
dec dword [esi + 0x808]
dec dword [esi + 0x80c]
jmp 0x410460
mov edx, ecx
mov ecx, dword [edx]
test ecx, ecx
jne 0x41043c
lea eax, [esi + 0x81c]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
call fcn.0041ce57
test eax, eax
je 0x410480
xor eax, eax
jmp 0x4104a2
lea eax, [ebp - 8]
push eax
mov eax, dword [ebp + 0x18]
neg eax
sbb eax, eax
and eax, 0x10000
push eax
push ebx
push 0x410336
push dword [ebp + 0x18]
push 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
mov dword [ebx + 0x14], eax
test eax, eax
je 0x4104b5
mov dword [ebp - 4], 1
jmp 0x41059f
lea eax, [esi + 0x81c]
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esi + 0x810]
inc dword [esi + 0x80c]
mov dword [ebx + 0x18], eax
lea eax, [esi + 0x81c]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x41059f
cmp dword [esi + 0x14], 0
mov edi, dword [edi]
je 0x410598
and dword [ebp - 0xc], 0
lea eax, [ebp - 0xc]
and dword [ebp - 8], 0
push eax
push 0
push dword [esi + 0x14]
call dword [sym.imp.ntdll.dll_NtWaitForSingleObject]
mov ebx, eax
test ebx, ebx
je 0x41053a
cmp dword [esi + 0x18], 0
jne 0x41052e
or dword [ebp - 8], 0xffffffff
lea eax, [ebp - 0xc]
push eax
push 0
push dword [esi + 0x14]
mov dword [ebp - 0xc], 0xfff85ee0
call dword [sym.imp.ntdll.dll_NtWaitForSingleObject]
mov ebx, eax
test ebx, ebx
je 0x41053a
cmp dword [esi + 0x18], 0
je 0x4104ef
jmp 0x41054b
cmp dword [esi + 0x18], 0
jne 0x410547
push esi
call fcn.004105b3
pop ecx
test ebx, ebx
je 0x41058f
mov eax, dword [0x43e454]
mov eax, dword [eax + 0x810]
sub eax, dword [esi + 0x18]
cmp eax, 5
jge 0x41058f
or dword [ebp - 8], 0xffffffff
lea eax, [ebp - 0xc]
push eax
push 0
push dword [esi + 0x14]
mov dword [ebp - 0xc], 0xfffe7960
call dword [sym.imp.ntdll.dll_NtWaitForSingleObject]
test eax, eax
je 0x41058f
mov eax, dword [0x43e454]
xor ecx, ecx
add eax, 0x810
inc ecx
lock xadd dword [eax], ecx
jmp 0x41054b
push dword [esi + 0x14]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call fcn.004224ff
pop ecx
mov esi, edi
test edi, edi
jne 0x4104e3
pop ebx
mov eax, dword [ebp - 4]
pop edi
pop esi
mov esp, ebp
pop ebp
ret