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

Disassembly:
push ebx
push esi
push edi
add esp, 0xffffffc0
mov edi, edx
mov ebx, eax
mov esi, dword [0x52a720]
mov byte [esp], 0
test ebx, ebx
je 0x5166bb
call sub.KERNEL32.DLL_GetTickCount
xor edx, edx
mov dword [esp + 8], eax
mov dword [esp + 0xc], edx
mov eax, dword [0x52ab68]
cmp byte [eax], 0
je 0x5166bb
cmp dword [esi + 0x10], 2
jb 0x5166bb
mov eax, ebx
call fcn.00516180
test al, al
je 0x5166bb
cmp ebx, dword [esi + 0x49]
jne 0x5166bb
lea edx, [esp + 0x10]
mov eax, dword [0x52a9f0]
mov eax, dword [eax + 0x74]
add eax, ebx
mov ecx, 0xc
call fcn.0051a370
fstp st(0)
lea edx, [esi + 0x21]
lea eax, [esp + 0x10]
call fcn.005172b4
mov ecx, eax
mov eax, ecx
cdq
push edx
push eax
lea eax, [edi + 1]
xor edx, edx
cmp edx, dword [esp + 4]
jne 0x5164a8
cmp eax, dword [esp]
pop edx
pop eax
jb 0x5164b5
jmp 0x5164ac
pop edx
pop eax
jl 0x5164b5
mov byte [esp], 1
jmp 0x5166bb
cmp byte [esi + 0x20], 2
je 0x51650c
lea ecx, [esp + 0x28]
mov edx, edi
dec edx
mov eax, ebx
call fcn.005161d0
fld dword [esp + 0x28]
fcomp dword [0x5166c8]
fnstsw ax
sahf
jne 0x5164eb
fld dword [esp + 0x30]
fcomp dword [0x5166c8]
fnstsw ax
sahf
je 0x5166bb
push dword [esp + 0x30]
push dword [esp + 0x2c]
call fcn.0051f438
mov edx, 0x3e8
mov eax, 2
call fcn.00516328
jmp 0x516621
fld dword [esp + 0x10]
call fcn.00402c0c
push edx
push eax
fld dword [esp + 0x24]
call fcn.00402c0c
cmp edx, dword [esp + 4]
jne 0x516529
cmp eax, dword [esp]
pop edx
pop eax
jne 0x516552
fld dword [esp + 0x18]
call fcn.00402c0c
push edx
push eax
fld dword [esp + 0x2c]
call fcn.00402c0c
cmp edx, dword [esp + 4]
jne 0x51654a
cmp eax, dword [esp]
pop edx
pop eax
je 0x516621
mov eax, dword [esp + 0x10]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x14]
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x18]
mov dword [esp + 0x24], eax
lea edx, [esi + 0x21]
lea eax, [esp + 0x10]
call fcn.005172b4
mov ecx, eax
mov eax, ecx
cdq
push edx
push eax
lea eax, [edi + 1]
xor edx, edx
cmp edx, dword [esp + 4]
jne 0x516591
cmp eax, dword [esp]
pop edx
pop eax
jb 0x51659e
jmp 0x516595
pop edx
pop eax
jl 0x51659e
mov byte [esp], 1
jmp 0x5166bb
lea ecx, [esp + 0x28]
mov edx, edi
dec edx
mov eax, ebx
call fcn.005161d0
fld dword [esp + 0x28]
fcomp dword [0x5166c8]
fnstsw ax
sahf
jne 0x5165ce
fld dword [esp + 0x30]
fcomp dword [0x5166c8]
fnstsw ax
sahf
je 0x5166bb
mov eax, dword [0x52a750]
cmp dword [eax + 0x22], 1
jne 0x516605
mov eax, dword [0x52a750]
cmp byte [eax + 0x11], 0
je 0x516605
fld dword [esp + 0x18]
call fcn.00402c0c
push eax
fld dword [esp + 0x14]
call fcn.00402c0c
pop edx
call fcn.00517344
test al, al
je 0x5166bb
push dword [esp + 0x30]
push dword [esp + 0x2c]
call fcn.0051f438
mov edx, 0x3e8
mov eax, 2
call fcn.00516328
fld dword [esp + 0x34]
call fcn.00402c0c
push edx
push eax
fld dword [esi + 0x21]
call fcn.00402c0c
cmp edx, dword [esp + 4]
jne 0x51663d
cmp eax, dword [esp]
pop edx
pop eax
jne 0x516661
fld dword [esp + 0x3c]
call fcn.00402c0c
push edx
push eax
fld dword [esi + 0x29]
call fcn.00402c0c
cmp edx, dword [esp + 4]
jne 0x51665d
cmp eax, dword [esp]
pop edx
pop eax
je 0x516687
mov eax, dword [esi + 0x21]
mov dword [esp + 0x34], eax
mov eax, dword [esi + 0x25]
mov dword [esp + 0x38], eax
mov eax, dword [esi + 0x29]
mov dword [esp + 0x3c], eax
call sub.KERNEL32.DLL_GetTickCount
xor edx, edx
mov dword [esp + 8], eax
mov dword [esp + 0xc], edx
jmp 0x5166ac
call sub.KERNEL32.DLL_GetTickCount
xor edx, edx
sub eax, dword [esp + 8]
sbb edx, dword [esp + 0xc]
cmp edx, 0
jne 0x5166a4
cmp eax, 0x7d0
jbe 0x5166ac
jmp 0x5166a6
jle 0x5166ac
mov byte [esp], 0
jmp 0x5166bb
push 0xc8
call sub.KERNEL32.DLL_Sleep
jmp 0x516437
mov al, byte [esp]
add esp, 0x40
pop edi
pop esi
pop ebx
ret