Function at 0x617ee8
Capabilities:
Terminate thread

Disassembly:
push ebp
mov ebp, esp
push esi
push edi
push ebx
sub esp, 0x28
mov esi, edx
push 0x7fce34
mov edi, eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp edi, 0xfffffff9
lea eax, [edi + 6]
jg 0x617f0a
mov eax, edi
and eax, 0x7f
mov ebx, dword [eax*4 + 0x22df8e0]
test ebx, ebx
je 0x6182b7
cmp edi, dword [ebx + 0x28]
je 0x617f31
mov ebx, dword [ebx + 0x24]
test ebx, ebx
je 0x6182b7
cmp edi, dword [ebx + 0x28]
jne 0x617f21
mov eax, dword [ebx + 0x20]
test eax, eax
je 0x6182aa
add eax, 0x18
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
test esi, esi
je 0x618142
test byte [ebx + 0x1a1], 0x18
jne 0x617fbd
mov eax, dword [ebx + 0x28]
cmp eax, 0xfffffff9
lea edx, [eax + 6]
jg 0x617f64
mov edx, eax
and edx, 0x7f
mov ecx, dword [edx*4 + 0x22df8e0]
cmp eax, dword [ecx + 0x28]
jne 0x617f91
cmp eax, 0xfffffff9
jle 0x617f7b
add eax, 6
and eax, 0x7f
mov edx, dword [eax*4 + 0x22df8e0]
mov ecx, dword [edx + 0x24]
mov dword [eax*4 + 0x22df8e0], ecx
jmp 0x617fbd
cmp eax, 0xfffffff9
lea edx, [eax + 6]
jg 0x617f9b
mov edx, eax
and edx, 0x7f
mov ecx, dword [edx*4 + 0x22df8e0]
mov edx, dword [ecx + 0x24]
cmp eax, dword [edx + 0x28]
je 0x617fb7
mov ecx, edx
mov edx, dword [edx + 0x24]
cmp eax, dword [edx + 0x28]
jne 0x617fad
mov eax, dword [edx + 0x24]
mov dword [ecx + 0x24], eax
cmp esi, 2
je 0x61828e
push 0x7fce34
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebx + 0x7c]
mov dword [ebx + 0x7c], 0
test eax, eax
je 0x617fe6
mov dword [eax + 4], 0
mov edx, dword [ebx + 0x20]
mov eax, dword [edx + 0x18]
mov ecx, dword [edx + 0x1c]
mov edi, dword [edx + 0x20]
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], ecx
mov dword [ebp - 0x24], edi
mov eax, dword [edx + 0x24]
mov ecx, dword [edx + 0x28]
mov edi, dword [edx + 0x2c]
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0x18], edi
mov eax, dword [edx + 0x34]
cmp esi, 1
je 0x618269
test eax, eax
je 0x618054
mov ecx, dword [eax]
mov dword [edx + 0x34], ecx
cmp dword [eax + 4], 0
je 0x61804a
mov edx, dword [eax + 4]
mov dword [ebp - 0x14], edx
mov eax, dword [eax + 8]
mov dword [ebp - 0x10], eax
push 0
mov eax, dword [ebp - 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_TerminateThread]
mov eax, dword [ebp - 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [ebx + 0x20]
mov eax, dword [edx + 0x34]
test eax, eax
jne 0x61801d
mov eax, dword [edx + 4]
test eax, eax
jle 0x61808e
xor edi, edi
xor esi, esi
mov ecx, dword [edx]
test byte [ecx + esi + 0x10], 4
je 0x618086
mov eax, dword [ecx + esi + 4]
mov dword [eax], 1
mov edx, dword [ebx + 0x20]
mov ecx, dword [edx]
push dword [ecx + esi]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov edx, dword [ebx + 0x20]
mov eax, dword [edx + 4]
inc edi
add esi, 0x14
cmp edi, eax
jl 0x61805f
cmp dword [edx + 0xc], 0
je 0x6180ca
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov edx, dword [ebx + 0x20]
cmp eax, dword [edx + 0xc]
je 0x6180ca
cmp dword [edx + 8], 0
je 0x6180ca
mov eax, dword [edx + 8]
mov dword [ebp - 0x34], eax
mov edx, dword [edx + 0xc]
mov dword [ebp - 0x30], edx
push 0
mov eax, dword [ebp - 0x34]
push eax
call dword [sym.imp.KERNEL32.dll_TerminateThread]
mov eax, dword [ebp - 0x34]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebx + 0x20]
push dword [eax]
call fcn.005e1540
push dword [ebx + 0x20]
call fcn.005e1540
add esp, 8
test byte [ebx + 0x1a1], 0x18
je 0x618123
push 0x1b8
push 0
push ebx
mov esi, dword [ebx + 0x124]
call fcn.0065d380
add esp, 0xc
movzx eax, byte [ebx + 0x1a1]
and eax, 0xffffffe7
add eax, 8
or byte [ebx + 0x1aa], 4
mov byte [ebx + 0x1a1], al
mov dword [ebx + 0x124], esi
mov dword [ebx + 0x28], esi
jmp 0x61812c
push ebx
call fcn.005e1540
add esp, 4
lea ebx, [ebp - 0x2c]
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push ebx
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
jmp 0x61825f
push 0x7fce34
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebx + 0x7c]
mov dword [ebx + 0x7c], 0
test eax, eax
je 0x618162
mov dword [eax + 4], 0
mov eax, dword [ebx + 0x20]
mov dword [eax + 0xc], 0
movzx eax, byte [ebx + 0x1ab]
mov edx, eax
btr edx, 0
jae 0x6181a0
movzx esi, byte [ebx + 0x1a3]
mov eax, esi
shr esi, 6
and eax, 0xffffffdf
and esi, 1
shl esi, 5
or eax, esi
mov byte [ebx + 0x1a3], al
mov eax, edx
mov byte [ebx + 0x1ab], al
test al, 2
je 0x6181ba
movzx edx, byte [ebx + 0x19a]
and eax, 0xfffffffd
mov byte [ebx + 0x199], dl
mov byte [ebx + 0x1ab], al
test al, 4
je 0x6181d4
movzx edx, byte [ebx + 0x192]
and eax, 0xfffffffb
mov byte [ebx + 0x191], dl
mov byte [ebx + 0x1ab], al
test al, 8
je 0x6181fd
movzx esi, byte [ebx + 0x1a6]
mov edx, esi
shr esi, 2
and edx, 0xfffffffd
and esi, 1
and eax, 0xfffffff7
add esi, esi
or edx, esi
mov byte [ebx + 0x1a6], dl
mov byte [ebx + 0x1ab], al
test al, 0x10
je 0x618217
movzx edx, byte [ebx + 0x198]
and eax, 0xffffffef
mov byte [ebx + 0x197], dl
mov byte [ebx + 0x1ab], al
test al, 0x20
je 0x618231
movzx edx, byte [ebx + 0x19c]
and eax, 0xffffffdf
mov byte [ebx + 0x19b], dl
mov byte [ebx + 0x1ab], al
mov esi, dword [ebx + 0x20]
push dword [esi + 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
and byte [esi + 0x44], 0xfe
mov ecx, dword [ebx + 0x20]
test byte [ecx + 0x44], 2
jne 0x61825f
mov edx, dword [ecx + 0x34]
test edx, edx
je 0x61829e
mov eax, dword [edx]
mov dword [ecx + 0x34], eax
push dword [edx + 0xc]
call dword [sym.imp.KERNEL32.dll_SetEvent]
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop edi
pop esi
pop ebp
ret
test eax, eax
je 0x6180ca
mov ecx, dword [eax]
mov dword [edx + 0x34], ecx
push dword [eax + 0xc]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov edx, dword [ebx + 0x20]
mov eax, dword [edx + 0x34]
test eax, eax
jne 0x618271
jmp 0x6180ca
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [0x7fce64], eax
jmp 0x617fc6
add ecx, 0x18
push ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x61825f
push 0x7fce34
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x61825f
cmp dword [0x7fce64], 0
je 0x6182aa
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x7fce64]
je 0x6182aa
push 0x7fce34
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0
call dword [sym.imp.KERNEL32.dll_ExitThread]