Function at 0x401660
Capabilities:
Check if file exists
Delete file
Get common file path
Get file attributes
Move file

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xc14
mov eax, dword [0x410240]
push ebx
mov ebx, dword [ebp + 8]
push esi
mov esi, dword [ebp + 0xc]
xor eax, ebp
test ebx, ebx
push edi
mov edi, dword [ebp + 0x10]
mov dword [esp + 0xc1c], eax
mov dword [esp + 0x10], edi
je 0x4018ef
test edi, edi
mov dword [esp + 0x14], 0
jne 0x4016ce
xor eax, eax
mov ecx, 0x100
lea edi, [esp + 0x818]
rep stosd dword es:[edi], eax
lea eax, [esp + 0x818]
push eax
push 0x3ff
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
lea ecx, [esp + 0x818]
mov dword [esp + 0x10], ecx
mov edi, ecx
mov eax, edi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x4016d3
sub eax, edx
cmp byte [edi + eax - 1], 0x5c
jne 0x4016eb
mov dword [esp + 0x14], 1
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x4018ef
test al, 0x10
jne 0x4018ef
test esi, esi
jne 0x401710
push ebx
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
jmp 0x40171a
push 3
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_MoveFileExA]
test eax, eax
jne 0x4018ef
mov byte [esp + 0x418], al
mov ecx, 0xff
lea edi, [esp + 0x419]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
xor eax, eax
test esi, esi
mov byte [esp + 0x18], 0
mov ecx, 0xff
lea edi, [esp + 0x19]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
je 0x4017ef
mov edi, dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
push esi
call edi
cmp eax, 0xffffffff
je 0x4017de
test al, 0x10
jne 0x4017de
push esi
lea edx, [esp + 0x1c]
push str._s.bak
push edx
call fcn.004042cf
mov eax, dword [esp + 0x20]
add esp, 0xc
test eax, eax
push 0x5c
push esi
je 0x401792
call fcn.00403f7b
add esp, 8
inc eax
jmp 0x40179a
call fcn.00403f7b
add esp, 8
push eax
mov eax, dword [esp + 0x14]
push eax
lea ecx, [esp + 0x420]
push str._s_s.bak
push ecx
call fcn.004042cf
add esp, 0x10
lea edx, [esp + 0x18]
push edx
call edi
cmp eax, 0xffffffff
je 0x4017d0
test al, 0x10
jne 0x4017d0
lea eax, [esp + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
lea ecx, [esp + 0x18]
push ecx
push esi
call fcn.004042a1
add esp, 8
push 3
push esi
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_MoveFileExA]
call ebx
jmp 0x401874
push ebx
lea edx, [esp + 0x1c]
push str._s.bak
push edx
call fcn.004042cf
mov eax, dword [esp + 0x20]
add esp, 0xc
test eax, eax
push 0x5c
push ebx
je 0x401818
call fcn.00403f7b
add esp, 8
inc eax
jmp 0x401820
call fcn.00403f7b
add esp, 8
push eax
mov eax, dword [esp + 0x14]
push eax
lea ecx, [esp + 0x420]
push str._s_s.bak
push ecx
call fcn.004042cf
add esp, 0x10
lea edx, [esp + 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x40185a
test al, 0x10
jne 0x40185a
lea eax, [esp + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
lea ecx, [esp + 0x18]
push ecx
push ebx
call fcn.004042a1
mov edi, dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
mov ebx, dword [sym.imp.KERNEL32.dll_MoveFileExA]
add esp, 8
mov al, byte [esp + 0x418]
test al, al
je 0x4018ef
mov al, byte [esp + 0x18]
test al, al
je 0x4018ef
lea edx, [esp + 0x18]
push edx
call edi
cmp eax, 0xffffffff
je 0x4018ef
test al, 0x10
jne 0x4018ef
xor esi, esi
lea esp, [esp]
push 3
lea eax, [esp + 0x41c]
push eax
lea ecx, [esp + 0x20]
push ecx
call ebx
test eax, eax
jne 0x401904
lea edi, [esp + 0x418]
dec edi
lea ecx, [ecx]
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x4018c0
mov edx, dword [str..bak]
mov al, byte [0x40d210]
mov ecx, esi
mov dword [edi], edx
inc esi
cmp ecx, 0xa
mov byte [edi + 4], al
jl 0x4018a0
push 0
lea eax, [esp + 0x1c]
push eax
call fcn.004011e0
add esp, 8
mov ecx, dword [esp + 0xc1c]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00404293
mov esp, ebp
pop ebp
ret
push 0
lea edx, [esp + 0x41c]
push edx
jmp 0x4018e7