Function at 0x401989
Capabilities:
Write file on windows

Disassembly:
mov eax, 0x403da7
call sub.MSVCRT.dll__EH_prolog
mov eax, 0x1038
call fcn.004039c0
push ebx
push esi
push edi
mov edi, dword [sym.imp.MSVCRT.dll_fopen]
push 0x40720c
push dword [ebp + 8]
call edi
mov ebx, eax
xor esi, esi
pop ecx
cmp ebx, esi
pop ecx
mov dword [ebp - 0x24], ebx
je 0x401c4f
push 0x407208
push dword [ebp + 0xc]
call edi
pop ecx
cmp eax, esi
pop ecx
mov dword [ebp + 0xc], eax
jne 0x4019e0
push ebx
call dword [sym.imp.MSVCRT.dll_fclose]
jmp 0x401c4e
mov ecx, 0x1ff
xor eax, eax
lea edi, [ebp - 0x842]
mov word [ebp - 0x844], si
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov edi, 0x3ff
push ebx
lea eax, [ebp - 0x844]
mov dword [ebp - 0x10], esi
mov dword [ebp + 8], esi
mov esi, dword [sym.imp.MSVCRT.dll_fgetws]
push edi
push eax
call esi
add esp, 0xc
test eax, eax
je 0x401a4a
push 6
lea eax, [ebp - 0x844]
push 0x4071f8
push eax
call dword [sym.imp.MSVCRT.dll_wcsncmp]
add esp, 0xc
test eax, eax
jne 0x401a3c
mov eax, dword [ebp + 8]
mov dword [ebp - 0x10], eax
inc dword [ebp + 8]
push ebx
lea eax, [ebp - 0x844]
push edi
push eax
jmp 0x401a12
push ebx
call dword [sym.imp.MSVCRT.dll_rewind]
and dword [ebp + 8], 0
push ebx
lea eax, [ebp - 0x844]
push edi
push eax
call esi
add esp, 0x10
test eax, eax
je 0x401c3f
mov ebx, dword [sym.imp.MSVCRT.dll_fwrite]
mov esi, 0x4071f4
mov eax, dword [ebp + 8]
cmp eax, dword [ebp - 0x10]
jne 0x401bbd
mov al, byte [ebp + 0xb]
push 0
lea ecx, [ebp - 0x20]
mov byte [ebp - 0x20], al
call dword [0x404278]
and dword [ebp - 4], 0
mov edi, str.hwsig
push edi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push edi
lea ecx, [ebp - 0x20]
call dword [0x4042a0]
mov al, byte [ebp + 0xb]
push 0
lea ecx, [ebp - 0x34]
mov byte [ebp - 0x34], al
call dword [0x404278]
lea eax, [ebp - 0x34]
mov byte [ebp - 4], 1
push eax
call fcn.004029f6
mov eax, dword [0x404288]
pop ecx
lea ecx, [ebp - 0x20]
push dword [eax]
lea eax, [ebp - 0x34]
push 0
push eax
call dword [0x404284]
push esi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push esi
lea ecx, [ebp - 0x20]
call dword [0x404280]
mov eax, dword [ebp - 0x1c]
test eax, eax
jne 0x401b01
mov eax, dword [0x40427c]
push dword [ebp + 0xc]
push 1
push dword [ebp - 0x18]
push eax
call ebx
and byte [ebp - 4], 0
add esp, 0x10
lea ecx, [ebp - 0x34]
push 1
call dword [0x404278]
mov edi, str.version
push edi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push edi
lea ecx, [ebp - 0x20]
call dword [0x4042a0]
mov al, byte [ebp + 0xb]
push 0
lea ecx, [ebp - 0x44]
mov byte [ebp - 0x44], al
call dword [0x404278]
push 1
lea eax, [ebp - 0x44]
pop edi
mov byte [ebp - 4], 2
push edi
push edi
push eax
call fcn.00402813
mov eax, dword [0x404288]
add esp, 0xc
lea ecx, [ebp - 0x20]
push dword [eax]
lea eax, [ebp - 0x44]
push 0
push eax
call dword [0x404284]
push esi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push esi
lea ecx, [ebp - 0x20]
call dword [0x404280]
mov eax, dword [ebp - 0x1c]
test eax, eax
jne 0x401b8f
mov eax, dword [0x40427c]
push dword [ebp + 0xc]
push edi
push dword [ebp - 0x18]
push eax
call ebx
and byte [ebp - 4], 0
add esp, 0x10
lea ecx, [ebp - 0x44]
push edi
call dword [0x404278]
or dword [ebp - 4], 0xffffffff
push edi
lea ecx, [ebp - 0x20]
call dword [0x404278]
mov edi, 0x3ff
mov eax, dword [ebp - 0x10]
cmp dword [ebp + 8], eax
jl 0x401c1d
and byte [ebp - 0x1044], 0
mov ecx, 0x1ff
xor eax, eax
lea edi, [ebp - 0x1043]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
lea eax, [ebp - 0x844]
push 0x7ff
push eax
lea eax, [ebp - 0x1044]
push eax
call fcn.004027a4
add esp, 0xc
lea eax, [ebp - 0x1044]
push dword [ebp + 0xc]
push 1
push eax
call sub.MSVCRT.dll_strlen
pop ecx
push eax
lea eax, [ebp - 0x1044]
push eax
call ebx
add esp, 0x10
mov edi, 0x3ff
push dword [ebp - 0x24]
inc dword [ebp + 8]
lea eax, [ebp - 0x844]
push edi
push eax
call dword [sym.imp.MSVCRT.dll_fgetws]
add esp, 0xc
test eax, eax
jne 0x401a76
mov ebx, dword [ebp - 0x24]
mov esi, dword [sym.imp.MSVCRT.dll_fclose]
push ebx
call esi
push dword [ebp + 0xc]
call esi
pop ecx
pop ecx
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
pop ebx
mov dword fs:[0], ecx
leave
ret