Function at 0x40fd40
Capabilities:
Check for time delay via gettickcount
Log keystrokes via polling

Disassembly:
sub esp, 0x28
mov dl, byte [esp + 0x34]
push ebx
mov ebx, dword [esp + 0x30]
or al, dl
push ebp
mov ebp, dword [esp + 0x40]
mov byte [esp + 0x10], al
lea eax, [ebx - 1]
push esi
push edi
cmp al, 5
ja 0x40fd65
cmp bl, 3
jne 0x40fd6c
lea eax, [ebx + 0x66]
cmp al, 5
ja 0x40fd73
mov byte [esp + 0x13], 1
jmp 0x40fd78
mov byte [esp + 0x13], 0
mov esi, dword [sym.imp.USER32.dll_GetAsyncKeyState]
test ecx, ecx
jle 0x40ffd9
mov dword [esp + 0x14], ecx
cmp dword [0x4acbc0], 0
jne 0x40fded
mov edi, dword [sym.imp.KERNEL32.dll_GetTickCount]
call edi
sub eax, dword [0x4ad8dc]
mov ecx, dword [0x4a8978]
cmp eax, dword [ecx + 0xb8]
jbe 0x40fded
push 0
push 0
push 0
push 0
lea edx, [esp + 0x2c]
push edx
call dword [sym.imp.USER32.dll_PeekMessageA]
test eax, eax
je 0x40fde6
push 1
push 0xffffffffffffffff
mov dword [0x4a88ec], 0
call fcn.004013c0
add esp, 8
mov dword [0x4a88ec], 1
call edi
mov dword [0x4ad8dc], eax
cmp byte [esp + 0x4c], 0
jne 0x40ff68
mov eax, dword [0x4a8978]
mov al, byte [eax + 0xd6]
test al, al
je 0x40fe13
movzx ecx, al
mov edi, 0xffc3d44d
sub edi, ecx
jmp 0x40fe18
mov edi, 0xffc3d44f
cmp dword [0x4acbc0], 0
je 0x40fe2b
mov al, byte [0x4ab209]
jmp 0x40ff4f
cmp dword [0x4ac41c], 0
je 0x40fe3e
mov al, byte [0x4ac2e9]
jmp 0x40ff4f
push 0xa0
mov byte [esp + 0x16], 0
call esi
mov edx, 0x8000
test dx, ax
je 0x40fe59
mov byte [esp + 0x12], 0x10
push 0xa1
call esi
mov ecx, 0x8000
test cx, ax
je 0x40fe6f
or byte [esp + 0x12], 0x20
push 0xa2
call esi
mov edx, 0x8000
test dx, ax
je 0x40fe85
or byte [esp + 0x12], 1
push 0xa3
call esi
mov ecx, 0x8000
test cx, ax
je 0x40fe9b
or byte [esp + 0x12], 2
push 0xa4
call esi
mov edx, 0x8000
test dx, ax
je 0x40feb1
or byte [esp + 0x12], 4
push 0xa5
call esi
mov ecx, 0x8000
test cx, ax
je 0x40fec7
or byte [esp + 0x12], 8
push 0x5b
call esi
mov edx, 0x8000
test dx, ax
je 0x40feda
or byte [esp + 0x12], 0x40
push 0x5c
call esi
mov ecx, 0x8000
test cx, ax
je 0x40feed
or byte [esp + 0x12], 0x80
cmp dword [0x4ac41c], 0
je 0x40ff4a
mov bl, byte [esp + 0x12]
not bl
and bl, byte [0x4ac2e9]
je 0x40ff46
mov cl, byte [0x4ac2eb]
mov al, bl
not al
and byte [0x4ac2e9], al
and byte [0x4ac2ea], al
and cl, al
mov al, cl
mov byte [0x4ac2eb], cl
mov ecx, 0x4ac310
call fcn.00412cc0
mov eax, dword [0x4ab1fc]
test eax, eax
je 0x40ff46
test byte [eax + 8], bl
je 0x40ff46
mov dword [0x4ab1fc], 0
mov ebx, dword [esp + 0x3c]
movzx eax, byte [esp + 0x12]
mov edx, dword [esp + 0x50]
push 1
push 0
push edx
push eax
mov eax, dword [esp + 0x28]
push eax
mov eax, edi
call fcn.004124e0
add esp, 0x14
cmp byte [esp + 0x13], 0
je 0x40ffa1
cmp dword [esp + 0x50], 0
jne 0x40ffa1
mov ecx, dword [esp + 0x5c]
mov edx, dword [0x4a8978]
mov eax, dword [esp + 0x58]
push ecx
movzx ecx, byte [edx + 0xcf]
mov edx, dword [esp + 0x58]
push ebp
push 1
push eax
push edx
mov al, bl
call fcn.004115c0
add esp, 0x14
jmp 0x40ffcb
mov eax, dword [0x4a8978]
movzx ecx, byte [eax + 0xd6]
mov eax, dword [esp + 0x50]
mov edx, 0xffc3d44d
sub edx, ecx
mov ecx, dword [esp + 0x40]
push edx
push 1
push eax
push ecx
push ebx
push ebp
call fcn.004106a0
add esp, 0x18
dec dword [esp + 0x14]
jne 0x40fd8a
mov dl, byte [esp + 0x44]
cmp byte [esp + 0x4c], 0
jne 0x410144
cmp dword [0x4acbc0], 0
je 0x40fff7
mov al, byte [0x4ab209]
jmp 0x41011a
cmp dword [0x4ac41c], 0
je 0x41000a
mov al, byte [0x4ac2e9]
jmp 0x41011a
push 0xa0
mov byte [esp + 0x50], 0
call esi
mov edx, 0x8000
test dx, ax
je 0x410025
mov byte [esp + 0x4c], 0x10
push 0xa1
call esi
mov ecx, 0x8000
test cx, ax
je 0x41003b
or byte [esp + 0x4c], 0x20
push 0xa2
call esi
mov edx, 0x8000
test dx, ax
je 0x410051
or byte [esp + 0x4c], 1
push 0xa3
call esi
mov ecx, 0x8000
test cx, ax
je 0x410067
or byte [esp + 0x4c], 2
push 0xa4
call esi
mov edx, 0x8000
test dx, ax
je 0x41007d
or byte [esp + 0x4c], 4
push 0xa5
call esi
mov ecx, 0x8000
test cx, ax
je 0x410093
or byte [esp + 0x4c], 8
push 0x5b
call esi
mov edx, 0x8000
test dx, ax
je 0x4100a6
or byte [esp + 0x4c], 0x40
push 0x5c
call esi
mov ecx, 0x8000
test cx, ax
je 0x4100b9
or byte [esp + 0x4c], 0x80
cmp dword [0x4ac41c], 0
je 0x410112
mov bl, byte [esp + 0x4c]
not bl
and bl, byte [0x4ac2e9]
je 0x410112
mov cl, byte [0x4ac2eb]
mov al, bl
not al
and byte [0x4ac2e9], al
and byte [0x4ac2ea], al
and cl, al
mov al, cl
mov byte [0x4ac2eb], cl
mov ecx, 0x4ac310
call fcn.00412cc0
mov eax, dword [0x4ab1fc]
test eax, eax
je 0x410112
test byte [eax + 8], bl
je 0x410112
mov dword [0x4ab1fc], 0
mov al, byte [esp + 0x4c]
mov dl, byte [esp + 0x44]
not dl
and dl, al
and dl, 0xcc
mov byte [esp + 0x44], dl
je 0x410144
mov edx, dword [esp + 0x50]
mov eax, dword [esp + 0x44]
push 0
push 1
push edx
push eax
push 0
mov eax, 0xffc3d44d
call fcn.004124e0
add esp, 0x14
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x28
ret