Function at 0x54d160
Capabilities:
Check for time delay via queryperformancecounter

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff8
sub esp, 0x30
mov eax, dword [0x80e040]
xor eax, ebp
mov dword [esp + 0x28], eax
mov eax, dword [0x815354]
mov ecx, dword [0x813560]
mov edx, dword fs:[0x2c]
mov ecx, dword [edx + ecx*4]
cmp eax, dword [ecx + 4]
jg 0x54d3c1
movzx ebx, byte [ebp + 8]
mov edi, dword [0x815350]
push edi
call dword [sym.imp.KERNEL32.dll_TryAcquireSRWLockExclusive]
test al, al
je 0x54d40c
movzx esi, bl
dec esi
or esi, 1
add esi, dword [0x815304]
mov dword [0x815304], esi
mov ebx, 1
test byte [0x815300], 1
je 0x54d3b7
test esi, esi
cmove ebx, esi
mov eax, dword [0x815308]
cmp ebx, eax
je 0x54d2eb
test eax, eax
je 0x54d2a3
mov dword [esp + 0x10], edi
mov ecx, dword [0x81057c]
cmp ecx, 0x54d850
mov dword [esp + 0x14], ebx
je 0x54d307
call dword [0x8072c0]
lea edi, [esp + 0x20]
push edi
call ecx
add esp, 4
mov eax, dword [edi]
mov edx, dword [edi + 4]
sub eax, dword [0x815358]
sbb edx, dword [0x81535c]
seto bl
mov ecx, edx
sar ecx, 0x1f
test bl, bl
cmovne eax, ecx
add ecx, 0x80000000
test bl, bl
cmove ecx, edx
mov edx, eax
add edx, 1
mov edi, ecx
adc edi, 0x80000000
cmp edx, 2
sbb edi, 0
mov edx, dword [0x815314]
mov edi, dword [0x815310]
jb 0x54d418
add edi, eax
adc edx, ecx
seto bl
mov eax, edx
sar eax, 0x1f
lea ecx, [eax - 0x80000000]
test bl, bl
cmove eax, edi
test bl, bl
cmove ecx, edx
mov dword [0x815310], eax
mov dword [0x815314], ecx
push dword [0x815308]
call dword [sym.imp.WINMM.dll_timeEndPeriod]
mov edi, dword [esp + 0x10]
mov ebx, dword [esp + 0x14]
mov dword [0x815308], ebx
test esi, esi
je 0x54d2eb
mov ecx, dword [0x81057c]
cmp ecx, 0x54d850
je 0x54d360
call dword [0x8072c0]
lea esi, [esp + 0x20]
push esi
call ecx
add esp, 4
mov eax, dword [esi]
mov edx, dword [esi + 4]
mov dword [0x815358], eax
mov dword [0x81535c], edx
push dword [0x815308]
call dword [sym.imp.WINMM.dll_timeBeginPeriod]
push edi
call dword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
mov ecx, dword [esp + 0x28]
xor ecx, ebp
call fcn.005c9f16
mov al, 1
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
xor eax, eax
lea edi, [esp + 0x20]
mov dword [edi + 4], eax
mov dword [edi], eax
push edi
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov eax, dword [edi]
mov edi, dword [edi + 4]
cmp eax, 0x7bd05af7
mov ecx, edi
sbb ecx, 0x863
jge 0x54d4ea
mov ecx, 0xf4240
mul ecx
imul ecx, edi, 0xf4240
add ecx, edx
push dword [0x81536c]
push dword [0x815368]
push ecx
push eax
call fcn.005f5430
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], edx
jmp 0x54d21f
mov ebx, edi
xor eax, eax
lea esi, [esp + 0x20]
mov dword [esi + 4], eax
mov dword [esi], eax
push esi
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov edi, dword [esi]
mov esi, dword [esi + 4]
cmp edi, 0x7bd05af7
mov eax, esi
sbb eax, 0x863
jge 0x54d45b
mov ecx, 0xf4240
mov eax, edi
mul ecx
imul ecx, esi, 0xf4240
add ecx, edx
push dword [0x81536c]
push dword [0x815368]
push ecx
push eax
call fcn.005f5430
mov edi, ebx
jmp 0x54d2d4
mov ebx, 8
jmp 0x54d1d6
push 0x815354
call fcn.005c8bdd
add esp, 4
cmp dword [0x815354], 0xffffffff
jne 0x54d198
push 4
call fcn.005c8b59
add esp, 4
mov esi, eax
mov dword [eax], 0
mov ecx, eax
call fcn.0054e310
mov dword [0x815350], esi
push 0x815354
call fcn.005c8c57
add esp, 4
jmp 0x54d198
mov ecx, edi
call fcn.0054e320
jmp 0x54d1b1
mov dword [esp + 4], edi
xor ebx, ebx
inc ebx
add dword [esp + 4], ebx
mov ebx, edx
adc ebx, 0x80000000
mov dword [esp], ebx
mov dword [esp + 8], 0
xor ebx, ebx
inc ebx
cmp ebx, dword [esp + 4]
mov ebx, dword [esp + 8]
sbb ebx, dword [esp]
setb bl
xor edi, eax
xor edx, ecx
or edx, edi
sete dl
or dl, bl
jne 0x54d284
int3
mov eax, dword [0x815368]
mov dword [esp + 0x10], eax
mov ecx, dword [0x81536c]
mov dword [esp + 0x14], ecx
push ecx
push eax
push esi
push edi
call fcn.005f5430
mov dword [esp + 4], eax
mov dword [esp + 0xc], edx
mul dword [esp + 0x10]
mov dword [esp + 8], eax
mov ecx, dword [esp + 4]
imul ecx, dword [esp + 0x14]
add edx, ecx
mov eax, dword [esp + 0xc]
imul ecx, eax, 0xf4240
mov dword [esp], ecx
imul eax, dword [esp + 0x10]
add eax, edx
sub edi, dword [esp + 8]
sbb esi, eax
mov ecx, 0xf4240
mov eax, dword [esp + 4]
mul ecx
mov dword [esp + 4], eax
add edx, dword [esp]
mov dword [esp], edx
mov eax, edi
mul ecx
imul ecx, esi, 0xf4240
add edx, ecx
push dword [esp + 0x14]
push dword [esp + 0x14]
push edx
push eax
call fcn.005f5430
add eax, dword [esp + 4]
adc edx, dword [esp]
mov edi, ebx
jmp 0x54d2d4
mov ecx, dword [0x815368]
mov dword [esp + 4], ecx
mov edx, dword [0x81536c]
mov dword [esp + 8], edx
push edx
push ecx
push edi
push eax
mov dword [esp + 0x1c], eax
call fcn.005f5430
mov dword [esp], eax
mov ecx, edx
mov eax, dword [esp]
mul dword [esp + 4]
mov dword [esp + 0x18], eax
mov eax, edi
mov edi, dword [esp]
imul edi, dword [esp + 8]
add edx, edi
imul edi, ecx, 0xf4240
mov dword [esp + 0x1c], edi
imul ecx, dword [esp + 4]
add ecx, edx
mov edi, dword [esp + 0xc]
sub edi, dword [esp + 0x18]
sbb eax, ecx
mov ecx, eax
mov edx, 0xf4240
mov eax, dword [esp]
mul edx
mov dword [esp], eax
add edx, dword [esp + 0x1c]
mov dword [esp + 0xc], edx
mov eax, edi
mov edx, 0xf4240
mul edx
imul ecx, ecx, 0xf4240
add edx, ecx
push dword [esp + 8]
push dword [esp + 8]
push edx
push eax
call fcn.005f5430
add eax, dword [esp]
adc edx, dword [esp + 0xc]
jmp 0x54d353