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

Disassembly:
sub esp, 0x14
mov eax, dword [0x906980]
push ebx
push ebp
mov ebp, dword [esp + 0x20]
mov dword [esp + 0x18], eax
cmp dword [ebp + 0x5c], 3
push esi
push edi
mov bl, 0xff
mov esi, 4
jne 0x851ccb
cmp dword [ebp], 0
jne 0x851ccb
mov eax, dword [ebp + 0x7c]
test eax, eax
je 0x851c87
push eax
call fcn.0078af60
add esp, 4
mov eax, 0xc
push 0xd
mov dword [ebp + 0x74], eax
mov dword [ebp + 0x78], eax
call fcn.0078af30
mov dword [ebp + 0x7c], eax
mov cl, 0xfe
mov byte [eax + 3], bl
mov byte [eax + 2], bl
mov byte [eax + 1], bl
mov byte [eax], bl
mov byte [eax + 7], cl
mov byte [eax + 6], cl
mov byte [eax + 5], cl
mov byte [eax + 4], cl
mov byte [eax + 0xa], 0
mov byte [eax + 9], 0
mov byte [eax + 8], 0
mov byte [eax + 0xb], 0xc
add esp, 4
mov dword [ebp + 0x5c], esi
cmp dword [ebp + 0x5c], esi
mov edi, 2
jne 0x851ce6
mov eax, dword [ebp + 0x70]
test eax, eax
je 0x851ce6
mov dword [ebp + 0x5c], edi
mov dword [ebp + 0x60], 0
cmp dword [ebp + 0x5c], 1
jne 0x851d88
mov edx, dword [ebp]
lea eax, [esp + 0x28]
push eax
lea ecx, [esp + 0x14]
push ecx
push 0
push edx
mov dword [esp + 0x38], 0x10
call fcn.00859bc0
mov esi, eax
add esp, 0x10
test esi, esi
je 0x852197
mov eax, dword [ebp]
push eax
call fcn.00859ba0
mov eax, dword [ebp + 0x7c]
add esp, 4
test eax, eax
mov dword [ebp], esi
mov dword [ebp + 0x5c], 3
mov dword [ebp + 0x68], 0
je 0x851d47
push eax
call fcn.0078af60
add esp, 4
mov esi, 0xc
push 0xd
mov dword [ebp + 0x74], esi
mov dword [ebp + 0x78], esi
call fcn.0078af30
mov dword [ebp + 0x7c], eax
add esp, 4
mov byte [eax + 3], bl
mov byte [eax + 2], bl
mov byte [eax + 1], bl
mov byte [eax], bl
mov byte [eax + 7], bl
mov byte [eax + 6], bl
mov byte [eax + 5], bl
mov byte [eax + 4], bl
mov byte [eax + 0xa], 0
mov byte [eax + 9], 0
mov byte [eax + 8], 0
mov byte [eax + 0xb], 0xc
jmp 0x851d8d
mov esi, 0xc
cmp dword [ebp + 0x5c], edi
jne 0x851f07
call fcn.0084bcb0
cmp eax, dword [ebp + 0x60]
jbe 0x851e27
mov eax, dword [ebp]
test eax, eax
je 0x851db4
push eax
call fcn.00859ba0
add esp, 4
call fcn.00859b60
test eax, eax
mov dword [ebp], eax
je 0x852197
xor ecx, ecx
mov cx, word [ebp + 6]
push ecx
call fcn.0083faa0
movzx edx, ax
mov eax, dword [ebp + 8]
add esp, 4
push edx
push eax
call fcn.0083fac0
add esp, 4
xor edx, edx
cmp word [ebp + 0x8c], dx
push eax
mov eax, dword [ebp]
setne dl
lea ecx, [ebp + 0x1c]
push ecx
push edx
push eax
call fcn.00859c90
add esp, 0x14
test eax, eax
jl 0x852197
call fcn.0084bcb0
lea ecx, [ebp + 0xe4]
add eax, 0x7530
push 0
push ecx
mov dword [ebp + 0x60], eax
call fcn.0085a9d0
add esp, 8
mov eax, dword [ebp]
test eax, eax
je 0x852197
push eax
call fcn.00859e60
mov edx, dword [ebp]
push 0
push 0
push 0x73746174
push edx
call fcn.0085a6f0
add esp, 0x14
test eax, eax
jle 0x852197
mov eax, dword [ebp + 8]
test eax, eax
jne 0x851e73
mov ecx, dword [ebp]
push 0x10
lea eax, [ebp + 4]
push eax
push 0x70656572
push ecx
call fcn.0085a6f0
add esp, 0x10
mov eax, dword [ebp]
push 0x10
lea edx, [esp + 0x14]
push edx
push 0x62696e64
push eax
call fcn.0085a6f0
add esp, 0x10
test eax, eax
jne 0x851eaf
mov ecx, dword [esp + 0x14]
push ecx
call fcn.0083fac0
mov edx, dword [esp + 0x16]
push edx
mov dword [ebp + 0x14], eax
call fcn.0083faa0
movzx eax, ax
add esp, 8
mov dword [ebp + 0x18], eax
mov eax, dword [ebp + 0x7c]
test eax, eax
mov dword [ebp + 0x5c], 3
mov dword [ebp + 0x68], 0
je 0x851ecd
push eax
call fcn.0078af60
add esp, 4
push 0xd
mov dword [ebp + 0x74], esi
mov dword [ebp + 0x78], esi
call fcn.0078af30
mov dword [ebp + 0x7c], eax
add esp, 4
mov byte [eax + 3], bl
mov byte [eax + 2], bl
mov byte [eax + 1], bl
mov byte [eax], bl
mov byte [eax + 7], bl
mov byte [eax + 6], bl
mov byte [eax + 5], bl
mov byte [eax + 4], bl
mov byte [eax + 0xa], 0
mov byte [eax + 9], 0
mov byte [eax + 8], 0
mov byte [eax + 0xb], 0xc
mov eax, dword [ebp]
test eax, eax
je 0x852197
push eax
call fcn.00859e60
mov edx, dword [ebp + 0x70]
xor edi, edi
add esp, 4
cmp edx, edi
je 0x851f68
mov ecx, dword [ebp + 0x68]
mov eax, dword [ebp + 0x64]
cmp ecx, eax
je 0x851f68
sub eax, ecx
push eax
add ecx, edx
push ecx
mov ecx, dword [ebp]
push ecx
call fcn.0085a550
add esp, 0xc
cmp eax, edi
mov dword [esp + 0x28], eax
jl 0x8520e0
jle 0x851f51
add dword [ebp + 0x68], eax
mov eax, dword [ebp + 0x68]
cmp eax, dword [ebp + 0x64]
jne 0x851f68
mov ecx, dword [ebp + 0x70]
push ecx
call fcn.0078af60
add esp, 4
mov dword [ebp + 0x70], edi
cmp dword [ebp + 0x7c], edi
jne 0x852089
mov edx, dword [ebp + 0x74]
cmp edx, dword [ebp + 0x78]
jne 0x851f7f
mov dword [ebp + 0x74], esi
mov dword [ebp + 0x78], edi
mov eax, dword [ebp + 0x78]
mov ecx, dword [ebp + 0x74]
sub ecx, eax
push ecx
lea edx, [eax + ebp + 0x80]
mov eax, dword [ebp]
push edx
push eax
call fcn.0085a5d0
add esp, 0xc
cmp eax, edi
mov dword [esp + 0x28], eax
jge 0x851fc4
mov ecx, dword [ebp]
push ecx
call fcn.00859ba0
add esp, 4
mov dword [ebp], edi
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x10]
call fcn.007d6cb0
add esp, 0x14
ret
jle 0x851fc9
add dword [ebp + 0x78], eax
mov edx, dword [ebp + 0x78]
cmp edx, dword [ebp + 0x74]
jne 0x852089
push 0xc
lea esi, [ebp + 0x80]
lea eax, [ebp + 0xe4]
push esi
push eax
call fcn.0085ab60
movzx ecx, byte [esi + 0xa]
movzx edx, byte [esi + 0xb]
xor eax, eax
mov ah, byte [esi + 8]
add esp, 0xc
mov al, byte [esi + 9]
shl eax, 8
or eax, ecx
shl eax, 8
or eax, edx
cmp eax, 0xc
mov dword [ebp + 0x74], eax
jl 0x8520e0
cmp eax, 0x8000
jg 0x8520e0
inc eax
push eax
call fcn.0078af30
add esp, 4
cmp eax, edi
mov dword [ebp + 0x7c], eax
jne 0x85204f
mov eax, dword [ebp]
push eax
call fcn.00859ba0
add esp, 4
mov dword [ebp], edi
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x10]
call fcn.007d6cb0
add esp, 0x14
ret
mov ecx, dword [ebp + 0x78]
mov edx, ecx
shr ecx, 2
mov edi, eax
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [ebp + 0x78]
cmp eax, dword [ebp + 0x74]
jne 0x852089
mov eax, dword [ebp + 0x70]
test eax, eax
je 0x852089
mov ecx, dword [ebp + 0x68]
cmp ecx, dword [ebp + 0x64]
jne 0x852089
push eax
call fcn.0078af60
add esp, 4
mov dword [ebp + 0x70], 0
mov edx, dword [ebp + 0x7c]
test edx, edx
je 0x852197
mov ecx, dword [ebp + 0x78]
mov eax, dword [ebp + 0x74]
cmp ecx, eax
jge 0x852197
sub eax, ecx
push eax
mov eax, dword [ebp]
add ecx, edx
push ecx
push eax
call fcn.0085a5d0
add esp, 0xc
test eax, eax
mov dword [esp + 0x28], eax
jge 0x852100
mov ecx, dword [ebp]
push ecx
call fcn.00859ba0
add esp, 4
pop edi
pop esi
mov dword [ebp], 0
pop ebp
pop ebx
mov ecx, dword [esp + 0x10]
call fcn.007d6cb0
add esp, 0x14
ret
mov edx, dword [ebp]
push edx
call fcn.00859ba0
add esp, 4
mov dword [ebp], edi
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x10]
call fcn.007d6cb0
add esp, 0x14
ret
jle 0x852105
add dword [ebp + 0x78], eax
mov eax, dword [ebp + 0x78]
cmp eax, dword [ebp + 0x74]
jne 0x852170
mov edx, dword [ebp + 0x7c]
add eax, 0xfffffff4
push eax
add edx, 0xc
push edx
lea esi, [ebp + 0xe4]
push esi
call fcn.0085ab60
mov eax, dword [ebp + 0x74]
mov ecx, dword [ebp + 0x7c]
push eax
push ecx
push esi
call fcn.0085ab90
add esp, 0x18
test eax, eax
jge 0x85215d
mov edx, dword [ebp]
push edx
call fcn.00859ba0
add esp, 4
pop edi
pop esi
mov dword [ebp], 0
pop ebp
pop ebx
mov ecx, dword [esp + 0x10]
call fcn.007d6cb0
add esp, 0x14
ret
mov eax, dword [ebp + 0x74]
push eax
push esi
call fcn.0085ac40
add esp, 8
mov dword [ebp + 0x78], eax
mov dword [ebp + 0x74], eax
mov ecx, dword [ebp + 0x78]
cmp ecx, dword [ebp + 0x74]
jne 0x852197
mov eax, dword [ebp + 0x70]
test eax, eax
je 0x852197
mov edx, dword [ebp + 0x68]
cmp edx, dword [ebp + 0x64]
jne 0x852197
push eax
call fcn.0078af60
mov dword [ebp + 0x70], 0
add esp, 4
mov ecx, dword [esp + 0x20]
pop edi
pop esi
pop ebp
pop ebx
call fcn.007d6cb0
add esp, 0x14
ret