Function at 0x405116
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push esi
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x14], str.sqXXXXXX
mov dword [ebp - 0xc], 0
mov dword [ebp - 8], 0
mov eax, dword [ebp - 0x14]
push eax
push 0x40c140
call dword [sym.imp.MSVCRT.dll_wcscpy]
add esp, 8
push 0x40c140
call dword [sym.imp.MSVCRT.dll__wmktemp]
add esp, 4
cmp dword [0x40a944], 0
je 0x40517a
push 0x40a4a8
push 0x40c140
lea ecx, [ebp - 0x10]
push ecx
call fcn.00406733
add esp, 0xc
jmp 0x405190
push 0x40a4b0
push 0x40c140
lea edx, [ebp - 0x10]
push edx
call fcn.00406733
add esp, 0xc
cmp dword [ebp - 0x10], 0
jne 0x4051c8
push 0x100
push 0x40ad00
push 0x1f
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push eax
call fcn.0040615e
push 0x40c140
push 0x40ad00
call dword [sym.imp.MSVCRT.dll_wprintf]
add esp, 8
jmp 0x405389
mov eax, dword [0x40c13c]
mov ecx, dword [eax + 4]
push ecx
call dword [sym.imp.MSVCRT.dll_malloc]
add esp, 4
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
jne 0x4051fb
push 0xbdd
push 0x40a4b8
push str.NULL___mbcsBuffer
call dword [sym.imp.MSVCRT.dll__assert]
add esp, 0xc
mov eax, dword [0x40c13c]
mov ecx, dword [eax + 4]
and ecx, 0x80000001
jns 0x405210
dec ecx
or ecx, 0xfffffffe
inc ecx
test ecx, ecx
je 0x40522c
push 0xbde
push 0x40a4e8
push str.pCmd__cbUsed_2__0
call dword [sym.imp.MSVCRT.dll__assert]
add esp, 0xc
push 0
push 0
mov eax, dword [0x40c13c]
mov ecx, dword [eax + 4]
push ecx
mov edx, dword [ebp - 8]
push edx
mov eax, dword [0x40c13c]
mov ecx, dword [eax + 4]
shr ecx, 1
push ecx
mov edx, dword [0x40c13c]
add edx, 0xc
push edx
push 0
push 1
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov dword [ebp - 4], eax
mov eax, dword [ebp - 0x10]
push eax
push 1
mov ecx, dword [ebp - 4]
push ecx
mov edx, dword [ebp - 8]
push edx
call dword [sym.imp.MSVCRT.dll_fwrite]
add esp, 0x10
mov eax, dword [ebp - 8]
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov dword [ebp - 8], 0
mov ecx, dword [ebp - 0x10]
push ecx
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov edx, dword [0x40a998]
push edx
call dword [sym.imp.MSVCRT.dll_wcslen]
add esp, 4
mov esi, eax
push 0x40c140
call dword [sym.imp.MSVCRT.dll_wcslen]
add esp, 4
add esi, eax
lea eax, [esi + esi + 0xa]
push eax
call dword [sym.imp.MSVCRT.dll_malloc]
add esp, 4
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x4052e8
push 0xbf1
push 0x40a518
push str.NULL___sname
call dword [sym.imp.MSVCRT.dll__assert]
add esp, 0xc
cmp dword [ebp - 0xc], 0
jne 0x4052fd
push 0x20
call fcn.00406123
add esp, 4
jmp 0x405389
mov edx, dword [0x40a998]
push edx
mov eax, dword [ebp - 0xc]
push eax
call dword [sym.imp.MSVCRT.dll_wcscpy]
add esp, 8
push 0x40a544
mov ecx, dword [ebp - 0xc]
push ecx
call dword [sym.imp.MSVCRT.dll_wcscat]
add esp, 8
push 0x40c140
mov edx, dword [ebp - 0xc]
push edx
call dword [sym.imp.MSVCRT.dll_wcscat]
add esp, 8
mov eax, dword [ebp - 0xc]
push eax
call fcn.0040648d
add esp, 4
cmp eax, 0xffffffff
jne 0x405375
push 0x100
push 0x40ad00
push 0x21
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push eax
call fcn.0040615e
mov ecx, dword [0x40a998]
push ecx
push 0x40ad00
call dword [sym.imp.MSVCRT.dll_wprintf]
add esp, 8
mov edx, dword [ebp - 0xc]
push edx
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov dword [ebp - 0xc], 0
pop esi
mov esp, ebp
pop ebp
ret