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 [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
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 [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::assign_char_const___unsigned_int_]
mov al, byte [ebp + 0xb]
push 0
lea ecx, [ebp - 0x34]
mov byte [ebp - 0x34], al
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
lea eax, [ebp - 0x34]
mov byte [ebp - 4], 1
push eax
call fcn.004029f6
mov eax, dword [sym.imp.MSVCP60.dll_unsigned_int_const_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::npos]
pop ecx
lea ecx, [ebp - 0x20]
push dword [eax]
lea eax, [ebp - 0x34]
push 0
push eax
call dword [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::append_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char___const___unsigned_int__unsigned_int_]
push esi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push esi
lea ecx, [ebp - 0x20]
call dword [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::append_char_const___unsigned_int_]
mov eax, dword [ebp - 0x1c]
test eax, eax
jne 0x401b01
mov eax, dword [sym.imp.MSVCP60.dll_char_const__private:_static_char_const____cdecl_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Nullstr_void_::_2::_C]
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 [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
mov edi, str.version
push edi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push edi
lea ecx, [ebp - 0x20]
call dword [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::assign_char_const___unsigned_int_]
mov al, byte [ebp + 0xb]
push 0
lea ecx, [ebp - 0x44]
mov byte [ebp - 0x44], al
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
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 [sym.imp.MSVCP60.dll_unsigned_int_const_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::npos]
add esp, 0xc
lea ecx, [ebp - 0x20]
push dword [eax]
lea eax, [ebp - 0x44]
push 0
push eax
call dword [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::append_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char___const___unsigned_int__unsigned_int_]
push esi
call sub.MSVCRT.dll_strlen
pop ecx
push eax
push esi
lea ecx, [ebp - 0x20]
call dword [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::append_char_const___unsigned_int_]
mov eax, dword [ebp - 0x1c]
test eax, eax
jne 0x401b8f
mov eax, dword [sym.imp.MSVCP60.dll_char_const__private:_static_char_const____cdecl_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Nullstr_void_::_2::_C]
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 [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
or dword [ebp - 4], 0xffffffff
push edi
lea ecx, [ebp - 0x20]
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
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