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

Disassembly:
sub esp, 0x47c
mov eax, dword [0x906980]
mov dword [esp + 0x478], eax
xor eax, eax
mov dword [esp + 0x18], eax
mov edx, eax
push ebx
mov dword [esp + 0x24], eax
xor ebx, ebx
push esi
mov dword [esp + 0x2c], eax
mov eax, dword [0x9c3cfc]
cmp eax, ebx
push edi
mov dword [esp + 0xc], ebx
mov dword [esp + 0x18], ebx
mov dword [esp + 0x28], edx
mov dword [0x9c3ab0], 0xffffffff
mov dword [esp + 0x14], ebx
mov edi, eax
mov esi, 0x10
je 0x8506c8
mov ecx, dword [edi + 0x80]
test ecx, ecx
je 0x850679
cmp ecx, ebx
je 0x850679
mov ebx, ecx
lea ecx, [esp + 0x1c]
push ecx
lea edx, [esp + 0x28]
push edx
push 0
push 0x220
push 0x9c3ab8
push ebx
mov dword [esp + 0x34], esi
call fcn.0084b1e0
add esp, 0x18
test eax, eax
mov dword [esp + 0x1c], eax
jg 0x850682
mov edx, dword [esp + 0x28]
mov eax, dword [0x9c3cfc]
mov edi, dword [edi + 0x7c]
test edi, edi
jne 0x850635
jmp 0x8506c4
add eax, 0xfffffff8
mov dword [0x9c3ab0], eax
mov eax, dword [esp + 0x2c]
movzx ecx, al
movzx edx, ah
movzx eax, byte [esp + 0x2e]
shl ecx, 8
or ecx, edx
movzx edx, byte [esp + 0x2f]
shl ecx, 8
or ecx, eax
mov eax, dword [0x9c3cfc]
shl ecx, 8
or ecx, edx
mov edx, dword [esp + 0x28]
mov dword [0x9c3ab4], ecx
mov dword [esp + 0xc], 1
mov dword [esp + 0x14], ebx
test eax, eax
push ebp
mov ebp, eax
mov edi, 4
je 0x850b35
jmp 0x8506e0
mov ebx, dword [esp + 0x18]
mov edi, edi
call fcn.0084bcb0
mov esi, eax
mov eax, dword [esp + 0x1c]
test eax, eax
mov eax, dword [0x9c3ab0]
mov dword [esp + 0x490], esi
jne 0x85072d
cmp ebx, dword [ebp + 0x80]
jne 0x85072d
cmp dword [ebp + 0x94], 3
jne 0x85072d
test eax, eax
jne 0x85072f
cmp dword [0x9c3ab8], 1
jne 0x850735
mov eax, dword [ebp + 0x98]
cmp eax, dword [0x9c3abc]
jne 0x850735
mov dword [esp + 0x1c], ebp
jmp 0x850735
test eax, eax
jl 0x850910
mov eax, dword [ebp + 0x94]
cmp eax, 3
je 0x850910
cmp eax, 5
je 0x850910
cmp ebx, dword [ebp + 0x80]
jne 0x850910
lea ecx, [esp + 0x28]
push ecx
lea edx, [ebp + 0x84]
push edx
call fcn.0083f840
add esp, 8
test eax, eax
jne 0x850910
mov eax, dword [0x9c3ab0]
mov edx, dword [ebp + 0x60]
mov ecx, dword [ebp + 0x68]
add edx, eax
inc ecx
mov dword [ebp + 0x60], edx
mov dword [ebp + 0x68], ecx
mov edx, dword [0x9c3ab8]
cmp edx, 1
je 0x8508f1
cmp edx, 2
je 0x8508f1
cmp edx, 3
je 0x8508f1
cmp dword [ebp + 0x94], edi
jne 0x850901
cmp edx, edi
mov ecx, dword [0x9c3ab4]
jne 0x8507d7
mov dword [ebp + 0xe8], ecx
mov eax, 0x9c3ab0
mov ecx, ebp
call fcn.00850270
jmp 0x850901
cmp edx, 0x10000000
jbe 0x8508ce
mov eax, dword [ebp + 0xb0]
mov dword [esp + 0x24], eax
mov eax, edx
shr eax, 0x1c
and edx, 0xfffffff
sub edx, eax
test eax, eax
mov dword [0x9c3890], edx
mov edx, dword [0x9c3abc]
mov dword [0x9c388c], ecx
mov dword [0x9c3894], edx
mov dword [esp + 0x14], eax
mov dword [ebp + 0xe8], ecx
jl 0x850901
mov eax, dword [esp + 0x14]
test eax, eax
mov eax, dword [0x9c3ab0]
jle 0x850840
dec eax
mov dword [0x9c3ab0], eax
movzx ecx, byte [eax + 0x9c3ac0]
jmp 0x850842
mov ecx, eax
sub eax, ecx
mov dword [0x9c3888], ecx
mov dword [0x9c3ab0], eax
lea esi, [eax + 0x9c3ac0]
mov eax, ecx
shr ecx, 2
mov edi, 0x9c3898
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, 0x9c3888
mov ecx, ebp
call fcn.00850270
push 0x9c3888
mov ebx, ebp
call fcn.00850310
add esp, 4
test eax, eax
jge 0x850891
mov dword [esp + 0x14], 0
jmp 0x8508a9
mov eax, dword [esp + 0x14]
test eax, eax
jle 0x8508a9
mov eax, dword [ebp + 0xb0]
cmp dword [esp + 0x24], eax
je 0x8508a9
mov dword [esp + 0x24], eax
mov ecx, dword [0x9c3890]
mov eax, dword [esp + 0x14]
inc ecx
dec eax
mov dword [0x9c3890], ecx
mov dword [esp + 0x14], eax
jns 0x850824
mov esi, dword [esp + 0x490]
jmp 0x850901
mov dword [ebp + 0xe8], ecx
mov eax, 0x9c3ab0
mov ecx, ebp
call fcn.00850270
push 0x9c3ab0
mov ebx, ebp
call fcn.00850310
add esp, 4
jmp 0x850901
lea ebx, [esp + 0x28]
mov edi, 0x9c3ab0
mov eax, ebp
call fcn.0084fe10
mov dword [0x9c3ab0], 0xffffffff
mov edi, 4
cmp dword [ebp + 0x94], 2
jne 0x8509a0
mov ecx, dword [ebp + 0xe4]
mov edx, esi
sub edx, ecx
cmp edx, 0x3e8
jbe 0x8509a0
mov eax, dword [ebp + 0x98]
push 0x10
lea ecx, [ebp + 0x84]
push ecx
xor ebx, ebx
push ebx
push 8
lea edx, [esp + 0x50]
mov dword [esp + 0x54], eax
mov eax, dword [ebp + 0x80]
push edx
push eax
mov dword [esp + 0x50], ebx
mov dword [esp + 0x58], 1
call fcn.0084b110
add esp, 0x18
cmp eax, 8
jne 0x85099a
call fcn.0084bcb0
mov edx, dword [ebp + 0x5c]
mov ecx, dword [ebp + 0x64]
add edx, 8
mov dword [ebp + 0xe4], eax
mov eax, dword [esp + 0x40]
inc ecx
cmp eax, 0x100
mov dword [ebp + 0x5c], edx
mov dword [ebp + 0x64], ecx
jb 0x8509a0
mov dword [ebp + 0xbc], ebx
jmp 0x8509a0
mov dword [ebp + 0xe0], eax
cmp dword [ebp + 0x94], edi
jne 0x8509bd
mov ecx, dword [ebp + 0xd0]
cmp ecx, dword [ebp + 0xc8]
je 0x8509bd
mov ebx, ebp
call fcn.0084fef0
cmp dword [ebp + 0x94], 4
jne 0x8509f0
mov ecx, dword [ebp + 0xe8]
mov edx, esi
sub edx, ecx
cmp edx, 0x1d4c0
jbe 0x8509f0
mov edx, dword [ebp + 0xe4]
mov eax, esi
sub eax, edx
cmp eax, 0x7d0
jae 0x8509f0
mov ecx, ebp
call fcn.0084fda0
cmp dword [ebp + 0x94], 3
jne 0x850a4b
cmp word [ebp + 0x84], 2
jne 0x850a4b
mov ecx, dword [ebp + 0xe4]
add ecx, 0x3e8
cmp esi, ecx
jbe 0x850a4b
mov edx, dword [ebp + 0x98]
lea eax, [esp + 0x260]
mov esi, ebp
mov dword [esp + 0x260], 0
mov dword [esp + 0x268], 5
mov dword [esp + 0x26c], edx
call fcn.0084fd30
mov esi, dword [esp + 0x490]
mov eax, dword [ebp + 0xf4]
xor ebx, ebx
cmp eax, ebx
jne 0x850a79
mov eax, dword [ebp + 0xec]
add eax, 0xfa
cmp esi, eax
jbe 0x850a79
mov edi, 4
mov dword [ebp + 0xec], esi
mov dword [ebp + 0xf4], edi
jmp 0x850a7e
mov edi, 4
cmp dword [ebp + 0xf0], ebx
jne 0x850ac8
mov ecx, dword [ebp + 0xf4]
cmp ecx, ebx
je 0x850ac8
mov edx, dword [ebp + 0xf0]
mov eax, dword [ebp + 0xf8]
inc edx
cmp eax, ebx
mov dword [ebp + 0xf0], edx
je 0x850aae
push ecx
push ebp
call eax
add esp, 8
mov eax, dword [ebp + 0xf0]
dec eax
mov dword [ebp + 0xf0], eax
mov dword [ebp + 0xf4], ebx
call fcn.0084bcb0
mov esi, eax
cmp dword [ebp + 0x94], edi
jne 0x850b21
mov ecx, dword [ebp + 0xc8]
cmp dword [ebp + 0xd0], ecx
jne 0x850b21
sub esi, dword [ebp + 0xe4]
mov eax, esi
cmp eax, 0x64
jbe 0x850b01
mov edx, dword [ebp + 0xb8]
cmp edx, dword [ebp + 0xb0]
jne 0x850b14
cmp ecx, dword [ebp + 0xcc]
jne 0x850b14
cmp eax, 0x9c4
ja 0x850b14
cmp dword [ebp + 0xbc], 0x800
jl 0x850b21
mov ecx, ebp
mov dword [ebp + 0xbc], ebx
call fcn.00850500
mov ebp, dword [ebp + 0x7c]
cmp ebp, ebx
jne 0x8506da
mov edx, dword [esp + 0x2c]
mov eax, dword [0x9c3cfc]
mov ecx, dword [0x9c3ab0]
test ecx, ecx
jl 0x850c09
cmp dword [0x9c3ab8], 5
jne 0x850c09
mov edi, dword [esp + 0x28]
cmp di, 2
jne 0x850c09
test eax, eax
je 0x850c09
mov esi, dword [0x9c3abc]
lea esp, [esp]
cmp dword [eax + 0x94], 2
jne 0x850be0
cmp word [eax + 0x84], 2
jne 0x850be0
cmp dword [eax + 0x98], esi
jne 0x850be0
mov ecx, dword [esp + 0x18]
cmp ecx, dword [eax + 0x80]
jne 0x850be0
movzx ebx, byte [eax + 0x8a]
xor ecx, ecx
mov ch, byte [eax + 0x88]
movzx ebp, dh
mov cl, byte [eax + 0x89]
shl ecx, 8
or ecx, ebx
movzx ebx, byte [eax + 0x8b]
shl ecx, 8
or ecx, ebx
movzx ebx, dl
shl ebx, 8
or ebx, ebp
movzx ebp, byte [esp + 0x2e]
shl ebx, 8
or ebx, ebp
movzx ebp, byte [esp + 0x2f]
shl ebx, 8
or ebx, ebp
cmp ecx, ebx
je 0x850be9
mov eax, dword [eax + 0x7c]
test eax, eax
jne 0x850b70
jmp 0x850c09
add eax, 0x84
mov dword [eax], edi
mov edx, dword [esp + 0x2c]
mov dword [eax + 4], edx
mov ecx, dword [esp + 0x30]
mov dword [eax + 8], ecx
mov edx, dword [esp + 0x34]
mov dword [eax + 0xc], edx
mov edx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x1c]
test ecx, ecx
pop ebp
je 0x850cbd
mov eax, dword [0x9c3ab0]
test eax, eax
jne 0x850cbd
movzx esi, byte [ecx + 0x8a]
xor eax, eax
mov ah, byte [ecx + 0x88]
mov edi, dword [ecx + 0x98]
mov al, byte [ecx + 0x89]
shl eax, 8
or eax, esi
movzx esi, byte [ecx + 0x8b]
shl eax, 8
or eax, esi
mov esi, dword [0x9c3abc]
cmp edi, esi
jne 0x850cbd
test eax, eax
je 0x850c80
movzx ecx, dl
shl ecx, 8
movzx edx, dh
or ecx, edx
movzx edx, byte [esp + 0x2a]
shl ecx, 8
or ecx, edx
movzx edx, byte [esp + 0x2b]
shl ecx, 8
or ecx, edx
cmp eax, ecx
jne 0x850cbd
mov edx, dword [esp + 0x24]
mov eax, dword [esp + 0x18]
lea ecx, [eax + 0x84]
mov dword [ecx], edx
mov edx, dword [esp + 0x28]
mov dword [ecx + 4], edx
mov edx, dword [esp + 0x2c]
mov dword [ecx + 8], edx
mov edx, dword [esp + 0x30]
lea ebx, [esp + 0x24]
mov edi, 0x9c3ab0
mov dword [ecx + 0xc], edx
mov dword [eax + 0x94], 4
call fcn.0084fe10
mov ecx, dword [esp + 0x484]
mov eax, dword [esp + 0xc]
pop edi
pop esi
pop ebx
call fcn.007d6cb0
add esp, 0x47c
ret