Function at 0x4161e0
Capabilities:
Resume thread

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x69a57e
mov eax, dword fs:[0]
push eax
sub esp, 0x38
push ebx
push esi
push edi
mov eax, dword [0x76f950]
xor eax, esp
push eax
lea eax, [esp + 0x48]
mov dword fs:[0], eax
mov edi, ecx
mov dword [esp + 0x14], edi
mov al, byte [edi + 4]
test al, al
jne 0x416434
mov ebx, dword [sym.imp.KERNEL32.dll_ResumeThread]
lea esi, [edi + 0x30]
cmp dword [0x77b0bc], 0
jne 0x4162a7
push 0x1c
call fcn.006341f8
mov edi, eax
add esp, 4
mov dword [esp + 0x18], edi
mov dword [esp + 0x50], 0
test edi, edi
je 0x416293
push ecx
mov ecx, edi
call fcn.004e7a50
mov byte [esp + 0x50], 1
push ecx
lea ecx, [edi + 0x14]
mov dword [edi], vtable.tTVPWatchThread.0
call fcn.004e7cc0
mov byte [esp + 0x50], 2
call dword [sym.imp.WINMM.dll_timeGetTime]
push 0
push dword [edi + 8]
mov dword [0x796c18], eax
call dword [sym.imp.KERNEL32.dll_SetThreadPriority]
push dword [edi + 8]
call ebx
cmp eax, 1
jg 0x416282
mov byte [esp + 0x50], 0
jmp 0x416295
xor edi, edi
mov dword [esp + 0x50], 0xffffffff
mov dword [0x77b0bc], edi
mov edi, dword [esp + 0x14]
push 0x789f34
mov dword [esp + 0x20], 0x789f34
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [esp + 0x50], 3
call dword [sym.imp.WINMM.dll_timeGetTime]
mov ebx, eax
cmp ebx, dword [0x796c18]
jae 0x4162e0
add dword [0x77c2c0], 0
adc dword [0x77c2c4], 1
mov dword [0x796c18], ebx
mov dword [esp + 0x50], 0xffffffff
push 0x789f34
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor eax, eax
add ebx, dword [0x77c2c0]
push esi
adc eax, dword [0x77c2c4]
mov dword [esp + 0x24], esi
shld eax, ebx, 0x10
mov dword [esp + 0x1c], eax
shl ebx, 0x10
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [esp + 0x50], 4
cmp byte [edi + 0x48], 0
je 0x4163ee
mov edx, dword [esp + 0x18]
cmp dword [edi + 0x1c], edx
ja 0x4163b7
jb 0x416343
cmp dword [edi + 0x18], ebx
ja 0x4163b7
mov eax, dword [edi + 0x4c]
lea ecx, [edi + 0x4c]
lea edx, [esp + 0x30]
push edx
mov byte [0x77a642], 1
mov dword [esp + 0x34], 0
mov dword [esp + 0x38], 0
mov dword [esp + 0x3c], 0x8004
mov dword [esp + 0x40], 0
mov dword [esp + 0x44], 0
call dword [eax + 0x10]
mov edx, dword [esp + 0x18]
mov eax, dword [edi + 0x18]
cmp dword [edi + 0x1c], edx
ja 0x4163b7
jb 0x416392
cmp eax, ebx
ja 0x4163b7
mov esi, dword [edi + 0x1c]
mov ecx, dword [edi + 0x20]
add ecx, eax
mov eax, dword [edi + 0x24]
adc eax, esi
mov dword [edi + 0x1c], eax
mov esi, dword [edi + 0x1c]
mov dword [edi + 0x18], ecx
mov eax, ecx
cmp esi, edx
jb 0x416395
ja 0x4163b4
cmp eax, ebx
jbe 0x416395
lea esi, [edi + 0x30]
mov eax, dword [esp + 0x14]
mov edi, dword [edi + 0x18]
mov ecx, dword [eax + 0x1c]
sub edi, ebx
movzx eax, di
sbb ecx, edx
or eax, 0
mov dword [esp + 0x24], edi
je 0x4163e1
shrd edi, ecx, 0x10
mov eax, 1
shr ecx, 0x10
add edi, eax
jmp 0x4163f3
shrd edi, ecx, 0x10
xor eax, eax
shr ecx, 0x10
add edi, eax
jmp 0x4163f3
mov edi, 0x2710
mov dword [esp + 0x50], 0xffffffff
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
test edi, edi
mov eax, 1
cmove edi, eax
test edi, edi
mov eax, 0xffffffff
cmove edi, eax
push edi
mov edi, dword [esp + 0x18]
push dword [edi + 0x2c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp byte [edi + 4], 0
mov ebx, dword [sym.imp.KERNEL32.dll_ResumeThread]
je 0x416226
mov ecx, dword [esp + 0x48]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret