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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffa4
push ebx
push esi
push edi
xor ebx, ebx
mov dword [ebp - 0x5c], ebx
mov dword [ebp - 0x50], ebx
mov dword [ebp - 0x48], ebx
mov dword [ebp - 0x4c], ebx
mov dword [ebp - 0x44], ebx
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0xc], ebx
mov ebx, eax
xor eax, eax
push ebp
push 0x510ff2
push dword fs:[eax]
mov dword fs:[eax], esp
mov byte [ecx], 1
mov eax, dword [ebx + 0x344]
call fcn.004896c4
test al, al
je 0x510fc2
mov eax, ebx
call fcn.0051173c
mov eax, ebx
call fcn.0051187c
mov eax, dword [0x531548]
cmp dword [eax], 0
je 0x51096c
call fcn.00407464
mov edx, dword [0x531a88]
sub eax, dword [edx]
xor edx, edx
push edx
push eax
mov eax, dword [0x5319cc]
mov eax, dword [eax]
cdq
cmp edx, dword [esp + 4]
jne 0x510946
cmp eax, dword [esp]
pop edx
pop eax
jbe 0x51095f
jmp 0x51094a
pop edx
pop eax
jle 0x51095f
mov eax, dword [0x531b98]
mov eax, dword [eax]
call fcn.00472bd0
push 1
call fcn.0040fd70
jmp 0x51091e
call fcn.00407464
mov edx, dword [0x531a88]
mov dword [edx], eax
mov eax, dword [ebx + 0x344]
mov edx, dword [eax + 0x288]
mov eax, dword [0x67d19c]
call fcn.0050b254
mov eax, dword [ebx + 0x344]
mov edx, dword [eax + 0x288]
mov eax, dword [0x531f0c]
mov eax, dword [eax]
call fcn.004d4a88
mov eax, dword [ebx + 0x344]
mov edx, dword [eax + 0x288]
mov eax, dword [0x67d19c]
call fcn.0050c360
mov eax, dword [ebx + 0x344]
mov edx, dword [eax + 0x288]
mov eax, dword [0x67d19c]
call fcn.0050c470
mov eax, dword [0x531ca8]
cmp byte [eax], 0
je 0x510b82
lea eax, [ebp - 0x10]
mov edx, dword [0x531bc0]
add edx, 4
call fcn.0040507c
mov eax, dword [ebp - 0x10]
mov edx, dword [0x531f6c]
mov edx, dword [edx]
call fcn.00405224
je 0x510a3e
mov eax, dword [0x531bc0]
mov ax, word [eax + 0x1d]
cmp ax, 0x2710
jae 0x510a1f
mov edx, dword [0x531bc0]
movzx edx, ax
mov eax, dword [0x5318d8]
mov eax, dword [eax]
call fcn.00498b1c
mov esi, eax
jmp 0x510a51
mov edx, dword [0x531bc0]
movzx edx, ax
sub edx, 0x2710
mov eax, dword [0x531590]
mov eax, dword [eax]
call fcn.00498b1c
mov esi, eax
jmp 0x510a51
mov eax, dword [0x5318d8]
mov eax, dword [eax]
mov edx, 0x73
call fcn.00498b1c
mov esi, eax
test esi, esi
je 0x510b82
lea eax, [ebp - 8]
push eax
call fcn.004079fc
mov eax, dword [0x531524]
cmp byte [eax], 0
je 0x510a9c
mov eax, dword [0x531d9c]
cmp byte [eax], 0
jne 0x510a9c
mov eax, dword [0x67d198]
mov eax, dword [eax + 0x40]
mov edx, dword [0x5314c8]
add eax, dword [edx]
sub dword [ebp - 8], eax
mov eax, dword [0x67d198]
mov eax, dword [eax + 0x44]
mov edx, dword [0x5313bc]
add eax, dword [edx]
sub dword [ebp - 4], eax
lea edx, [ebp - 0x20]
mov eax, esi
call fcn.00485718
lea eax, [ebp - 0x20]
push eax
push esi
push 1
lea edx, [ebp - 0x30]
mov eax, esi
call fcn.00485718
mov eax, dword [ebp - 0x24]
sar eax, 1
jns 0x510ac1
adc eax, 0
mov edx, dword [ebp - 4]
sub edx, eax
push edx
lea edx, [ebp - 0x40]
mov eax, esi
call fcn.00485718
mov eax, dword [ebp - 0x38]
sar eax, 1
jns 0x510adb
adc eax, 0
mov edx, dword [ebp - 8]
sub edx, eax
mov eax, dword [ebx + 0x344]
mov eax, dword [eax + 0x288]
pop ecx
call fcn.00484e94
lea eax, [ebp - 0x44]
mov edx, dword [0x531bc0]
add edx, 4
call fcn.0040507c
mov eax, dword [ebp - 0x44]
mov edx, dword [0x531f6c]
mov edx, dword [edx]
call fcn.00405224
je 0x510b82
mov eax, dword [ebx + 0x344]
mov eax, dword [eax + 0x288]
call fcn.004856f8
mov esi, eax
push 1
mov eax, esi
call fcn.00429ec4
push eax
call fcn.004077c4
mov eax, dword [esi + 0xc]
mov edx, 0xffff
call fcn.00428de0
lea edx, [ebp - 0x4c]
mov eax, dword [0x531bc0]
mov eax, dword [eax + 0x78]
call fcn.0040adac
mov ecx, dword [ebp - 0x4c]
lea eax, [ebp - 0x48]
mov edx, 0x511008
call fcn.00405124
mov eax, dword [ebp - 0x48]
push eax
mov ecx, dword [ebp - 4]
add ecx, 3
mov edx, dword [ebp - 8]
add edx, 9
mov eax, esi
call fcn.00429b90
mov eax, esi
call fcn.00484534
mov eax, dword [0x5316bc]
cmp byte [eax], 0
je 0x510bde
mov eax, dword [0x53168c]
cmp dword [eax], 1
jge 0x510ba1
mov eax, dword [0x53168c]
mov dword [eax], 1
mov edx, dword [0x53168c]
mov edx, dword [edx]
mov eax, dword [ebx + 0x344]
mov eax, dword [eax + 0x288]
call fcn.004d14fc
mov eax, dword [0x53168c]
cmp dword [eax], 1
jg 0x510bd1
mov eax, dword [0x5316bc]
mov byte [eax], 0
jmp 0x510c7e
mov eax, dword [0x53168c]
sub dword [eax], 2
jmp 0x510c7e
mov eax, dword [0x531ac4]
cmp byte [eax], 0
je 0x510c34
mov eax, dword [0x53168c]
cmp dword [eax], 0x1d
jle 0x510bfd
mov eax, dword [0x53168c]
mov dword [eax], 0x1d
mov edx, dword [0x53168c]
mov edx, dword [edx]
mov eax, dword [ebx + 0x344]
mov eax, dword [eax + 0x288]
call fcn.004d14fc
mov eax, dword [0x53168c]
cmp dword [eax], 0x1d
jl 0x510c2a
mov eax, dword [0x531ac4]
mov byte [eax], 0
jmp 0x510c7e
mov eax, dword [0x53168c]
add dword [eax], 2
jmp 0x510c7e
mov eax, dword [0x53187c]
cmp byte [eax], 0
je 0x510c7e
mov eax, dword [0x53168c]
cmp dword [eax], 1
jge 0x510c53
mov eax, dword [0x53168c]
mov dword [eax], 1
mov edx, dword [0x53168c]
mov edx, dword [edx]
mov eax, dword [ebx + 0x344]
mov eax, dword [eax + 0x288]
call fcn.004d14fc
mov eax, dword [0x53168c]
cmp dword [eax], 1
jle 0x510c7e
mov eax, dword [0x53168c]
sub dword [eax], 4
mov eax, dword [0x5317bc]
cmp byte [eax], 0
jne 0x510f86
mov eax, dword [0x531a94]
cmp byte [eax], 0
jne 0x510f86
mov eax, dword [ebx + 0x344]
mov eax, dword [eax + 0x288]
call fcn.004856f8
mov esi, eax
push 1
mov eax, esi
call fcn.00429ec4
push eax
call fcn.004077c4
mov eax, dword [0x531d9c]
cmp byte [eax], 0
jne 0x510e26
mov cl, 0x8c
mov dl, 0xef
mov al, 0xf7
call fcn.00407e70
mov edx, eax
mov eax, dword [esi + 0xc]
call fcn.00428de0
lea eax, [ebp - 0xc]
mov edx, 0x511018
call fcn.00404eb0
mov eax, ebx
call fcn.0046cec4
mov edx, 0x511030
call fcn.00429d00
mov edi, eax
mov eax, dword [ebp - 0xc]
call fcn.004050d8
imul edi, eax
mov eax, edi
mov edx, dword [ebp - 0xc]
push edx
mov ecx, dword [ebx + 0x4c]
sub ecx, 0x46
mov edx, 0x320
sub edx, eax
sar edx, 1
jns 0x510d24
adc edx, 0
mov eax, esi
call fcn.00429b90
lea eax, [ebp - 0xc]
mov edx, 0x51103c
call fcn.00404eb0
mov eax, ebx
call fcn.0046cec4
mov edx, 0x511030
call fcn.00429d00
mov edi, eax
mov eax, dword [ebp - 0xc]
call fcn.004050d8
imul edi, eax
mov eax, edi
mov edx, dword [ebp - 0xc]
push edx
mov ecx, dword [ebx + 0x4c]
sub ecx, 0x37
mov edx, 0x320
sub edx, eax
sar edx, 1
jns 0x510d70
adc edx, 0
mov eax, esi
call fcn.00429b90
lea eax, [ebp - 0xc]
mov edx, 0x511088
call fcn.00404eb0
mov eax, ebx
call fcn.0046cec4
mov edx, 0x511030
call fcn.00429d00
mov edi, eax
mov eax, dword [ebp - 0xc]
call fcn.004050d8
imul edi, eax
mov eax, edi
mov edx, dword [ebp - 0xc]
push edx
mov ecx, dword [ebx + 0x4c]
sub ecx, 0x28
mov edx, 0x320
sub edx, eax
sar edx, 1
jns 0x510dbc
adc edx, 0
mov eax, esi
call fcn.00429b90
mov edx, 0xff00
mov eax, dword [esi + 0xc]
call fcn.00428de0
mov dl, byte [0x5110cc]
mov eax, dword [esi + 0xc]
call fcn.004290ac
lea eax, [ebp - 0x50]
push eax
mov eax, 0x5110d8
mov dword [ebp - 0x58], eax
mov byte [ebp - 0x54], 0xb
lea edx, [ebp - 0x58]
xor ecx, ecx
mov eax, 0x5110ec
call fcn.0040bc68
mov eax, dword [ebp - 0x50]
push eax
mov ecx, dword [ebx + 0x4c]
sub ecx, 0x28
mov edx, 0x28f
mov eax, esi
call fcn.00429b90
mov dl, byte [0x5110fc]
mov eax, dword [esi + 0xc]
call fcn.004290ac
jmp 0x510f7f
mov cl, 0x8c
mov dl, 0xef
mov al, 0xf7
call fcn.00407e70
mov edx, eax
mov eax, dword [esi + 0xc]
call fcn.00428de0
lea eax, [ebp - 0xc]
mov edx, 0x511018
call fcn.00404eb0
mov eax, ebx
call fcn.0046cec4
mov edx, 0x511030
call fcn.00429d00
mov edi, eax
mov eax, dword [ebp - 0xc]
call fcn.004050d8
imul edi, eax
mov eax, edi
mov edx, dword [ebp - 0xc]
push edx
mov ecx, dword [ebx + 0x4c]
sub ecx, 0x2d
mov edx, 0x320
sub edx, eax
sar edx, 1
jns 0x510e80
adc edx, 0
mov eax, esi
call fcn.00429b90
lea eax, [ebp - 0xc]
mov edx, 0x51103c
call fcn.00404eb0
mov eax, ebx
call fcn.0046cec4
mov edx, 0x511030
call fcn.00429d00
mov edi, eax
mov eax, dword [ebp - 0xc]
call fcn.004050d8
imul edi, eax
mov eax, edi
mov edx, dword [ebp - 0xc]
push edx
mov ecx, dword [ebx + 0x4c]
sub ecx, 0x1e
mov edx, 0x320
sub edx, eax
sar edx, 1
jns 0x510ecc
adc edx, 0
mov eax, esi
call fcn.00429b90
lea eax, [ebp - 0xc]
mov edx, 0x511088
call fcn.00404eb0
mov eax, ebx
call fcn.0046cec4
mov edx, 0x511030
call fcn.00429d00
mov edi, eax
mov eax, dword [ebp - 0xc]
call fcn.004050d8
imul edi, eax
mov eax, edi
mov edx, dword [ebp - 0xc]
push edx
mov ecx, dword [ebx + 0x4c]
sub ecx, 0xf
mov edx, 0x320
sub edx, eax
sar edx, 1
jns 0x510f18
adc edx, 0
mov eax, esi
call fcn.00429b90
mov edx, 0xff00
mov eax, dword [esi + 0xc]
call fcn.00428de0
mov dl, byte [0x5110cc]
mov eax, dword [esi + 0xc]
call fcn.004290ac
lea eax, [ebp - 0x5c]
push eax
mov eax, 0x5110d8
mov dword [ebp - 0x58], eax
mov byte [ebp - 0x54], 0xb
lea eax, [ebp - 0x58]
push eax
mov eax, 0x5110ec
xor ecx, ecx
pop edx
call fcn.0040bc68
mov eax, dword [ebp - 0x5c]
push eax
mov ecx, dword [ebx + 0x4c]
sub ecx, 0xf
mov edx, 0x28f
mov eax, esi
call fcn.00429b90
mov dl, byte [0x5110fc]
mov eax, dword [esi + 0xc]
call fcn.004290ac
mov eax, esi
call fcn.00484534
mov eax, dword [0x531ec8]
inc dword [eax]
call fcn.00407464
mov edx, dword [0x5318bc]
sub eax, dword [edx]
cmp eax, 0x3e8
jb 0x510fb7
call fcn.00407464
mov edx, dword [0x5318bc]
mov dword [edx], eax
mov eax, dword [0x531ec8]
xor edx, edx
mov dword [eax], edx
mov eax, dword [ebx + 0x344]
call fcn.00489694
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x510ff9
lea eax, [ebp - 0x5c]
call fcn.00404e18
lea eax, [ebp - 0x50]
mov edx, 4
call fcn.00404e3c
lea eax, [ebp - 0x10]
mov edx, 2
call fcn.00404e3c
ret