Function at 0x401580
Capabilities:
Delete file
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x34
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
test ebx, ebx
jne 0x40159d
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push ebx
call dword [sym.imp.MSVCR90.dll_remove]
push 0x5fa540
push ebx
call dword [sym.imp.MSVCR90.dll_fopen]
mov esi, eax
add esp, 0xc
mov dword [esp + 0x10], esi
test esi, esi
je 0x401593
mov ecx, dword [ebp + 8]
call fcn.00411c70
mov edi, dword [sym.imp.MSVCR90.dll_fwrite]
push esi
push 1
mov dword [esp + 0x1c], eax
lea eax, [esp + 0x1c]
push 4
push eax
call edi
add esp, 0x10
cmp eax, 1
jne 0x401593
xor eax, eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x28], eax
mov dword [esp + 0x24], eax
cmp dword [esp + 0x14], eax
jbe 0x401785
mov ecx, dword [esp + 0x24]
push ecx
mov ecx, dword [ebp + 8]
call fcn.00411c80
mov ebx, eax
mov ecx, ebx
call fcn.004012d0
push esi
push 1
lea edx, [esp + 0x3c]
push 4
push edx
mov dword [esp + 0x44], eax
call edi
add esp, 0x10
cmp eax, 1
jne 0x401593
mov ecx, ebx
call fcn.00411b00
mov ebx, eax
mov ecx, dword [ebx + 8]
sub ecx, dword [ebx + 4]
mov eax, 0x2aaaaaab
imul ecx
sar edx, 2
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
add dword [esp + 0x28], ecx
mov dword [esp + 0x1c], ecx
mov edx, dword [ebx + 0x18]
sub edx, dword [ebx + 0x14]
mov eax, 0x2aaaaaab
imul edx
sar edx, 1
mov eax, edx
shr eax, 0x1f
add eax, edx
add dword [esp + 0x2c], eax
push esi
push 1
mov dword [esp + 0x28], eax
lea eax, [esp + 0x24]
push 4
push eax
call edi
add esp, 0x10
cmp eax, 1
jne 0x401593
push esi
push eax
lea ecx, [esp + 0x28]
push 4
push ecx
call edi
add esp, 0x10
cmp eax, 1
jne 0x401593
xor eax, eax
mov dword [esp + 0x30], eax
cmp dword [esp + 0x1c], eax
jbe 0x40170d
mov dword [esp + 0x18], eax
mov edi, dword [ebx + 4]
add edi, dword [esp + 0x18]
xor esi, esi
jmp 0x4016c0
mov edx, dword [esp + 0x10]
fld qword [edi + esi*8]
push edx
fstp qword [esp + 0x3c]
push 1
lea eax, [esp + 0x40]
push 8
push eax
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
cmp eax, 1
jne 0x401593
inc esi
cmp esi, 3
jl 0x4016c0
mov eax, dword [esp + 0x30]
add dword [esp + 0x18], 0x18
inc eax
mov dword [esp + 0x30], eax
cmp eax, dword [esp + 0x1c]
jb 0x4016b2
mov esi, dword [esp + 0x10]
mov edi, dword [sym.imp.MSVCR90.dll_fwrite]
xor eax, eax
mov dword [esp + 0x30], eax
cmp dword [esp + 0x20], eax
jbe 0x40176f
mov dword [esp + 0x18], eax
mov edi, dword [ebx + 0x14]
add edi, dword [esp + 0x18]
xor esi, esi
mov edx, dword [esp + 0x10]
mov ecx, dword [edi + esi*4]
push edx
push 1
lea eax, [esp + 0x40]
push 4
push eax
mov dword [esp + 0x48], ecx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
cmp eax, 1
jne 0x401593
inc esi
cmp esi, 3
jl 0x401724
mov eax, dword [esp + 0x30]
add dword [esp + 0x18], 0xc
inc eax
mov dword [esp + 0x30], eax
cmp eax, dword [esp + 0x20]
jb 0x40171b
mov esi, dword [esp + 0x10]
mov edi, dword [sym.imp.MSVCR90.dll_fwrite]
mov eax, dword [esp + 0x24]
inc eax
mov dword [esp + 0x24], eax
cmp eax, dword [esp + 0x14]
jb 0x4015fb
mov ebx, dword [ebp + 0xc]
push esi
call dword [sym.imp.MSVCR90.dll_fclose]
mov ecx, dword [esp + 0x2c]
mov edx, dword [esp + 0x30]
mov eax, dword [esp + 0x18]
push ecx
push edx
push eax
push ebx
push str._Output_:__s___d_surfs___d_trs___d_pts__n
call dword [sym.imp.MSVCR90.dll_printf]
add esp, 0x18
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret