Function at 0x422140
Capabilities:
Check if file exists
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x2050
call fcn.00471220
mov eax, dword [0x4e3260]
xor eax, ebp
mov dword [ebp - 8], eax
mov word [ebp - 0xe28], 0
push 0x206
push 0
lea eax, [ebp - 0xe26]
push eax
call fcn.0046ee70
add esp, 0xc
push str.C:log_
lea ecx, [ebp - 0xe28]
push ecx
call fcn.0046f820
add esp, 8
mov dword [ebp - 0x2044], 0x400
mov word [ebp - 0xa10], 0
push 0x7fe
push 0
lea edx, [ebp - 0xa0e]
push edx
call fcn.0046ee70
add esp, 0xc
lea eax, [ebp - 0xe28]
push eax
push str._sgswb.log
lea ecx, [ebp - 0x2038]
push ecx
call fcn.0046efe8
add esp, 0xc
mov word [ebp - 0x210], 0
push 0x206
push 0
lea edx, [ebp - 0x20e]
push edx
call fcn.0046ee70
add esp, 0xc
mov word [ebp - 0xc20], 0
push 0x206
push 0
lea eax, [ebp - 0xc1e]
push eax
call fcn.0046ee70
add esp, 0xc
push 0x104
lea ecx, [ebp - 0xc20]
push ecx
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 0x5c
lea edx, [ebp - 0xc20]
push edx
call fcn.00405870
add esp, 8
mov word [eax], 0
lea eax, [ebp - 0x2038]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x42224c
jmp 0x422446
lea ecx, [ebp - 0xc20]
push ecx
call fcn.0046f672
add esp, 4
lea edx, [ebp + eax*2 - 0xc1e]
push edx
lea eax, [ebp - 0x210]
push eax
call fcn.0046f820
add esp, 8
lea ecx, [ebp - 0x210]
push ecx
lea edx, [ebp - 0xe28]
push edx
push str._s_s.txt
lea eax, [ebp - 0x2038]
push eax
call fcn.0046efe8
add esp, 0x10
lea ecx, [ebp + 0xc]
mov dword [ebp - 0x203c], ecx
mov edx, dword [ebp - 0x203c]
push edx
mov eax, dword [ebp + 8]
push eax
mov ecx, dword [ebp - 0x2044]
sub ecx, 1
push ecx
lea edx, [ebp - 0xa10]
push edx
call fcn.004749fd
add esp, 0x10
push 0
call fcn.00422480
add esp, 4
mov dword [ebp - 0xe30], eax
mov dword [ebp - 0xe2c], edx
lea eax, [ebp - 0xe30]
push eax
call fcn.00422460
add esp, 4
mov dword [ebp - 4], eax
mov ecx, dword [ebp + 8]
push ecx
mov edx, dword [ebp - 4]
mov eax, dword [edx]
push eax
mov ecx, dword [ebp - 4]
mov edx, dword [ecx + 4]
push edx
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 8]
push ecx
mov edx, dword [ebp - 4]
mov eax, dword [edx + 0xc]
push eax
mov ecx, dword [ebp - 4]
mov edx, dword [ecx + 0x10]
add edx, 1
push edx
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 0x14]
add ecx, 0x76c
push ecx
push str.__d__d__d__d__d__d_:_s
lea edx, [ebp - 0x1e30]
push edx
call fcn.0046efe8
add esp, 0x24
mov eax, dword [ebp - 0x2044]
mov word [ebp + eax*2 - 0xa12], 0
mov dword [ebp - 0x2040], 0
lea ecx, [ebp - 0x2038]
push ecx
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x422368
mov dword [ebp - 0x2040], 1
push 0x4c37a0
lea edx, [ebp - 0x2038]
push edx
call fcn.00474918
add esp, 8
mov dword [ebp - 0xa14], eax
cmp dword [ebp - 0xa14], 0
je 0x422446
cmp dword [ebp - 0x2040], 0
jne 0x4223bb
mov word [ebp - 0x2050], 0xfeff
mov eax, dword [ebp - 0xa14]
push eax
push 2
push 1
lea ecx, [ebp - 0x2050]
push ecx
call fcn.00474742
add esp, 0x10
lea edx, [ebp - 0x1e30]
push edx
call fcn.0046f672
add esp, 4
mov dword [ebp - 0x2048], eax
mov eax, dword [ebp - 0xa14]
push eax
mov ecx, dword [ebp - 0x2048]
shl ecx, 1
push ecx
push 1
lea edx, [ebp - 0x1e30]
push edx
call fcn.00474742
add esp, 0x10
mov word [ebp - 0x204c], 0xd
mov eax, dword [ebp - 0xa14]
push eax
push 2
push 1
lea ecx, [ebp - 0x204c]
push ecx
call fcn.00474742
add esp, 0x10
mov word [ebp - 0x204c], 0xa
mov edx, dword [ebp - 0xa14]
push edx
push 2
push 1
lea eax, [ebp - 0x204c]
push eax
call fcn.00474742
add esp, 0x10
mov ecx, dword [ebp - 0xa14]
push ecx
call fcn.00474567
add esp, 4
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0046f480
mov esp, ebp
pop ebp
ret