Function at 0x417748
Capabilities:
Terminate thread

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
mov dword [ebp - 8], ebx
mov dword [ebp - 0xc], edi
mov dword [ebp - 4], esi
mov ebx, edx
mov edi, eax
push 0x4e7a9c
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea eax, [edi + 5]
and eax, 0x8000007f
jge 0x417777
sub eax, 1
or eax, 0xffffff80
inc eax
mov esi, dword [eax*4 + 0x4e8e80]
test esi, esi
je 0x417792
cmp edi, dword [esi + 0x20]
je 0x417b04
mov esi, dword [esi + 0x1c]
test esi, esi
jne 0x417782
cmp dword [0x4e7ac0], 0
je 0x4177ad
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x4e7ac0]
jne 0x417af1
xor esi, esi
test esi, esi
je 0x417ae4
mov eax, dword [esi + 0x18]
add eax, 0x18
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
test ebx, ebx
je 0x41781f
test byte [esi + 0x161], 0x18
jne 0x417816
mov edx, dword [esi + 0x20]
lea ecx, [edx + 5]
and ecx, 0x8000007f
jge 0x4177e6
sub ecx, 1
or ecx, 0xffffff80
inc ecx
mov eax, dword [ecx*4 + 0x4e8e80]
cmp edx, dword [eax + 0x20]
jne 0x4177fe
mov eax, dword [eax + 0x1c]
mov dword [ecx*4 + 0x4e8e80], eax
jmp 0x417816
mov ecx, dword [eax + 0x1c]
cmp edx, dword [ecx + 0x20]
je 0x417810
mov eax, ecx
mov ecx, dword [ecx + 0x1c]
cmp edx, dword [ecx + 0x20]
jne 0x417806
mov edx, dword [ecx + 0x1c]
mov dword [eax + 0x1c], edx
cmp ebx, 2
je 0x417aa3
push 0x4e7a9c
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esi + 0x64]
mov dword [esi + 0x64], 0
test eax, eax
je 0x41783f
mov dword [eax + 4], 0
test ebx, ebx
je 0x41799e
mov eax, dword [esi + 0x18]
mov edx, dword [eax + 0x18]
mov dword [ebp - 0x24], edx
mov ecx, dword [eax + 0x1c]
cmp ebx, 1
mov dword [ebp - 0x20], ecx
mov edi, dword [eax + 0x20]
mov dword [ebp - 0x1c], edi
mov edx, dword [eax + 0x24]
mov dword [ebp - 0x18], edx
mov ecx, dword [eax + 0x28]
mov dword [ebp - 0x14], ecx
mov eax, dword [eax + 0x2c]
mov dword [ebp - 0x10], eax
mov edx, dword [esi + 0x18]
mov eax, dword [edx + 0x34]
je 0x417ab3
test eax, eax
je 0x4178b6
mov ecx, dword [eax]
mov dword [edx + 0x34], ecx
cmp dword [eax + 4], 0
je 0x4178ac
mov edx, dword [eax + 4]
mov dword [ebp - 0x2c], edx
mov eax, dword [eax + 8]
mov dword [ebp - 0x28], eax
push 0
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_TerminateThread]
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [esi + 0x18]
mov eax, dword [edx + 0x34]
test eax, eax
jne 0x417881
mov ecx, dword [edx + 4]
test ecx, ecx
jle 0x4178ee
xor ebx, ebx
mov edi, dword [edx]
lea eax, [ebx + ebx*4]
test byte [edi + eax*4 + 0x10], 4
je 0x4178e9
mov edx, dword [edi + eax*4 + 4]
mov dword [edx], 1
mov ecx, dword [esi + 0x18]
mov edi, dword [ecx]
push dword [edi + eax*4]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov edx, dword [esi + 0x18]
mov ecx, dword [edx + 4]
inc ebx
cmp ebx, ecx
jl 0x4178bf
cmp dword [edx + 0xc], 0
je 0x41792b
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov edx, dword [esi + 0x18]
cmp eax, dword [edx + 0xc]
je 0x41792b
cmp dword [edx + 8], 0
je 0x41792b
mov eax, dword [edx + 8]
mov dword [ebp - 0x2c], eax
mov edx, dword [edx + 0xc]
mov dword [ebp - 0x28], edx
push 0
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_TerminateThread]
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [esi + 0x18]
push dword [edx]
call fcn.00412200
push dword [esi + 0x18]
call fcn.00412200
add esp, 8
test byte [esi + 0x161], 0x18
je 0x417981
push 0x178
push 0
mov ebx, dword [esi + 0xf8]
push esi
call fcn.004a1df0
add esp, 0xc
movzx eax, byte [esi + 0x161]
or byte [esi + 0x16a], 4
and eax, 0xffffffe7
or eax, 8
mov byte [esi + 0x161], al
mov dword [esi + 0xf8], ebx
mov dword [esi + 0x20], ebx
jmp 0x417988
push esi
call fcn.00412200
pop ecx
lea ebx, [ebp - 0x24]
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push ebx
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
jmp 0x417a94
mov eax, dword [esi + 0x18]
mov dword [eax + 0xc], 0
movzx eax, byte [esi + 0x16b]
test al, 1
je 0x4179d5
movzx edi, byte [esi + 0x163]
mov edx, edi
and edx, 0xffffffdf
and edi, 0x40
shr edi, 1
or edx, edi
mov byte [esi + 0x163], dl
and eax, 0xfffffffe
mov byte [esi + 0x16b], al
test al, 2
je 0x4179ef
movzx edx, byte [esi + 0x15a]
mov byte [esi + 0x159], dl
and eax, 0xfffffffd
mov byte [esi + 0x16b], al
test al, 4
je 0x417a09
movzx edx, byte [esi + 0x152]
mov byte [esi + 0x151], dl
and eax, 0xfffffffb
mov byte [esi + 0x16b], al
test al, 8
je 0x417a2f
movzx edi, byte [esi + 0x166]
mov edx, edi
and edx, 0xfffffffd
and edi, 4
shr edi, 1
or edx, edi
mov byte [esi + 0x166], dl
and eax, 0xfffffff7
mov byte [esi + 0x16b], al
test al, 0x10
je 0x417a49
movzx edx, byte [esi + 0x158]
mov byte [esi + 0x157], dl
and eax, 0xffffffef
mov byte [esi + 0x16b], al
test al, 0x20
je 0x417a63
movzx edx, byte [esi + 0x15c]
mov byte [esi + 0x15b], dl
and eax, 0xffffffdf
mov byte [esi + 0x16b], al
mov eax, dword [esi + 0x18]
push dword [eax + 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esi + 0x18]
and byte [eax + 0x44], 0xfe
mov ecx, dword [esi + 0x18]
test byte [ecx + 0x44], 2
jne 0x417a94
mov edx, dword [ecx + 0x34]
test edx, edx
je 0x417ad8
mov eax, dword [edx]
mov dword [ecx + 0x34], eax
push dword [edx + 0xc]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov ebx, dword [ebp - 8]
mov esi, dword [ebp - 4]
mov edi, dword [ebp - 0xc]
xor eax, eax
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [0x4e7ac0], eax
jmp 0x41781f
test eax, eax
je 0x41792b
mov ecx, dword [eax]
mov dword [edx + 0x34], ecx
push dword [eax + 0xc]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov edx, dword [esi + 0x18]
mov eax, dword [edx + 0x34]
test eax, eax
jne 0x417abb
jmp 0x41792b
add ecx, 0x18
push ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x417a94
push 0x4e7a9c
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x417a94
push 0x4e7a9c
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0
call dword [sym.imp.KERNEL32.dll_ExitThread]
cmp dword [esi + 0x18], 0
jne 0x4177af
mov esi, 0
jmp 0x4177af