Function at 0x401040
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
push esi
mov esi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
push 0x30
mov dword [ebp - 8], 0
mov dword [ebp - 0xc], 0
mov dword [ebp - 4], 0
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x1c], 0
mov dword [ebp - 0x14], 0
call esi
add esp, 4
mov dword [ebp - 0x18], eax
cmp dword [ebp + 8], 3
je 0x40109e
push str.Wrong_input_n
call fcn.00401010
add esp, 4
mov eax, 1
pop esi
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0xc]
push ebx
push edi
push 0x402148
mov edi, dword [eax + 4]
mov eax, dword [eax + 8]
push edi
mov dword [ebp + 8], eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
mov ebx, eax
add esp, 8
test ebx, ebx
jne 0x4010d8
push str.File_does_not_exists_n
call fcn.00401010
add esp, 4
lea eax, [ebx + 2]
pop edi
pop ebx
pop esi
mov esp, ebp
pop ebp
ret
push edi
push str.File__s_is_open_n
call fcn.00401010
push dword [ebp - 0x18]
push edi
call dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll__stat64i32]
mov eax, dword [ebp - 0x18]
mov edi, dword [eax + 0x14]
lea eax, [edi + 1]
push eax
call esi
push ebx
push edi
mov esi, eax
push 1
push esi
mov dword [ebp - 0x20], esi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
push ebx
mov ebx, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
call ebx
lea eax, [ebp - 8]
push eax
push edi
push esi
call dword [sym.imp.plist.dll_plist_from_xml]
add esp, 0x34
cmp dword [ebp - 8], 0
jne 0x401140
push str.PList_XML_parsing_failed_n
call fcn.00401010
add esp, 4
mov eax, 3
pop edi
pop ebx
pop esi
mov esp, ebp
pop ebp
ret
push str.PList_XML_parsing_succeeded_n
call fcn.00401010
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x10]
push eax
push dword [ebp - 8]
call dword [sym.imp.plist.dll_plist_to_bin]
add esp, 0x10
cmp dword [ebp - 0x10], 0
jne 0x40117d
push str.PList_BIN_writing_failed_n
call fcn.00401010
add esp, 4
mov eax, 4
pop edi
pop ebx
pop esi
mov esp, ebp
pop ebp
ret
push str.PList_BIN_writing_succeeded_n
call fcn.00401010
lea eax, [ebp - 0xc]
push eax
push dword [ebp - 0x1c]
push dword [ebp - 0x10]
call dword [sym.imp.plist.dll_plist_from_bin]
add esp, 0x10
cmp dword [ebp - 0xc], 0
jne 0x4011b9
push str.PList_BIN_parsing_failed_n
call fcn.00401010
add esp, 4
mov eax, 5
pop edi
pop ebx
pop esi
mov esp, ebp
pop ebp
ret
push str.PList_BIN_parsing_succeeded_n
call fcn.00401010
lea eax, [ebp - 0x14]
push eax
lea eax, [ebp - 4]
push eax
push dword [ebp - 0xc]
call dword [sym.imp.plist.dll_plist_to_xml]
add esp, 0x10
cmp dword [ebp - 4], 0
jne 0x4011f6
push str.PList_XML_writing_failed_n
call fcn.00401010
add esp, 4
mov eax, 8
pop edi
pop ebx
pop esi
mov esp, ebp
pop ebp
ret
push str.PList_XML_writing_succeeded_n
call fcn.00401010
add esp, 4
cmp dword [ebp - 4], 0
je 0x40122e
push 0x402268
push dword [ebp + 8]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
mov esi, eax
push esi
push 1
push dword [ebp - 0x14]
push dword [ebp - 4]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fwrite]
push esi
call ebx
add esp, 0x1c
push dword [ebp - 8]
mov esi, dword [sym.imp.plist.dll_plist_free]
call esi
push dword [ebp - 0xc]
call esi
push dword [ebp - 0x10]
mov esi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
call esi
push dword [ebp - 0x20]
call esi
push dword [ebp - 4]
call esi
push dword [ebp - 0x18]
call esi
add esp, 0x18
cmp edi, dword [ebp - 0x14]
je 0x401285
push str.Size_of_input_and_output_is_different_n
call fcn.00401010
push edi
push str.Input_size_:__i_n
call fcn.00401010
push dword [ebp - 0x14]
push str.Output_size_:__i_n
call fcn.00401010
add esp, 0x14
pop edi
pop ebx
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret