Function at 0x40587d
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 [0x4251a4]
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.0040c294
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.0040c294
add esp, 0xc
lea eax, [esp + 0xa0]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x405915
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.004051db
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 0x405977
mov esi, edi
cmp dword [esi + 0x14], 0x10
mov ecx, esi
jb 0x405956
mov ecx, dword [esi]
push ecx
push str._run1
call fcn.0040f7b5
pop ecx
pop ecx
test eax, eax
je 0x405c37
push 0x18
pop eax
inc ebp
add esi, eax
cmp ebp, dword [esp + 0x10]
jb 0x40594c
push 0x104
lea eax, [esp + 0x1b8]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
and dword [esp + 0x88], 0
lea eax, [esp + 0x78]
push eax
mov dword [esp + 0x90], 0xf
mov byte [esp + 0x7c], 0
call fcn.004053a0
pop ecx
test eax, eax
je 0x4059be
lea eax, [esp + 0x78]
push eax
call fcn.00405117
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 0x405b5a
call dword [sym.imp.KERNEL32.dll_GetCommandLineA]
cmp dword [edi + 0x14], 0x10
mov esi, eax
mov ecx, edi
jb 0x405a1f
mov ecx, dword [edi]
push dword [edi + 0x10]
push ecx
push esi
call fcn.0040f890
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.00404e12
mov esi, str.__run1__shortcut_
push esi
call fcn.0040c300
pop ecx
push eax
push esi
lea ecx, [esp + 0x98]
call fcn.004056ab
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.004056ab
mov ebp, 0x41c690
mov esi, eax
push ebp
call fcn.0040c300
pop ecx
push eax
push ebp
mov ecx, esi
call fcn.004056ab
mov eax, dword [esp + 0xa0]
inc eax
push eax
call fcn.0040893b
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.0040c23a
push 0x44
pop esi
push esi
lea eax, [esp + 0x48]
push 0
push eax
call fcn.00403817
push 0x10
lea eax, [esp + 0x44]
mov dword [esp + 0x54], esi
push 0
push eax
call fcn.00403817
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 0x405b47
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.00408944
pop ecx
lea ecx, [esp + 0x90]
call fcn.004055fb
lea eax, [esp + 0x78]
push eax
call fcn.00404f77
mov eax, dword [esp + 0x90]
mov ebp, 0x1000
pop ecx
cmp eax, 0x10
jb 0x405ba9
mov ecx, dword [esp + 0x78]
inc eax
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], ecx
cmp eax, ebp
jb 0x405ba0
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x18]
push eax
call fcn.0040542d
mov eax, dword [esp + 0x18]
pop ecx
pop ecx
mov ecx, dword [esp + 0x14]
push eax
push ecx
call fcn.0040892d
pop ecx
pop ecx
and dword [esp + 0x88], 0
mov dword [esp + 0x8c], 0xf
mov byte [esp + 0x78], 0
test edi, edi
je 0x405c1c
mov esi, edi
cmp esi, ebx
je 0x405bdf
push 0x18
pop edi
mov ecx, esi
call fcn.004055fb
add esi, edi
cmp esi, ebx
jne 0x405bce
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 0x405c13
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x18]
push eax
call fcn.0040542d
mov eax, dword [esp + 0x18]
mov edi, dword [esp + 0x1c]
pop ecx
pop ecx
push eax
push edi
call fcn.0040892d
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.004088ba
add esp, 0x3b0
ret
test edi, edi
je 0x405c95
mov esi, edi
cmp esi, ebx
je 0x405c55
push 0x18
pop edi
mov ecx, esi
call fcn.004055fb
add esi, edi
cmp esi, ebx
jne 0x405c44
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 0x405c8c
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x14]
push eax
call fcn.0040542d
mov eax, dword [esp + 0x1c]
mov edi, dword [esp + 0x18]
pop ecx
pop ecx
push eax
push edi
call fcn.0040892d
pop ecx
pop ecx
xor eax, eax
inc eax
jmp 0x405c1e