Function at 0x485998
Capabilities:
Terminate thread

Disassembly:
push ebp
mov ebp, esp
push esi
push edi
push ebx
sub esp, 0x28
mov esi, edx
push 0x2204ff4
mov edi, eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp edi, 0xfffffff9
lea eax, [edi + 6]
jg 0x4859ba
mov eax, edi
and eax, 0x7f
mov ebx, dword [eax*4 + 0x5e4e400]
test ebx, ebx
je 0x485d67
cmp edi, dword [ebx + 0x28]
je 0x4859e1
mov ebx, dword [ebx + 0x24]
test ebx, ebx
je 0x485d67
cmp edi, dword [ebx + 0x28]
jne 0x4859d1
mov eax, dword [ebx + 0x20]
test eax, eax
je 0x485d5a
add eax, 0x18
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
test esi, esi
je 0x485bf2
test byte [ebx + 0x1a1], 0x18
jne 0x485a6d
mov eax, dword [ebx + 0x28]
cmp eax, 0xfffffff9
lea edx, [eax + 6]
jg 0x485a14
mov edx, eax
and edx, 0x7f
mov ecx, dword [edx*4 + 0x5e4e400]
cmp eax, dword [ecx + 0x28]
jne 0x485a41
cmp eax, 0xfffffff9
jle 0x485a2b
add eax, 6
and eax, 0x7f
mov edx, dword [eax*4 + 0x5e4e400]
mov ecx, dword [edx + 0x24]
mov dword [eax*4 + 0x5e4e400], ecx
jmp 0x485a6d
cmp eax, 0xfffffff9
lea edx, [eax + 6]
jg 0x485a4b
mov edx, eax
and edx, 0x7f
mov ecx, dword [edx*4 + 0x5e4e400]
mov edx, dword [ecx + 0x24]
cmp eax, dword [edx + 0x28]
je 0x485a67
mov ecx, edx
mov edx, dword [edx + 0x24]
cmp eax, dword [edx + 0x28]
jne 0x485a5d
mov eax, dword [edx + 0x24]
mov dword [ecx + 0x24], eax
cmp esi, 2
je 0x485d3e
push 0x2204ff4
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebx + 0x7c]
mov dword [ebx + 0x7c], 0
test eax, eax
je 0x485a96
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 0x485d19
test eax, eax
je 0x485b04
mov ecx, dword [eax]
mov dword [edx + 0x34], ecx
cmp dword [eax + 4], 0
je 0x485afa
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 0x485acd
mov eax, dword [edx + 4]
test eax, eax
jle 0x485b3e
xor edi, edi
xor esi, esi
mov ecx, dword [edx]
test byte [ecx + esi + 0x10], 4
je 0x485b36
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 0x485b0f
cmp dword [edx + 0xc], 0
je 0x485b7a
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov edx, dword [ebx + 0x20]
cmp eax, dword [edx + 0xc]
je 0x485b7a
cmp dword [edx + 8], 0
je 0x485b7a
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.00480f70
push dword [ebx + 0x20]
call fcn.00480f70
add esp, 8
test byte [ebx + 0x1a1], 0x18
je 0x485bd3
push 0x1b8
push 0
push ebx
mov esi, dword [ebx + 0x124]
call fcn.004c6960
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 0x485bdc
push ebx
call fcn.00480f70
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 0x485d0f
push 0x2204ff4
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebx + 0x7c]
mov dword [ebx + 0x7c], 0
test eax, eax
je 0x485c12
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 0x485c50
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 0x485c6a
movzx edx, byte [ebx + 0x19a]
and eax, 0xfffffffd
mov byte [ebx + 0x199], dl
mov byte [ebx + 0x1ab], al
test al, 4
je 0x485c84
movzx edx, byte [ebx + 0x192]
and eax, 0xfffffffb
mov byte [ebx + 0x191], dl
mov byte [ebx + 0x1ab], al
test al, 8
je 0x485cad
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 0x485cc7
movzx edx, byte [ebx + 0x198]
and eax, 0xffffffef
mov byte [ebx + 0x197], dl
mov byte [ebx + 0x1ab], al
test al, 0x20
je 0x485ce1
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 0x485d0f
mov edx, dword [ecx + 0x34]
test edx, edx
je 0x485d4e
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 0x485b7a
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 0x485d21
jmp 0x485b7a
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [0x2205024], eax
jmp 0x485a76
add ecx, 0x18
push ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x485d0f
push 0x2204ff4
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x485d0f
cmp dword [0x2205024], 0
je 0x485d5a
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x2205024]
je 0x485d5a
push 0x2204ff4
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0
call dword [sym.imp.KERNEL32.dll_ExitThread]