Function at 0x405020
Capabilities:
Check for time delay via gettickcount
Check for time delay via queryperformancecounter

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x2288
call fcn.005589e0
push ebx
push esi
push edi
lea eax, [ebp - 0xc]
mov dword [ebp - 0x10], edx
push eax
mov edi, ecx
xor esi, esi
call dword [sym.imp.KERNEL32.dll_QueryPerformanceFrequency]
test eax, eax
je 0x40507a
lea eax, [ebp - 0x24]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov edx, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x24]
call fcn.0057cc10
mov edx, dword [ebp - 8]
mov ecx, dword [ebp - 0xc]
movsd qword [ebp - 0x24], xmm0
call fcn.0057cc10
movsd xmm1, qword [ebp - 0x24]
divsd xmm1, xmm0
movsd qword [ebp - 0x24], xmm1
jmp 0x4050a1
call dword [sym.imp.KERNEL32.dll_GetTickCount]
movd xmm0, eax
cvtdq2pd xmm0, xmm0
shr eax, 0x1f
addsd xmm0, qword [eax*8 + 0x5cbc70]
mulsd xmm0, qword [0x5cbc08]
movsd qword [ebp - 0x24], xmm0
push 0x38
xorps xmm0, xmm0
mov dword [ebp - 0x14], esi
lea eax, [ebp - 0x6c]
movq qword [ebp - 0xac], xmm0
push 0
push eax
movups xmmword [ebp - 0xbc], xmm0
mov dword [ebp - 0x18], esi
call fcn.0055a650
add esp, 0xc
lea eax, [ebp - 0xa4]
push 0x38
push 0
push eax
call fcn.0055a650
add esp, 0xc
lea eax, [ebp - 0x104]
push 0x48
push 0
push eax
call fcn.0055a650
add esp, 0xc
push str.old_:__
call fcn.00402c70
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
add esp, 4
test edi, edi
je 0x405165
push 0x1000
lea eax, [ebp - 0x2284]
push eax
push 0xffffffffffffffff
push edi
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
test eax, eax
jg 0x405151
call ebx
xor ebx, ebx
cmp eax, 0x7a
setne bl
lea ebx, [ebx*4 + 0x26]
call fcn.00562809
push edi
push 0x5c1f7c
mov dword [eax], ebx
call fcn.00402c70
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x405162
lea eax, [ebp - 0x2284]
push eax
push 0x5c1f78
call fcn.00402c70
add esp, 8
push str.__ndiff:__
call fcn.00402c70
add esp, 4
lea eax, [ebp - 0x2284]
push 0x1000
push eax
push 0xffffffffffffffff
push dword [ebp - 0x10]
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov ecx, eax
mov dword [ebp - 8], ecx
test ecx, ecx
jg 0x4051b4
call ebx
xor ebx, ebx
cmp eax, 0x7a
setne bl
lea ebx, [ebx*4 + 0x26]
call fcn.00562809
mov ecx, dword [ebp - 8]
mov dword [eax], ebx
test ecx, ecx
lea eax, [ebp - 0x2284]
mov ebx, 0x5c1f7c
mov edx, 0x5c1f78
cmovle eax, dword [ebp - 0x10]
push eax
mov eax, ebx
cmovg eax, edx
push eax
call fcn.00402c70
push str.__nout_:__
call fcn.00402c70
add esp, 0xc
lea eax, [ebp - 0x2284]
push 0x1000
push eax
push 0xffffffffffffffff
push dword [ebp + 8]
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov ecx, eax
mov dword [ebp - 8], ecx
test ecx, ecx
jg 0x40522e
call dword [sym.imp.KERNEL32.dll_GetLastError]
xor ebx, ebx
cmp eax, 0x7a
setne bl
lea ebx, [ebx*4 + 0x26]
call fcn.00562809
mov ecx, dword [ebp - 8]
mov dword [eax], ebx
mov ebx, 0x5c1f7c
test ecx, ecx
lea eax, [ebp - 0x2284]
cmovle eax, dword [ebp + 8]
push eax
mov eax, 0x5c1f78
cmovg ebx, eax
push ebx
call fcn.00402c70
push 0x5c1fb8
call fcn.00402c70
add esp, 0xc
test edi, edi
je 0x40529b
mov ecx, edi
lea edx, [ecx + 1]
nop
mov al, byte [ecx]
inc ecx
test al, al
jne 0x405260
sub ecx, edx
je 0x40529b
mov edx, edi
lea ecx, [ebp - 0x6c]
call fcn.004172b0
test eax, eax
jne 0x4052a2
push str.open_oldFile_for_read_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 2
jmp 0x405810
mov dword [ebp - 0x5c], 0x418360
mov edx, dword [ebp - 0x10]
lea ecx, [ebp - 0xa4]
call fcn.004172b0
test eax, eax
jne 0x4052bb
push str.open_diffFile_for_read_ERROR__n
jmp 0x40527e
lea eax, [ebp - 0xa4]
push eax
lea edx, [ebp - 0x284]
lea ecx, [ebp - 0x21c]
call fcn.004195a0
add esp, 4
test eax, eax
jne 0x405407
cmp dword [ebp - 0x74], esi
je 0x405305
push str.read_diffFile_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 4
jmp 0x405810
sub esp, 8
lea edx, [ebp - 0xa4]
lea ecx, [ebp - 0x3c4]
call fcn.0041aaa0
add esp, 8
test eax, eax
je 0x4053e5
lea ecx, [ebp - 0x38c]
lea edx, [ecx + 1]
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x405330
sub ecx, edx
lea eax, [ecx + 1]
push eax
lea eax, [ebp - 0x38c]
push eax
lea eax, [ebp - 0x208]
push eax
call fcn.0055a7b0
mov ecx, dword [ebp - 0x3c0]
xor eax, eax
mov edi, dword [ebp - 0x390]
add esp, 0xc
cmp byte [ebp - 0x38c], al
mov dword [ebp - 0x218], ecx
mov ecx, dword [ebp - 0x3b8]
setne al
mov dword [ebp - 0x20c], eax
mov eax, dword [ebp - 0x3c4]
mov dword [ebp - 0x21c], eax
mov eax, dword [ebp - 0x3bc]
mov dword [ebp - 0x214], eax
mov dword [ebp - 0x210], ecx
test edi, edi
jne 0x4053c3
push str.patch_single_compressed_diffData__n
mov dword [ebp - 0x14], 1
call fcn.00402c70
mov eax, 0x3000
add esp, 4
cmp dword [ebp + 0x10], eax
cmovae eax, dword [ebp + 0x10]
mov dword [ebp + 0x10], eax
jmp 0x40540d
push str.stepMemSize_too_large_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 8
jmp 0x405810
push str.is_hdiff_file__get_diffInfo_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 9
jmp 0x405810
mov edi, dword [ebp - 0x390]
mov eax, dword [ebp - 0x64]
mov ebx, dword [ebp - 0x60]
mov dword [ebp - 8], eax
cmp eax, dword [ebp - 0x214]
jne 0x4057e0
cmp ebx, dword [ebp - 0x210]
jne 0x4057e0
mov edx, dword [ebp - 0xb8]
test edx, edx
jne 0x405479
mov ebx, dword [ebp - 0x20c]
test ebx, ebx
jne 0x4054c9
lea ecx, [ebp - 0x208]
lea eax, [ecx + 1]
mov dword [ebp - 8], eax
mov al, byte [ecx]
inc ecx
test al, al
jne 0x405452
sub ecx, dword [ebp - 8]
je 0x405479
push ebx
lea eax, [ebp - 0x208]
push eax
push str.hpatchz_run_with_decompress_plugin:___s___need_decompress__d__n
call fcn.00402c70
mov edx, dword [ebp - 0xb8]
add esp, 0xc
push dword [ebp - 0x218]
xor eax, eax
lea ebx, [ebp - 0xbc]
push dword [ebp - 0x21c]
test edx, edx
lea ecx, [ebp - 0x104]
mov edx, dword [ebp + 8]
cmove ebx, eax
call fcn.00417780
add esp, 8
test eax, eax
jne 0x4054f2
push str.open_out_newFile_for_write_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 3
jmp 0x405810
lea eax, [ebp - 0x208]
push eax
push str.can_not_decompress___s__data_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 0xc
mov esi, 0xa
jmp 0x405810
push dword [ebp - 0xf8]
push dword [ebp - 0xfc]
push dword [ebp - 0x98]
push dword [ebp - 0x9c]
push dword [ebp - 0x60]
push dword [ebp - 0x64]
push str.oldDataSize_:__I64u_ndiffDataSize:__I64u_nnewDataSize_:__I64u_n
call fcn.00402c70
mov edx, dword [ebp + 0x10]
lea ecx, [ebp - 0x10]
add esp, 0x1c
xor eax, eax
cmp dword [ebp - 0x14], eax
cmovne eax, dword [ebp - 0x394]
push ecx
push dword [ebp - 0x60]
mov ecx, dword [ebp + 0xc]
push dword [ebp - 0x64]
push eax
call fcn.00404f90
mov ecx, eax
add esp, 0x10
mov dword [ebp - 0x18], ecx
test ecx, ecx
jne 0x405555
push str.alloc_cache_memory_ERROR__n
jmp 0x4053c8
cmp dword [ebp - 0x14], esi
je 0x4055ee
mov edx, dword [ebp - 0x394]
mov eax, edx
mov ecx, dword [ebp - 0x10]
add eax, 0x3000
adc edi, esi
cmp esi, edi
ja 0x405584
jb 0x40557a
cmp ecx, eax
jae 0x405584
push str.alloc_cache_memory_ERROR__n
jmp 0x4053c8
mov edi, dword [ebp - 0x18]
push ecx
lea eax, [ecx + edi]
push eax
push edi
push edx
push dword [ebp - 0x398]
lea eax, [ebp - 0xa4]
push dword [ebp - 0x39c]
lea edx, [ebp - 0x6c]
push ebx
push dword [ebp - 0x3a8]
lea ecx, [ebp - 0x104]
push dword [ebp - 0x3ac]
push dword [ebp - 0x3b0]
push dword [ebp - 0x3b4]
push dword [ebp - 0x3a0]
push dword [ebp - 0x3a4]
push eax
call fcn.0041a9b0
xor ecx, ecx
add esp, 0x38
test eax, eax
mov edi, 0x10
cmovne edi, ecx
jne 0x405673
jmp 0x4056c2
add dword [ebp - 0x10], ecx
lea eax, [ebp - 0x6c]
mov dword [ebp - 8], eax
lea edx, [ebp - 8]
lea eax, [ebp - 0x14]
mov dword [ebp - 0x28], ecx
push eax
lea eax, [ebp - 0x10]
mov dword [ebp - 0x30], esi
push eax
lea eax, [ebp - 0x28]
mov dword [ebp - 0x14], esi
push eax
push ecx
push ebx
push ecx
lea eax, [ebp - 0xa4]
push eax
push dword [ebp - 0xf8]
lea ecx, [ebp - 0x30]
push dword [ebp - 0xfc]
call fcn.0041a600
add esp, 0x24
cmp dword [ebp - 0x14], esi
jne 0x4056bd
push dword [ebp - 0x10]
mov edi, dword [ebp - 0x30]
lea eax, [ebp - 0xa4]
push dword [ebp - 0x28]
lea ecx, [ebp - 0x104]
push edi
push ebx
push eax
push dword [ebp - 8]
call fcn.00419830
add esp, 0x18
mov ebx, eax
test edi, edi
je 0x40566f
mov eax, dword [edi + 0xc]
push edi
call eax
add esp, 4
test eax, eax
je 0x4056bd
test ebx, ebx
je 0x4056bd
mov edx, dword [ebp - 0xc4]
mov edi, dword [ebp - 0xfc]
mov eax, dword [ebp - 0xc0]
mov ecx, dword [ebp - 0xf8]
cmp edx, edi
jne 0x4056a5
cmp eax, ecx
jne 0x4056a5
push str.__patch_ok__n
call fcn.00402c70
add esp, 4
jmp 0x405810
push ecx
push edi
push eax
push edx
push str.out_newFile_dataSize__I64u___diffFile_saved_newDataSize__I64u_ERROR__n
push 2
call fcn.00562462
add esp, 4
jmp 0x4057ff
mov edi, 0xb
cmp dword [ebp - 0x3c], esi
je 0x4056d1
push str.oldFile_read_ERROR__n
jmp 0x4052e8
cmp dword [ebp - 0x74], esi
je 0x4056e0
push str.diffFile_read_ERROR__n
jmp 0x4052e8
mov eax, dword [ebp - 0xd4]
test eax, eax
je 0x40572c
push str.out_newFile_write_ERROR__n
push 2
cmp eax, 0x1c
jne 0x405711
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 0x18
jmp 0x405810
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 5
jmp 0x405810
mov eax, dword [ebp - 0xa8]
cmp eax, 4
ja case.0x40573b.3
jmp dword [eax*4 + 0x405a1c]
push str.decompressPlugin_alloc_memory_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 0x16
jmp 0x405810
push str.decompressPlugin_open_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 0x14
jmp 0x405810
push str.decompressPlugin_close_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 0x15
jmp 0x405810
push str.patch_run_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, edi
jmp 0x405810
push str.decompressPlugin_decompress_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
mov esi, 0x17
jmp 0x405810
push 2
call fcn.00562462
add esp, 4
push dword [ebp - 0x210]
push dword [ebp - 0x214]
push ebx
push dword [ebp - 8]
push str.oldFile_dataSize__I64u___diffFile_saved_oldDataSize__I64u_ERROR__n
push eax
call fcn.00402c50
mov esi, 6
add esp, 0x18
nop dword [eax]
mov eax, dword [ebp - 0xec]
mov ebx, 7
test eax, eax
je 0x405896
push eax
mov dword [ebp - 0xec], 0
call fcn.0056428d
add esp, 4
test eax, eax
je 0x405896
call fcn.00562809
mov edi, dword [eax]
mov eax, dword [ebp - 0xd4]
cmp eax, edi
je 0x405879
test edi, edi
je 0x405879
test eax, eax
push edi
cmove eax, edi
mov dword [ebp - 0xd4], eax
call fcn.00562b53
add esp, 4
push eax
push edi
push str.call_import_system_api_error__errno:__d__errmsg:__s._n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 0x10
push str.out_newFile_close_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
test esi, esi
cmove esi, ebx
mov eax, dword [ebp - 0x8c]
test eax, eax
je 0x405911
push eax
mov dword [ebp - 0x8c], 0
call fcn.0056428d
add esp, 4
test eax, eax
je 0x405911
call fcn.00562809
mov edi, dword [eax]
mov eax, dword [ebp - 0x74]
cmp eax, edi
je 0x4058f4
test edi, edi
je 0x4058f4
test eax, eax
push edi
cmove eax, edi
mov dword [ebp - 0x74], eax
call fcn.00562b53
add esp, 4
push eax
push edi
push str.call_import_system_api_error__errno:__d__errmsg:__s._n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 0x10
push str.diffFile_close_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
test esi, esi
cmove esi, ebx
mov eax, dword [ebp - 0x54]
test eax, eax
je 0x405986
push eax
mov dword [ebp - 0x54], 0
call fcn.0056428d
add esp, 4
test eax, eax
je 0x405986
call fcn.00562809
mov edi, dword [eax]
mov eax, dword [ebp - 0x3c]
cmp eax, edi
je 0x405969
test edi, edi
je 0x405969
test eax, eax
push edi
cmove eax, edi
mov dword [ebp - 0x3c], eax
call fcn.00562b53
add esp, 4
push eax
push edi
push str.call_import_system_api_error__errno:__d__errmsg:__s._n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 0x10
push str.oldFile_close_ERROR__n
push 2
call fcn.00562462
add esp, 4
push eax
call fcn.00402c50
add esp, 8
test esi, esi
cmove esi, ebx
mov eax, dword [ebp - 0x18]
test eax, eax
je 0x405996
push eax
call fcn.0055d993
add esp, 4
lea eax, [ebp - 0x34]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceFrequency]
test eax, eax
je 0x4059d4
lea eax, [ebp - 0xc]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
mov edx, dword [ebp - 8]
mov ecx, dword [ebp - 0xc]
call fcn.0057cc10
mov edx, dword [ebp - 0x30]
mov ecx, dword [ebp - 0x34]
movsd qword [ebp - 0xc], xmm0
call fcn.0057cc10
movsd xmm1, qword [ebp - 0xc]
divsd xmm1, xmm0
jmp 0x4059f6
call dword [sym.imp.KERNEL32.dll_GetTickCount]
movd xmm1, eax
cvtdq2pd xmm1, xmm1
shr eax, 0x1f
addsd xmm1, qword [eax*8 + 0x5cbc70]
mulsd xmm1, qword [0x5cbc08]
subsd xmm1, qword [ebp - 0x24]
sub esp, 8
movsd qword [esp], xmm1
push str._nhpatchz_time:__.3f_s_n
call fcn.00402c70
add esp, 0xc
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret