Function at 0x4020f0
Capabilities:
Terminate thread

Disassembly:
push edi
push ebp
sub esp, 0x18
mov edi, ecx
lea ebp, [edi + 8]
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
mov ecx, edx
sub ecx, eax
sar ecx, 2
test ecx, ecx
jle 0x40226c
mov dword [esp + 4], edi
mov dword [esp + 8], ebx
mov dword [esp + 0xc], esi
xor ecx, ecx
mov edi, ecx
mov ebx, edx
sub ebx, eax
sar ebx, 2
cmp edi, ebx
jae 0x40227b
mov ecx, dword [eax + edi*4]
mov ebx, dword [ecx + 0x14]
cmp ebx, 1
je 0x4022d4
mov ebx, edx
sub ebx, eax
sar ebx, 2
cmp edi, ebx
jae 0x40227b
mov ebx, dword [eax + edi*4]
test ebx, ebx
je 0x402250
sub edx, eax
sar edx, 2
cmp edi, edx
jae 0x40227b
lea esi, [ebx + 0x28]
mov eax, dword [esi + 0x1c]
test eax, eax
je 0x4021a7
push dword [esi + 0x18]
call dword [sym.imp.KERNEL32.dll_SetEvent]
push 0x7d0
push dword [esi + 0x1c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
jne 0x402197
push 0xffffffffffffffff
push dword [esi + 0x1c]
call dword [sym.imp.KERNEL32.dll_TerminateThread]
push dword [esi + 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esi + 0x1c], 0
mov eax, dword [esi + 0x18]
test eax, eax
je 0x4021bc
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esi + 0x18], 0
mov dword [esp + 0x10], edi
mov dword [esp + 0x14], ebp
xor eax, eax
mov ebp, eax
mov edi, dword [esi + ebp*4 + 0x38]
test edi, edi
je 0x4021de
mov ecx, edi
call fcn.00405120
push edi
call fcn.0040c587
pop ecx
mov edx, dword [esi + ebp*4 + 0x5c]
test edx, edx
je 0x402202
mov dword [esp], edx
lea edx, [esp]
push 0xbc04
push edx
call fcn.0040a200
add esp, 8
mov dword [esi + ebp*4 + 0x5c], 0
inc ebp
cmp ebp, 4
jl 0x4021c8
mov edi, dword [esp + 0x10]
mov ebp, dword [esp + 0x14]
push dword [esi + 0x6c]
call fcn.0040cfbb
push dword [esi + 0x58]
call fcn.0040cfbb
add esp, 8
lea eax, [ebx + 0x48]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
push ebx
call fcn.0040c587
pop ecx
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
sub edx, eax
sar edx, 2
cmp edi, edx
jae 0x40227b
mov dword [eax + edi*4], 0
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
inc edi
mov ebx, edx
sub ebx, eax
sar ebx, 2
cmp edi, ebx
jl 0x40211f
mov edi, dword [esp + 4]
mov ebx, dword [esp + 8]
mov esi, dword [esp + 0xc]
test ebp, ebp
je 0x40227b
cmp eax, edx
ja 0x40227b
mov ecx, dword [ebp]
test ecx, ecx
jne 0x402280
call fcn.0040d149
cmp eax, edx
jne 0x4022cf
mov ecx, dword [edi + 4]
test ecx, ecx
je 0x402296
mov eax, dword [ecx]
call dword [eax]
mov dword [edi + 4], 0
mov ebp, dword [edi]
test ebp, ebp
je 0x4022c9
mov eax, dword [ebp]
test eax, eax
je 0x4022b5
push eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
test eax, eax
je 0x4022b5
mov dword [ebp], 0
mov dword [ebp + 4], 0
push ebp
call fcn.0040c587
pop ecx
mov dword [edi], 0
add esp, 0x18
pop ebp
pop edi
ret
mov dword [ebp + 0x10], eax
jmp 0x402284
sub edx, eax
sar edx, 2
cmp edi, edx
jae 0x40227b
add ecx, 0x28
call fcn.0040b960
mov edx, dword [ebp + 0xc]
mov eax, dword [ebp + 0x10]
sub eax, edx
sar eax, 2
cmp edi, eax
jae 0x40227b
mov eax, dword [edx + edi*4]
mov ecx, dword [eax + 0x10]
mov edx, dword [ecx]
call dword [edx + 8]
mov edx, dword [ebp + 0xc]
mov eax, dword [ebp + 0x10]
sub eax, edx
sar eax, 2
cmp edi, eax
jae 0x40227b
mov eax, dword [edx + edi*4]
mov ecx, dword [eax + 0x10]
mov edx, dword [ecx]
call dword [edx]
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
jmp 0x40213d