Function at 0x40b157
Capabilities:
Check if file exists
Check mutex on windows
Delete file
Get common file path
Move file

Disassembly:
mov eax, 0x420587
call fcn.00412d4c
sub esp, 0x14c
push ebx
push edi
mov edi, dword [esp + 0x168]
push 0
push edi
call fcn.0040ff2c
xor ebx, ebx
pop ecx
inc ebx
pop ecx
test al, al
jne 0x40b1c7
push ebx
push edi
call fcn.0040ff2c
pop ecx
pop ecx
test al, al
jne 0x40b1c7
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 2
je 0x40b3c4
cmp eax, 3
je 0x40b3c4
call fcn.0040cb22
cmp eax, 3
jae 0x40b1c7
xor eax, eax
push eax
push eax
push eax
push eax
call dword [sym.imp.KERNEL32.dll_CreateEventA]
test eax, eax
je 0x40b1c7
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebp
mov ebp, dword [sym.imp.KERNEL32.dll_DeleteFileA]
push edi
call ebp
test eax, eax
jne 0x40b3c3
xor ecx, ecx
push 0xf
pop eax
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], ecx
mov dword [esp + 0x20], eax
mov dword [esp + 0x1c], ecx
mov byte [esp + 0xc], cl
mov dword [esp + 0x160], ecx
mov dword [esp + 0x34], ecx
mov dword [esp + 0x38], ecx
mov dword [esp + 0x38], eax
mov dword [esp + 0x34], ecx
mov byte [esp + 0x24], cl
mov byte [esp + 0x160], bl
lea eax, [esp + 0x54]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
je 0x40b24d
cmp byte [esp + 0x54], 0
jne 0x40b233
xor eax, eax
jmp 0x40b23e
lea eax, [esp + 0x54]
push eax
call fcn.004124c0
pop ecx
push eax
lea eax, [esp + 0x58]
push eax
lea ecx, [esp + 0x14]
call fcn.004040e9
mov ecx, dword [esp + 0x1c]
test ecx, ecx
je 0x40b2a0
cmp dword [esp + 0x20], 0x10
lea eax, [esp + 0xc]
cmovae eax, dword [esp + 0xc]
cmp byte [eax + ecx - 1], 0x5c
jne 0x40b2a0
lea eax, [ecx - 1]
push eax
push 0
lea eax, [esp + 0x44]
push eax
lea ecx, [esp + 0x18]
call fcn.004063bc
mov byte [esp + 0x160], 2
push eax
lea ecx, [esp + 0x10]
call fcn.00409784
mov byte [esp + 0x160], bl
lea ecx, [esp + 0x3c]
call fcn.004015cc
cmp dword [esp + 0x20], 0x10
push esi
lea eax, [esp + 0x10]
cmovae eax, dword [esp + 0x10]
push ebx
push eax
call fcn.0040ff2c
pop ecx
pop ecx
test al, al
je 0x40b369
call fcn.004150a2
mov esi, eax
shl esi, 0xf
call fcn.004150a2
or eax, esi
push eax
lea eax, [esp + 0x44]
push str.__tmp__08x
push eax
call fcn.004075ca
add esp, 0xc
mov byte [esp + 0x164], 3
push 0xffffffffffffffff
push 0
push eax
lea ecx, [esp + 0x1c]
call fcn.004050e1
mov byte [esp + 0x164], bl
lea ecx, [esp + 0x40]
call fcn.004015cc
push 0x10
pop esi
cmp dword [esp + 0x24], esi
lea eax, [esp + 0x10]
cmovae eax, dword [esp + 0x10]
push ebx
push eax
push edi
call dword [sym.imp.KERNEL32.dll_MoveFileExA]
test eax, eax
je 0x40b369
cmp dword [esp + 0x24], esi
lea eax, [esp + 0x10]
cmovae eax, dword [esp + 0x10]
push eax
call fcn.0040a66b
cmp dword [esp + 0x28], esi
lea eax, [esp + 0x14]
cmovae eax, dword [esp + 0x14]
pop ecx
push eax
call ebp
cmp eax, ebx
je 0x40b3a0
cmp dword [esp + 0x24], esi
push 4
lea eax, [esp + 0x14]
cmovae eax, dword [esp + 0x14]
push 0
push eax
call dword [sym.imp.KERNEL32.dll_MoveFileExA]
jmp 0x40b3a0
push edi
call fcn.0040a66b
pop ecx
push edi
call ebp
cmp eax, ebx
je 0x40b3a0
call fcn.0040cb22
cmp eax, 3
jae 0x40b390
push str.Global86
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
push 4
push 0
push edi
call dword [sym.imp.KERNEL32.dll_MoveFileExA]
test eax, eax
setne bl
mov byte [esp + 0x164], 0
lea ecx, [esp + 0x28]
call fcn.004015cc
or dword [esp + 0x164], 0xffffffff
lea ecx, [esp + 0x10]
call fcn.004015cc
pop esi
pop ebp
mov ecx, dword [esp + 0x154]
pop edi
mov al, bl
pop ebx
mov dword fs:[0], ecx
leave
ret