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

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff0
sub esp, 0xd0
mov edi, ecx
mov eax, dword [0x644040]
xor eax, ebp
mov dword [esp + 0xc8], eax
mov esi, dword [ebp + 8]
xor eax, eax
mov ecx, esi
neg ecx
mov edx, dword [ebp + 0xc]
sbb eax, edx
lea eax, [edi + 0x10]
mov dword [esp + 0x18], eax
jge 0x509f42
pcmpeqd xmm0, xmm0
movdqa xmmword [esp + 0x70], xmm0
xor eax, eax
dec eax
mov dword [esp + 0xa0], eax
mov dword [esp + 0xa4], eax
movdqa xmmword [esp + 0x90], xmm0
movdqa xmmword [esp + 0x80], xmm0
xor eax, eax
mov byte [esp + 0x70], al
mov byte [esp + 0xa0], al
cmp byte [edi + 0x14], al
mov dword [esp + 0x14], esi
mov dword [esp + 8], edx
je 0x509949
mov eax, esi
not eax
mov ecx, edx
xor ecx, 0x7fffffff
or ecx, eax
mov dword [esp + 0x20], edi
je 0x5098ff
mov ecx, dword [0x646080]
cmp ecx, 0x5536d0
jne 0x50992c
xor eax, eax
lea esi, [esp + 0x60]
mov dword [esi + 4], eax
mov dword [esi], eax
push esi
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov ebx, dword [esi]
mov esi, dword [esi + 4]
cmp ebx, 0x7bd05af7
mov eax, esi
sbb eax, 0x863
jge 0x50a022
mov ecx, 0xf4240
mov eax, ebx
mul ecx
imul ecx, esi, 0xf4240
add ecx, edx
push dword [0x6496cc]
push dword [0x6496c8]
push ecx
push eax
call fcn.005866e0
mov ebx, edx
mov esi, dword [esp + 0x14]
add eax, esi
adc ebx, dword [esp + 8]
seto cl
mov edx, ebx
sar edx, 0x1f
lea edi, [edx - 0x80000000]
test cl, cl
cmove edx, eax
mov dword [esp + 0x10], edx
test cl, cl
cmove edi, ebx
mov dword [esp + 0x1c], edi
mov edx, dword [esp + 8]
mov ebx, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov edi, esi
mov ecx, edx
mov dword [esp + 4], edi
mov eax, edi
mov edi, ebx
xor ebx, ebx
dec ebx
xor eax, ebx
mov dword [esp + 0xc], ecx
mov edx, 0x7fffffff
xor ecx, edx
or ecx, eax
mov eax, ebx
je 0x5098ba
push 0
mov esi, 0x3e8
push esi
push dword [esp + 0x14]
mov edi, dword [esp + 0x10]
push edi
call fcn.00582980
mov ecx, eax
mov ebx, edx
mul esi
imul esi, ebx, 0x3e8
add esi, edx
cmp eax, edi
sbb esi, dword [esp + 0xc]
mov esi, dword [esp + 0x14]
adc ecx, 0
adc ebx, 0
neg ebx
mov edi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, 0
sbb eax, eax
or eax, ecx
push eax
mov eax, dword [esp + 0x1c]
push dword [eax]
call edi
test eax, eax
jne 0x509c13
mov bl, 1
mov eax, dword [esp + 0x20]
cmp byte [eax + 0x14], 0
je 0x509913
cmp byte [esp + 0xa0], 1
je 0x5099aa
mov ecx, dword [esp + 0xc8]
xor ecx, ebp
call fcn.00566245
mov eax, ebx
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret 8
xor eax, eax
dec eax
mov dword [esp + 0x10], eax
mov dword [esp + 0x1c], 0x7fffffff
jmp 0x50984d
mov dword [esp + 0xc4], 0x1aa
mov al, byte [0x6495f6]
test al, al
je 0x5098d7
jmp 0x509fdc
call dword [0x63e19c]
lea esi, [esp + 0xb8]
push esi
call ecx
add esp, 4
mov eax, dword [esi]
mov ebx, dword [esi + 4]
jmp 0x50981f
lea esi, [esp + 0x60]
push 0x40
push str.waitable_event.cc
push str.TimedWait
push esi
call fcn.0050b5e0
add esp, 0x10
cmp byte [esp + 0xa0], 1
je 0x509f62
lea ecx, [esp + 0x70]
push 1
push 0
call fcn.005224f0
mov dword [esp + 0xb4], 0xa
mov al, byte [0x649456]
test al, al
jne 0x509f76
mov byte [esp + 0xa0], 1
mov esi, dword [esp + 0x14]
mov edx, dword [esp + 8]
jmp 0x5097a5
mov dword [esp + 0xb8], 0xa
mov al, byte [0x649456]
test al, al
jne 0x509fa5
call fcn.00562f95
mov eax, dword [eax]
mov dword [esp + 0x14], eax
call fcn.00562f95
xor esi, esi
mov dword [eax], esi
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push esi
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov esi, dword [esp + 0x70]
test esi, esi
je 0x509a58
cmp dword [esp + 0x74], 0
jne 0x509a58
cmp byte [esi + 0x11], 1
jne 0x509a58
mov eax, dword [esi + 0x20]
add eax, 0x50
mov dword [esp + 8], eax
push eax
call dword [sym.imp.KERNEL32.dll_TryAcquireSRWLockExclusive]
test al, al
je 0x509cd3
xor eax, eax
mov dword [esi + 0x1c], eax
mov dword [esi + 0x18], eax
cmp byte [esi + 0x2b], 0
jne 0x509a48
mov eax, dword [esi + 0x20]
cmp byte [esi + 0x29], 1
je 0x509ce2
dec dword [eax + 0xb0]
cmp byte [esi + 0x11], 0
je 0x509fcd
cmp byte [esi + 0x10], 0
je 0x509adf
mov word [esi + 0x29], 0
push dword [esp + 8]
call dword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
push edi
call dword [sym.imp.KERNEL32.dll_SetLastError]
call fcn.00562f95
mov ecx, dword [esp + 0x14]
mov dword [eax], ecx
cmp byte [esp + 0x98], 1
jne 0x509a7f
mov eax, dword [esp + 0x90]
test eax, eax
jne 0x509af7
mov eax, dword [esp + 0x78]
test eax, eax
je 0x509a8d
mov ecx, dword [esp + 0x7c]
mov dword [eax], ecx
mov eax, dword [esp + 0x74]
mov ecx, eax
shr ecx, 0xe
mov edx, eax
shr edx, 0x13
mov edx, dword [edx*4 + 0x64c810]
bt edx, ecx
jb 0x509f15
mov dword [esp + 0x74], 0
mov eax, dword [esp + 0x70]
mov ecx, eax
shr ecx, 0xe
mov edx, eax
shr edx, 0x13
mov edx, dword [edx*4 + 0x64c810]
bt edx, ecx
jae 0x5098e5
push eax
call fcn.004ff910
add esp, 4
jmp 0x5098e5
mov ecx, dword [esi + 0x20]
cmp byte [esi + 0x2a], 1
je 0x509f23
dec dword [ecx + 0xb4]
jmp 0x509a48
mov dword [esp + 0x14], eax
mov ecx, dword [fcn.0055fb00]
cmp ecx, 0x5536d0
mov dword [esp + 0xc], ebx
jne 0x509bdc
xor eax, eax
mov dword [esp + 0x64], eax
mov dword [esp + 0x60], eax
lea eax, [esp + 0x60]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov edi, dword [esp + 0x60]
mov esi, dword [esp + 0x64]
cmp edi, 0x7bd05af7
mov eax, esi
sbb eax, 0x863
jge 0x50a0d1
mov ecx, 0xf4240
mov eax, edi
mul ecx
imul ecx, esi, 0xf4240
add ecx, edx
push dword [0x6496cc]
push dword [0x6496c8]
push ecx
push eax
call fcn.005866e0
mov dword [esp + 0xb8], eax
mov dword [esp + 0xbc], edx
mov ecx, dword [esp + 0x88]
mov edi, dword [esp + 0x8c]
mov dword [esp + 0x18], eax
mov dword [esp + 8], ecx
sub eax, ecx
mov dword [esp + 0x20], edx
mov ecx, edx
sbb ecx, edi
seto bl
mov esi, ecx
sar esi, 0x1f
test bl, bl
cmovne eax, esi
add esi, 0x80000000
test bl, bl
cmove esi, ecx
cmp eax, 0xf4240
mov ecx, esi
sbb ecx, 0
jge 0x509d17
mov esi, dword [esp + 0x90]
test esi, esi
mov ebx, dword [esp + 0xc]
je 0x509a7f
lock dec dword [esi]
jne 0x509a7f
jmp 0x509f2d
call dword [0x63e19c]
lea esi, [esp + 0xb8]
push esi
call ecx
add esp, 4
mov eax, dword [esi]
mov edx, dword [esi + 4]
jmp 0x509b73
call dword [0x63e19c]
lea eax, [esp + 0x60]
push eax
call ecx
add esp, 4
mov eax, dword [esp + 0x60]
mov edx, dword [esp + 0x64]
jmp 0x509c80
cmp eax, 0x102
jne 0x50a0ab
mov ecx, dword [0x646080]
cmp ecx, 0x5536d0
jne 0x509bf9
xor eax, eax
mov dword [esp + 0x64], eax
mov dword [esp + 0x60], eax
lea eax, [esp + 0x60]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov ebx, dword [esp + 0x60]
mov edi, dword [esp + 0x64]
cmp ebx, 0x7bd05af7
mov eax, edi
sbb eax, 0x863
jge 0x50a162
mov eax, ebx
mov ecx, 0xf4240
mul ecx
imul ecx, edi, 0xf4240
add ecx, edx
push dword [0x6496cc]
push dword [0x6496c8]
push ecx
push eax
call fcn.005866e0
mov dword [esp + 4], eax
mov ecx, dword [esp + 0x10]
sub ecx, eax
mov esi, dword [esp + 0x1c]
sbb esi, edx
seto bl
mov edi, esi
sar edi, 0x1f
test bl, bl
lea eax, [edi - 0x80000000]
mov dword [esp + 0xc], eax
cmove edi, ecx
mov ecx, dword [esp + 0xc]
test bl, bl
cmove ecx, esi
mov esi, dword [esp + 4]
cmp esi, dword [esp + 0x10]
sbb edx, dword [esp + 0x1c]
mov esi, dword [esp + 0x14]
mov ebx, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
jl 0x509857
xor ebx, ebx
jmp 0x5098d7
push dword [esp + 8]
call dword [sym.imp.KERNEL32.dll_AcquireSRWLockExclusive]
jmp 0x509a13
mov ecx, dword [eax + 0x5c]
mov edx, dword [eax + 0xa0]
dec edx
mov dword [eax + 0xa0], edx
cmp ecx, dword [eax + 0x60]
je 0x509cff
cmp dword [eax + 0xa8], edx
jae 0x509d0a
mov word [eax + 0x78], 0
jmp 0x509a34
movzx ecx, word [ecx + 8]
mov word [eax + 0x78], cx
jmp 0x509a34
mov dword [esp + 0x10], eax
mov dword [esp + 4], edi
xor eax, eax
dec eax
mov ebx, 0x3938700
mov edi, dword [esp + 0x14]
add ebx, dword [edi + 0xf8]
mov ecx, dword [edi + 0xfc]
adc ecx, 0
mov edx, 0x7fffffff
cmovno edx, ecx
cmovo ebx, eax
cmp dword [esp + 0x18], ebx
mov ecx, dword [esp + 0x20]
sbb ecx, edx
jge 0x50a21b
mov eax, dword [edi + 0xf8]
mov edi, dword [edi + 0xfc]
mov edx, dword [esp + 8]
mov dword [esp + 0x18], eax
sub edx, eax
mov ebx, dword [esp + 4]
sbb ebx, edi
seto cl
mov eax, ebx
sar eax, 0x1f
test cl, cl
cmovne edx, eax
add eax, 0x80000000
test cl, cl
cmove eax, ebx
xor ecx, ecx
dec ecx
add ecx, edx
mov ebx, 0x7fffffff
adc ebx, eax
add ecx, 2
adc ebx, 0
cmp ecx, 2
sbb ebx, 0
jb 0x50a1fb
movd xmm0, edx
movd xmm1, eax
punpckldq xmm0, xmm1
movq qword [esp + 0x58], xmm0
fild qword [esp + 0x58]
fstp qword [esp + 0x50]
movsd xmm0, qword [esp + 0x50]
divsd xmm0, qword [0x62dcc0]
sub esp, 8
movsd qword [esp], xmm0
call fcn.0058fbc0
add esp, 8
fstp qword [esp + 0x30]
movsd xmm0, qword [esp + 0x30]
xor ecx, ecx
movsd xmm1, qword [0x62e2f0]
ucomisd xmm0, xmm1
mov eax, 0x7fffffff
cmovb eax, ecx
movsd xmm2, qword [0x62e2f8]
ucomisd xmm2, xmm0
maxsd xmm0, xmm1
cvttsd2si ebx, xmm0
cmovb ebx, eax
xor eax, eax
dec eax
mov ecx, dword [esp + 0x10]
add eax, ecx
movd xmm0, ecx
mov ecx, 0x7fffffff
adc ecx, esi
movd xmm1, esi
add eax, 2
adc ecx, 0
cmp eax, 2
sbb ecx, 0
mov edi, 0x7fffffff
punpckldq xmm0, xmm1
movq qword [esp + 0x48], xmm0
fild qword [esp + 0x48]
fstp qword [esp + 0x40]
jae 0x509e5c
movsd xmm0, qword [0x62e300]
jmp 0x509e6a
movsd xmm0, qword [esp + 0x40]
divsd xmm0, qword [0x62dcc0]
sub esp, 8
movsd qword [esp], xmm0
call fcn.0058fcbd
add esp, 8
fstp qword [esp + 0x38]
movsd xmm0, qword [esp + 0x38]
movsd xmm1, qword [0x62e2f0]
ucomisd xmm0, xmm1
mov eax, 0
cmovb edi, eax
movsd xmm2, qword [0x62e2f8]
ucomisd xmm2, xmm0
maxsd xmm0, xmm1
cvttsd2si esi, xmm0
cmovb esi, edi
add esi, ebx
cmp esi, 0x3c
mov edi, 0x3c
cmovl edi, esi
mov eax, dword [esp + 0x14]
add eax, 4
mov dword [esp + 8], eax
push eax
call dword [sym.imp.KERNEL32.dll_TryAcquireSRWLockExclusive]
test al, al
je 0x50a1ec
cmp ebx, edi
jge 0x509ee7
mov eax, dword [esp + 0x14]
inc dword [eax + ebx*4 + 8]
inc ebx
cmp edi, ebx
jne 0x509eda
push dword [esp + 8]
call dword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
cmp esi, 0x3d
jl 0x509bbb
mov eax, dword [esp + 0x14]
mov eax, dword [eax + 0x100]
sub esi, edi
xor ebx, ebx
mov dword [esp + 0x14], eax
test eax, eax
jne 0x509eaf
jmp 0x509bbb
push eax
call fcn.004ff910
add esp, 4
jmp 0x509aab
call fcn.00590b00
jmp 0x509a48
mov ecx, esi
call fcn.00411a60
push esi
call fcn.00562f60
add esp, 4
jmp 0x509a7f
mov ecx, dword [esp + 0x18]
call fcn.004f2cb0
mov ebx, eax
mov ecx, dword [esp + 0xc8]
xor ecx, ebp
call fcn.00566245
mov eax, ebx
jmp 0x5098f5
lea ebx, [esp + 0x70]
mov ecx, ebx
call fcn.00535730
mov byte [ebx + 0x30], 0
jmp 0x509970
movzx ecx, al
lea eax, [esp + 0xb8]
mov dword [eax], esi
lea esi, [esp + 0xc4]
mov dword [esi], str.ScopedBlockingCallWithBaseSyncPrimitives
lea edx, [esp + 0xb4]
push eax
push esi
call fcn.005b64a0
add esp, 8
jmp 0x509995
movzx eax, al
mov dword [esp + 0x60], 0
lea ecx, [esp + 0xb8]
push 2
lea edx, [esp + 0x64]
push edx
push ecx
push eax
call fcn.0058ff60
add esp, 0x10
jmp 0x5099c2
push str....._third_partylibc_srcincludeoptional:795:_assertion_this__has_value___failed:_optional_operator_called_on_a_disengaged_value_n
push 0x622e92
call fcn.00590170
movzx eax, al
mov ecx, dword [0x648794]
mov edx, dword [esp + 0x18]
xor edx, dword [0x648790]
mov dword [esp + 0x64], ecx
mov dword [esp + 0x60], edx
lea ecx, [esp + 0xb8]
mov dword [ecx], str.WaitableEvent::Wait_Complete
lea edx, [esp + 0xc4]
lea esi, [esp + 0x60]
push esi
push 3
push ecx
push edx
push eax
call fcn.005c0750
add esp, 0x14
jmp 0x5098d7
mov eax, dword [0x6496c8]
mov dword [esp + 0xc], eax
mov ecx, dword [0x6496cc]
mov dword [esp + 4], ecx
push ecx
push eax
push esi
push ebx
call fcn.005866e0
mov dword [esp + 0x10], eax
mov ecx, edx
mov eax, dword [esp + 0x10]
mul dword [esp + 0xc]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x10]
mov edi, eax
imul edi, dword [esp + 4]
add edx, edi
imul edi, ecx, 0xf4240
imul ecx, dword [esp + 0xc]
add ecx, edx
sub ebx, dword [esp + 0x1c]
sbb esi, ecx
mov ecx, 0xf4240
mul ecx
mov dword [esp + 0x10], eax
add edx, edi
mov dword [esp + 0x1c], edx
mov eax, ebx
mul ecx
imul ecx, esi, 0xf4240
add edx, ecx
push dword [esp + 4]
push dword [esp + 0x10]
push edx
push eax
call fcn.005866e0
mov ebx, edx
add eax, dword [esp + 0x10]
adc ebx, dword [esp + 0x1c]
jmp 0x50981f
mov ecx, esi
xor edx, edx
dec edx
xor ecx, edx
mov edx, dword [esp + 8]
mov esi, 0x7fffffff
xor edx, esi
or edx, ecx
jne 0x509c1e
mov ecx, eax
call fcn.005c06c0
jmp 0x509c1e
mov eax, dword [0x6496c8]
mov dword [esp + 8], eax
mov ecx, dword [0x6496cc]
mov dword [esp + 0x18], ecx
push ecx
push eax
push esi
push edi
call fcn.005866e0
mov dword [esp + 0x20], eax
mov dword [esp + 0x1c], edx
mul dword [esp + 8]
mov dword [esp + 0x10], eax
mov ecx, dword [esp + 0x20]
imul ecx, dword [esp + 0x18]
add edx, ecx
mov eax, dword [esp + 0x1c]
imul ecx, eax, 0xf4240
mov dword [esp + 4], ecx
imul eax, dword [esp + 8]
add eax, edx
sub edi, dword [esp + 0x10]
sbb esi, eax
mov ecx, 0xf4240
mov eax, dword [esp + 0x20]
mul ecx
mov dword [esp + 0x20], eax
add edx, dword [esp + 4]
mov dword [esp + 4], edx
mov eax, edi
mul ecx
imul ecx, esi, 0xf4240
add edx, ecx
push dword [esp + 0x18]
push dword [esp + 0xc]
push edx
push eax
call fcn.005866e0
add eax, dword [esp + 0x20]
adc edx, dword [esp + 4]
jmp 0x509b65
mov esi, dword [0x6496c8]
mov dword [esp + 0x28], esi
mov eax, dword [0x6496cc]
mov dword [esp + 0xc], eax
push eax
push esi
push edi
push ebx
call fcn.005866e0
mov dword [esp + 4], eax
mov ecx, edx
mov eax, dword [esp + 4]
mul esi
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 4]
mov esi, eax
imul esi, dword [esp + 0xc]
add edx, esi
imul esi, ecx, 0xf4240
mov dword [esp + 0x24], esi
mov esi, dword [esp + 0x28]
imul ecx, esi
add ecx, edx
sub ebx, dword [esp + 0x2c]
sbb edi, ecx
mov ecx, 0xf4240
mul ecx
mov dword [esp + 4], eax
add edx, dword [esp + 0x24]
mov dword [esp + 0x24], edx
mov eax, ebx
mul ecx
imul ecx, edi, 0xf4240
add edx, ecx
push dword [esp + 0xc]
push esi
push edx
push eax
call fcn.005866e0
add eax, dword [esp + 4]
adc edx, dword [esp + 0x24]
jmp 0x509c80
push dword [esp + 8]
call dword [sym.imp.KERNEL32.dll_AcquireSRWLockExclusive]
jmp 0x509ed6
mov eax, dword [esp + 0x18]
cmp dword [esp + 8], eax
sbb dword [esp + 4], edi
setl al
movzx eax, al
movsd xmm0, qword [eax*8 + 0x62e2e0]
jmp 0x509dc6
mov eax, dword [esp + 0x18]
mov dword [esp + 0x60], eax
mov eax, dword [esp + 0x20]
mov dword [esp + 0x64], eax
sub esp, 0xc
movq xmm0, qword [esp + 0x6c]
movq qword [esp + 4], xmm0
lea ebx, [esp + 0xd0]
mov dword [esp], ebx
call fcn.004f3190
add esp, 0xc
mov ebx, dword [ebx]
test ebx, ebx
je 0x509d55
lock dec dword [ebx]
jne 0x509d55
mov ecx, ebx
call fcn.00411a60
push ebx
call fcn.00562f60
add esp, 4
jmp 0x509d55