Function at 0x4214e8
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 0x4f6540
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea eax, [edi + 5]
and eax, 0x8000007f
jge 0x421517
sub eax, 1
or eax, 0xffffff80
inc eax
mov esi, dword [eax*4 + 0x4fb200]
test esi, esi
je 0x421532
cmp edi, dword [esi + 0x20]
je 0x4218a4
mov esi, dword [esi + 0x1c]
test esi, esi
jne 0x421522
cmp dword [0x4f6564], 0
je 0x42154d
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x4f6564]
jne 0x421891
xor esi, esi
test esi, esi
je 0x421884
mov eax, dword [esi + 0x18]
add eax, 0x18
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
test ebx, ebx
je 0x4215bf
test byte [esi + 0x161], 0x18
jne 0x4215b6
mov edx, dword [esi + 0x20]
lea ecx, [edx + 5]
and ecx, 0x8000007f
jge 0x421586
sub ecx, 1
or ecx, 0xffffff80
inc ecx
mov eax, dword [ecx*4 + 0x4fb200]
cmp edx, dword [eax + 0x20]
jne 0x42159e
mov eax, dword [eax + 0x1c]
mov dword [ecx*4 + 0x4fb200], eax
jmp 0x4215b6
mov ecx, dword [eax + 0x1c]
cmp edx, dword [ecx + 0x20]
je 0x4215b0
mov eax, ecx
mov ecx, dword [ecx + 0x1c]
cmp edx, dword [ecx + 0x20]
jne 0x4215a6
mov edx, dword [ecx + 0x1c]
mov dword [eax + 0x1c], edx
cmp ebx, 2
je 0x421843
push 0x4f6540
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esi + 0x64]
mov dword [esi + 0x64], 0
test eax, eax
je 0x4215df
mov dword [eax + 4], 0
test ebx, ebx
je 0x42173e
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 0x421853
test eax, eax
je 0x421656
mov ecx, dword [eax]
mov dword [edx + 0x34], ecx
cmp dword [eax + 4], 0
je 0x42164c
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 0x421621
mov ecx, dword [edx + 4]
test ecx, ecx
jle 0x42168e
xor ebx, ebx
mov edi, dword [edx]
lea eax, [ebx + ebx*4]
test byte [edi + eax*4 + 0x10], 4
je 0x421689
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 0x42165f
cmp dword [edx + 0xc], 0
je 0x4216cb
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov edx, dword [esi + 0x18]
cmp eax, dword [edx + 0xc]
je 0x4216cb
cmp dword [edx + 8], 0
je 0x4216cb
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.004193c0
push dword [esi + 0x18]
call fcn.004193c0
add esp, 8
test byte [esi + 0x161], 0x18
je 0x421721
push 0x178
push 0
mov ebx, dword [esi + 0xf8]
push esi
call fcn.004aea20
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 0x421728
push esi
call fcn.004193c0
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 0x421834
mov eax, dword [esi + 0x18]
mov dword [eax + 0xc], 0
movzx eax, byte [esi + 0x16b]
test al, 1
je 0x421775
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 0x42178f
movzx edx, byte [esi + 0x15a]
mov byte [esi + 0x159], dl
and eax, 0xfffffffd
mov byte [esi + 0x16b], al
test al, 4
je 0x4217a9
movzx edx, byte [esi + 0x152]
mov byte [esi + 0x151], dl
and eax, 0xfffffffb
mov byte [esi + 0x16b], al
test al, 8
je 0x4217cf
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 0x4217e9
movzx edx, byte [esi + 0x158]
mov byte [esi + 0x157], dl
and eax, 0xffffffef
mov byte [esi + 0x16b], al
test al, 0x20
je 0x421803
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 0x421834
mov edx, dword [ecx + 0x34]
test edx, edx
je 0x421878
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 [0x4f6564], eax
jmp 0x4215bf
test eax, eax
je 0x4216cb
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 0x42185b
jmp 0x4216cb
add ecx, 0x18
push ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x421834
push 0x4f6540
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x421834
push 0x4f6540
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0
call dword [sym.imp.KERNEL32.dll_ExitThread]
cmp dword [esi + 0x18], 0
jne 0x42154f
mov esi, 0
jmp 0x42154f