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

Disassembly:
mov eax, 0x424798
call sub.MSVCRT.dll__EH_prolog
push ecx
sub esp, 0x118
push ebx
push esi
mov esi, ecx
push edi
mov dword [ebp - 0x10], esp
xor ebx, ebx
movzx eax, word [esi + 0x29e]
mov ecx, dword [esi + 0x308]
mov dword [ebp - 0x28], esi
lea eax, [eax + esi + 0x19c]
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0x1c], eax
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x128]
push 0x100
push eax
call sub.Serial.dll_public:_unsigned_long_int___thiscall_CSerial::Receive_unsigned_char___unsigned_long_int__unsigned_long_int__
xor edi, edi
cmp edi, dword [ebp - 0x20]
mov dword [ebp - 0x24], edi
jae 0x4059a1
movzx eax, byte [esi + 0x29d]
sub eax, ebx
je 0x405d72
dec eax
je 0x405c16
dec eax
je 0x405afc
dec eax
dec eax
je 0x4058f6
dec eax
jne 0x405c0b
call dword [sym.imp.KERNEL32.dll_GetTickCount]
add eax, dword [esi + 0x60]
mov ecx, dword [ebp - 0x1c]
inc dword [ebp - 0x1c]
mov dword [esi + 0x2a0], eax
mov al, byte [ebp + edi - 0x128]
mov byte [ecx], al
inc word [esi + 0x29e]
jmp 0x405df8
mov ecx, dword [ebp - 0x1c]
mov al, byte [ebp + edi - 0x128]
inc dword [ebp - 0x1c]
lea edi, [ebp + edi - 0x128]
mov byte [ecx], al
inc word [esi + 0x29e]
call dword [sym.imp.KERNEL32.dll_GetTickCount]
add eax, dword [esi + 0x60]
mov dword [esi + 0x2a0], eax
mov ax, word [esi + 0x29e]
cmp ax, bx
jne 0x40593c
mov cl, byte [edi]
cmp cl, 0xa
jb 0x405994
cmp cl, 0xfe
jbe 0x405951
jmp 0x405994
movzx ecx, byte [esi + 0x19c]
movzx edx, ax
add ecx, 3
cmp edx, ecx
jne 0x405df8
movzx eax, ax
xor edx, edx
push 1
movzx cx, byte [esi + eax + 0x19a]
mov dh, cl
mov dl, byte [esi + eax + 0x19b]
add eax, 0xfffffffe
mov edi, edx
pop edx
cmp eax, edx
mov dword [ebp - 0x18], edx
jle 0x40598f
mov ecx, edx
movzx cx, byte [esi + ecx + 0x19c]
sub edi, ecx
inc dword [ebp - 0x18]
movzx ecx, word [ebp - 0x18]
cmp ecx, eax
jl 0x405979
cmp di, bx
je 0x4059b0
inc dword [esi + 0x2d8]
mov byte [esi + 0x29d], 5
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
mov dword fs:[0], ecx
pop ebx
leave
ret
mov eax, dword [esi + 0x364]
cmp eax, ebx
je 0x4059ce
lea edi, [esi + 0x318]
push eax
mov dword [edi], edx
call dword [sym.imp.KERNEL32.dll_Sleep]
push 1
mov dword [edi], ebx
pop edx
lea eax, [ebp - 0x11]
push edx
push eax
mov ecx, esi
mov byte [ebp - 0x11], 6
call fcn.00405079
inc dword [esi + 0x2cc]
inc word [esi + 0x336]
cmp dword [esi + 0x330], ebx
push 1
pop eax
mov dword [esi + 0x32c], eax
je 0x405a13
mov ecx, dword [0x42fd2c]
mov ecx, dword [ecx + 4]
cmp dword [ecx + 0x98], ebx
je 0x405a13
push eax
call fcn.0040fcfd
mov ecx, esi
call fcn.004054ea
cmp dword [esi + 0x2fc], ebx
mov edi, eax
mov dword [ebp - 0x18], edi
mov dword [ebp - 4], ebx
je 0x405a68
cmp edi, ebx
je 0x405a3d
mov eax, dword [edi + 4]
cmp eax, ebx
je 0x405a3d
cmp dword [eax + 0x98], ebx
je 0x405a68
mov ax, word [esi + 0x29e]
mov ecx, dword [0x42fd30]
push ebx
push eax
lea eax, [esi + 0x19c]
push eax
call fcn.0040b0ca
jmp 0x405a68
or dword [ebp - 4], 0xffffffff
cmp edi, ebx
je 0x405ade
mov eax, dword [edi + 4]
cmp eax, ebx
je 0x405a7a
inc dword [eax + 0x50]
push 0x108
call sub.MFC42.DLL_operatornew
cmp eax, ebx
pop ecx
je 0x405a94
mov dword [eax], 0x427060
mov dword [ebp - 0x18], eax
jmp 0x405a97
mov dword [ebp - 0x18], ebx
push dword [ebp - 0x18]
lea ecx, [edi + 0x48]
call sub.MFC42.DLL_CObList::AddTail
movzx eax, word [esi + 0x29e]
push eax
lea eax, [esi + 0x19c]
push eax
mov eax, dword [ebp - 0x18]
add eax, 4
push eax
call sub.MSVCRT.dll_memcpy
add esp, 0xc
test byte [esi + 0x1a1], 0x80
je 0x405ade
push 2
push edi
mov ecx, esi
call fcn.00404b70
push ebx
push 3
push edi
mov ecx, esi
call fcn.00404ae3
push dword [esi + 0xfc]
mov byte [esi + 0x29d], bl
mov word [esi + 0x29e], bx
call dword [sym.imp.KERNEL32.dll_SetEvent]
jmp 0x405df8
cmp byte [ebp + edi - 0x128], 6
jne 0x405df8
inc word [esi + 0x336]
cmp dword [esi + 0x330], ebx
push 1
pop eax
mov dword [esi + 0x32c], eax
je 0x405b39
mov ecx, dword [0x42fd2c]
mov ecx, dword [ecx + 4]
cmp dword [ecx + 0x98], ebx
je 0x405b39
push eax
call fcn.0040fcfd
lea eax, [esi + 0x184]
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov edi, dword [esi + 0x2a8]
lea eax, [esi + 0x2a8]
cmp edi, ebx
je 0x405bd3
lea ecx, [edi + 0x48]
mov dword [eax], ebx
call sub.MFC42.DLL_CObList::RemoveHead
cmp eax, ebx
je 0x405b6d
mov edx, dword [eax]
push 1
mov ecx, eax
call dword [edx + 4]
cmp dword [edi + 0x54], ebx
jne 0x405bd3
inc word [edi + 0x40]
mov ax, word [edi + 0x40]
cmp ax, word [edi + 0x34]
jne 0x405bac
push 2
push edi
mov ecx, esi
call fcn.00404b70
cmp dword [edi + 8], 2
jne 0x405b9f
cmp edi, ebx
je 0x405bd3
mov eax, dword [edi]
push 1
mov ecx, edi
call dword [eax + 4]
jmp 0x405bd3
push ebx
push 3
push edi
mov ecx, esi
call fcn.00404ae3
jmp 0x405bd3
mov ecx, dword [esi + 0x2ac]
lea eax, [esi + 0x2ac]
push ecx
push edi
lea edx, [ecx + 1]
mov dword [eax], edx
mov ecx, dword [edi + 4]
call fcn.0040893f
cmp dword [edi + 0x28], ebx
je 0x405bd3
mov ecx, edi
call fcn.00416fd1
lea eax, [esi + 0x184]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esi + 0x364]
cmp eax, ebx
je 0x405bff
lea edi, [esi + 0x318]
push eax
mov dword [edi], 1
call dword [sym.imp.KERNEL32.dll_Sleep]
mov dword [edi], ebx
push dword [esi + 0xfc]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov byte [esi + 0x29d], bl
jmp 0x405df8
mov al, byte [ebp + edi - 0x128]
cmp al, 4
jne 0x405ce7
lea edi, [esi + 0x184]
push edi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [esi + 0x2a8], ebx
jne 0x405c4d
push edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov byte [esi + 0x29d], 5
jmp 0x405df8
mov eax, dword [esi + 0x364]
cmp eax, ebx
je 0x405c6c
lea edi, [esi + 0x318]
push eax
mov dword [edi], 1
call dword [sym.imp.KERNEL32.dll_Sleep]
mov dword [edi], ebx
mov eax, dword [esi + 0x2a8]
mov ecx, esi
mov eax, dword [eax + 0x4c]
mov eax, dword [eax + 8]
lea edi, [eax + 4]
movzx ax, byte [eax + 4]
add eax, 3
push eax
push edi
call fcn.00405079
cmp dword [esi + 0x2fc], ebx
je 0x405cbf
mov eax, dword [esi + 0x2a8]
mov eax, dword [eax + 4]
cmp eax, ebx
je 0x405ca9
cmp dword [eax + 0x98], ebx
je 0x405cbf
movzx ax, byte [edi]
mov ecx, dword [0x42fd30]
add eax, 3
push 1
push eax
push edi
call fcn.0040b0ca
lea eax, [esi + 0x184]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov byte [esi + 0x29d], 2
call dword [sym.imp.KERNEL32.dll_GetTickCount]
add eax, dword [esi + 0x6c]
mov dword [esi + 0x2a0], eax
jmp 0x405df8
cmp al, 5
jne 0x405df8
cmp dword [esi + 0x330], ebx
jne 0x405df8
mov eax, dword [esi + 0x364]
cmp eax, ebx
je 0x405d1a
lea edi, [esi + 0x318]
push eax
mov dword [edi], 1
call dword [sym.imp.KERNEL32.dll_Sleep]
mov dword [edi], ebx
lea eax, [ebp - 0x11]
push 1
push eax
mov ecx, esi
mov byte [ebp - 0x11], 4
call fcn.00405079
mov byte [esi + 0x29d], 4
call dword [sym.imp.KERNEL32.dll_GetTickCount]
add eax, dword [esi + 0x6c]
lea edi, [esi + 0x184]
push edi
mov dword [esi + 0x2a0], eax
mov ax, word [esi + 0x74]
mov word [esi + 0x2a4], ax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push edi
mov dword [esi + 0x2a8], ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov word [esi + 0x29e], bx
jmp 0x405df8
cmp byte [ebp + edi - 0x128], 5
jne 0x405df8
mov eax, dword [esi + 0x364]
cmp eax, ebx
je 0x405d9b
lea edi, [esi + 0x318]
push eax
mov dword [edi], 1
call dword [sym.imp.KERNEL32.dll_Sleep]
mov dword [edi], ebx
lea eax, [ebp - 0x11]
push 1
push eax
mov ecx, esi
mov byte [ebp - 0x11], 4
call fcn.00405079
mov byte [esi + 0x29d], 4
call dword [sym.imp.KERNEL32.dll_GetTickCount]
add eax, dword [esi + 0x6c]
lea edi, [esi + 0x184]
push edi
mov dword [esi + 0x2a0], eax
mov ax, word [esi + 0x74]
mov word [esi + 0x2a4], ax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push edi
mov dword [esi + 0x2a8], ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov word [esi + 0x29e], bx
mov dword [esi + 0x2b4], 0x64
mov edi, dword [ebp - 0x24]
inc edi
jmp 0x405898