Function at 0x40e770
Capabilities:
Check for time delay via gettickcount

Disassembly:
sub esp, 0x58
push esi
mov esi, dword [esp + 0x70]
cmp esi, 4
push edi
je 0x40e7a1
push 0x17
call fcn.0040ce80
cmp esi, 1
jne 0x40e794
neg eax
sbb eax, eax
neg eax
add eax, esi
jmp 0x40e79b
neg eax
sbb eax, eax
add eax, 2
mov esi, eax
mov dword [esp + 0x74], eax
xor edi, edi
push esi
mov dword [esp + 0x10], edi
call fcn.0040d8c0
add esp, 4
test eax, eax
je 0x40eab7
push ebx
push ebp
lea ebx, [edi + 1]
call dword [sym.imp.USER32.dll_GetMessagePos]
movsx ecx, ax
shr eax, 0x10
movsx edx, ax
mov eax, dword [esp + 0x6c]
push eax
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], edx
mov dword [esp + 0x14], 0xffffffff
call dword [sym.imp.USER32.dll_SetCapture]
jmp 0x40e7f4
mov esi, dword [esp + 0x7c]
push esi
call fcn.0040d8c0
add esp, 4
test eax, eax
je 0x40ea9b
mov ecx, dword [esp + 0x6c]
push ecx
call dword [sym.imp.USER32.dll_IsWindow]
test eax, eax
je 0x40ea9b
mov edi, dword [sym.imp.USER32.dll_PeekMessageA]
push 1
xor ebp, ebp
push ebp
xor eax, eax
push ebp
push ebp
lea edx, [esp + 0x40]
push edx
mov dword [esp + 0x28], 1
mov dword [esp + 0x44], ebp
mov dword [esp + 0x48], eax
mov dword [esp + 0x4c], eax
mov dword [esp + 0x50], eax
mov dword [esp + 0x54], eax
mov dword [esp + 0x58], eax
mov dword [esp + 0x5c], eax
call edi
test eax, eax
je 0x40e983
mov eax, dword [esp + 0x34]
cmp eax, 0x200
jb 0x40e871
cmp eax, 0x20a
ja 0x40e871
lea ecx, [ebp + 1]
jmp 0x40e873
xor ecx, ecx
cmp eax, 0x100
jb 0x40e8be
cmp eax, 0x108
ja 0x40e8be
mov eax, dword [esp + 0x38]
cmp eax, 0x10
jb 0x40e8af
cmp eax, 0x11
jbe 0x40e89f
cmp eax, 0x1b
jne 0x40e8af
xor ebx, ebx
mov dword [esp + 0x14], ebx
jmp 0x40e983
mov ebx, 1
mov ebp, ebx
mov dword [esp + 0x14], ebx
jmp 0x40e96d
xor ebx, ebx
mov dword [esp + 0x14], 1
jmp 0x40e983
test ecx, ecx
je 0x40e96d
cmp eax, 0x200
je 0x40e91d
cmp eax, 0xa0
je 0x40e91d
mov ecx, esi
xor ebx, ebx
sub ecx, 1
je 0x40e8f5
sub ecx, 1
je 0x40e8ee
sub ecx, 2
jne 0x40e901
cmp eax, 0x208
jmp 0x40e8fa
cmp eax, 0x205
jmp 0x40e8fa
cmp eax, 0x202
setne bl
test ebx, ebx
jne 0x40e96d
call dword [sym.imp.USER32.dll_GetMessagePos]
mov edx, dword [esp + 0x74]
movsx ecx, ax
shr eax, 0x10
movsx eax, ax
push edx
push eax
push ecx
call dword [esp + 0x7c]
jmp 0x40e96d
cmp dword [esp + 0x10], 0
je 0x40e96d
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov dword [esp + 0x10], eax
call dword [sym.imp.USER32.dll_GetMessagePos]
movsx ecx, ax
shr eax, 0x10
movsx esi, ax
mov eax, ecx
sub eax, dword [esp + 0x18]
cdq
xor eax, edx
sub eax, edx
cmp eax, 4
jg 0x40e965
mov eax, esi
sub eax, dword [esp + 0x1c]
cdq
xor eax, edx
sub eax, edx
cmp eax, 4
jg 0x40e965
mov dword [esp + 0x10], 0
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], esi
lea eax, [esp + 0x30]
push eax
call dword [sym.imp.USER32.dll_TranslateMessage]
lea ecx, [esp + 0x30]
push ecx
call dword [sym.imp.USER32.dll_DispatchMessageA]
xor eax, eax
push 1
push 0xf
push 0xf
push eax
lea edx, [esp + 0x5c]
push edx
mov dword [esp + 0x60], eax
mov dword [esp + 0x64], eax
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
mov dword [esp + 0x74], eax
mov dword [esp + 0x78], eax
call edi
test eax, eax
je 0x40e9e5
mov esi, dword [sym.imp.USER32.dll_TranslateMessage]
lea esp, [esp]
lea eax, [esp + 0x4c]
push eax
call esi
lea ecx, [esp + 0x4c]
push ecx
call dword [sym.imp.USER32.dll_DispatchMessageA]
push 1
push 0xf
push 0xf
push 0
lea edx, [esp + 0x5c]
push edx
call edi
test eax, eax
jne 0x40e9c0
test ebx, ebx
je 0x40ea9b
call dword [sym.imp.USER32.dll_GetMessagePos]
movsx esi, ax
shr eax, 0x10
test ebp, ebp
movsx edi, ax
jne 0x40ea7a
mov eax, dword [esp + 0x78]
test eax, eax
je 0x40ea15
push edi
push esi
push eax
call dword [sym.imp.USER32.dll_PtInRect]
test eax, eax
je 0x40ea93
mov ecx, dword [esp + 0x6c]
xor eax, eax
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], eax
lea eax, [esp + 0x20]
push eax
push ecx
call dword [sym.imp.USER32.dll_GetWindowRect]
push edi
push esi
lea edx, [esp + 0x28]
push edx
call dword [sym.imp.USER32.dll_PtInRect]
test eax, eax
mov eax, dword [esp + 0x80]
jne 0x40ea52
sar eax, 2
and eax, 3
sub eax, 1
je 0x40ea7a
sub eax, 1
jne 0x40ea93
mov ebp, dword [esp + 0x10]
cmp ebp, 0xffffffff
je 0x40ea93
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov ecx, dword [0x519440]
add ecx, ebp
cmp eax, ecx
jbe 0x40ea93
mov edx, dword [esp + 0x74]
push edx
push edi
push esi
call dword [esp + 0x7c]
test eax, eax
je 0x40ea8b
xor ebx, ebx
mov dword [esp + 0x10], 0xffffffff
test ebx, ebx
jne 0x40e7f0
call dword [sym.imp.USER32.dll_ReleaseCapture]
mov eax, dword [esp + 0x14]
pop ebp
pop ebx
pop edi
mov dword [0x523374], 0
pop esi
add esp, 0x58
ret
mov dword [0x523374], edi
mov eax, edi
pop edi
pop esi
add esp, 0x58
ret