Function at 0x405821
Capabilities:
Accept command line arguments
Check if file exists
Copy file
Create process on windows
Get common file path
Get file attributes
Terminate process

Disassembly:
sub esp, 0x3b0
mov eax, dword [0x4261a4]
xor eax, esp
mov dword [esp + 0x3ac], eax
push ebx
push ebp
mov ebp, 0x104
lea eax, [esp + 0xa0]
push ebp
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push str.lpk.dll
lea eax, [esp + 0xa4]
push ebp
push eax
call fcn.0040c288
add esp, 0xc
lea eax, [esp + 0xa0]
xor ebx, ebx
push 8
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryExA]
push ebp
lea eax, [esp + 0xa4]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
push str..local
lea eax, [esp + 0xa4]
push 0x10a
push eax
call fcn.0040c288
add esp, 0xc
lea eax, [esp + 0xa0]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x4058b9
push 1
call dword [sym.imp.KERNEL32.dll_ExitProcess]
push esi
lea eax, [esp + 0x14]
mov dword [esp + 0x14], ebx
push edi
push eax
mov dword [esp + 0x20], ebx
mov dword [esp + 0x24], ebx
call fcn.004051a3
mov edi, dword [esp + 0x1c]
mov ebp, ebx
mov ebx, dword [esp + 0x20]
mov eax, ebx
pop ecx
sub eax, edi
push 0x18
cdq
pop ecx
idiv ecx
mov dword [esp + 0x10], eax
test eax, eax
je 0x40591b
mov esi, edi
cmp dword [esi + 0x14], 0x10
mov ecx, esi
jb 0x4058fa
mov ecx, dword [esi]
push ecx
push str._run1
call fcn.004109b5
pop ecx
pop ecx
test eax, eax
je 0x405bda
push 0x18
pop eax
inc ebp
add esi, eax
cmp ebp, dword [esp + 0x10]
jb 0x4058f0
push 0x104
lea eax, [esp + 0x1b8]
xor ebp, ebp
push eax
push ebp
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea eax, [esp + 0x78]
mov dword [esp + 0x78], ebp
push eax
mov dword [esp + 0x8c], ebp
mov dword [esp + 0x90], 0xf
call fcn.00405366
pop ecx
test eax, eax
je 0x405961
lea eax, [esp + 0x78]
push eax
call fcn.004050df
pop ecx
cmp dword [esp + 0x8c], 0x10
lea eax, [esp + 0x1b4]
lea esi, [esp + 0x78]
cmovae esi, dword [esp + 0x78]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFindFileNameA]
push eax
push esi
lea eax, [esp + 0x2c0]
push eax
call dword [sym.imp.SHLWAPI.dll_PathCombineA]
push 1
lea eax, [esp + 0x2bc]
push eax
lea eax, [esp + 0x1bc]
push eax
call dword [sym.imp.KERNEL32.dll_CopyFileA]
test eax, eax
je 0x405afd
call dword [sym.imp.KERNEL32.dll_GetCommandLineA]
cmp dword [edi + 0x14], 0x10
mov esi, eax
mov ecx, edi
jb 0x4059c2
mov ecx, dword [edi]
push dword [edi + 0x10]
push ecx
push esi
call fcn.00410a90
xor ecx, ecx
add esp, 0xc
test eax, eax
setne cl
inc ecx
add ecx, dword [edi + 0x10]
add ecx, esi
push ecx
lea ecx, [esp + 0x94]
call fcn.00404ddf
mov esi, str.__run1__shortcut_
push esi
call fcn.0040c300
pop ecx
push eax
push esi
lea ecx, [esp + 0x98]
call fcn.0040564f
mov esi, eax
lea eax, [esp + 0x1b4]
push eax
call fcn.0040c300
pop ecx
push eax
lea eax, [esp + 0x1b8]
mov ecx, esi
push eax
call fcn.0040564f
mov ebp, 0x41d690
mov esi, eax
push ebp
call fcn.0040c300
pop ecx
push eax
push ebp
mov ecx, esi
call fcn.0040564f
mov eax, dword [esp + 0xa0]
inc eax
push eax
call fcn.004088e9
cmp dword [esp + 0xa8], 0x10
lea ecx, [esp + 0x94]
mov ebp, eax
cmovae ecx, dword [esp + 0x94]
push ecx
mov ecx, dword [esp + 0xa8]
inc ecx
push ecx
push ebp
call fcn.0040c22e
push 0x44
pop esi
push esi
lea eax, [esp + 0x48]
push 0
push eax
call fcn.004037f2
push 0x10
lea eax, [esp + 0x44]
mov dword [esp + 0x54], esi
push 0
push eax
call fcn.004037f2
add esp, 0x28
lea ecx, [esp + 0x24]
cmp dword [esp + 0x8c], 0x10
lea eax, [esp + 0x78]
cmovae eax, dword [esp + 0x78]
push ecx
lea ecx, [esp + 0x38]
push ecx
push eax
xor eax, eax
push eax
push eax
push eax
push eax
push eax
push ebp
lea eax, [esp + 0x2dc]
push eax
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
test eax, eax
je 0x405aea
push 0xffffffffffffffff
push dword [esp + 0x28]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push dword [esp + 0x28]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [esp + 0x24]
call esi
push ebp
call fcn.004088f2
pop ecx
lea ecx, [esp + 0x90]
call fcn.0040559f
lea eax, [esp + 0x78]
push eax
call fcn.00404f3f
mov eax, dword [esp + 0x90]
mov ebp, 0x1000
pop ecx
cmp eax, 0x10
jb 0x405b4c
mov ecx, dword [esp + 0x78]
inc eax
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], ecx
cmp eax, ebp
jb 0x405b43
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x18]
push eax
call fcn.004053f3
mov eax, dword [esp + 0x18]
pop ecx
pop ecx
mov ecx, dword [esp + 0x14]
push eax
push ecx
call fcn.004088db
pop ecx
pop ecx
and dword [esp + 0x88], 0
mov dword [esp + 0x8c], 0xf
mov byte [esp + 0x78], 0
test edi, edi
je 0x405bbf
mov esi, edi
cmp esi, ebx
je 0x405b82
push 0x18
pop edi
mov ecx, esi
call fcn.0040559f
add esi, edi
cmp esi, ebx
jne 0x405b71
mov edi, dword [esp + 0x18]
mov eax, dword [esp + 0x20]
sub eax, edi
mov dword [esp + 0x14], edi
push 0x18
cdq
pop ecx
idiv ecx
imul eax, eax, 0x18
mov dword [esp + 0x10], eax
cmp eax, ebp
jb 0x405bb6
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x18]
push eax
call fcn.004053f3
mov eax, dword [esp + 0x18]
mov edi, dword [esp + 0x1c]
pop ecx
pop ecx
push eax
push edi
call fcn.004088db
pop ecx
pop ecx
xor eax, eax
mov ecx, dword [esp + 0x3bc]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040886f
add esp, 0x3b0
ret
test edi, edi
je 0x405c38
mov esi, edi
cmp esi, ebx
je 0x405bf8
push 0x18
pop edi
mov ecx, esi
call fcn.0040559f
add esi, edi
cmp esi, ebx
jne 0x405be7
mov edi, dword [esp + 0x18]
mov eax, dword [esp + 0x20]
sub eax, edi
mov dword [esp + 0x10], edi
push 0x18
cdq
pop ecx
idiv ecx
imul eax, eax, 0x18
mov dword [esp + 0x14], eax
cmp eax, 0x1000
jb 0x405c2f
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x14]
push eax
call fcn.004053f3
mov eax, dword [esp + 0x1c]
mov edi, dword [esp + 0x18]
pop ecx
pop ecx
push eax
push edi
call fcn.004088db
pop ecx
pop ecx
xor eax, eax
inc eax
jmp 0x405bc1