Function at 0x512790
Capabilities:
Get disk size
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x4c
mov eax, dword [0x5c6150]
xor eax, esp
mov dword [esp + 0x48], eax
push ebx
mov ebx, dword [ebp + 0x10]
push esi
mov esi, dword [ebp + 0xc]
push edi
mov edi, ecx
mov ecx, dword [ebp + 8]
test ecx, ecx
je 0x512970
test esi, esi
jle 0x512970
mov eax, dword [edi + 0x1c]
cmp eax, 0xffffffff
jne 0x51280a
mov dword [edi], 0x59af80
call fcn.00521240
push 0xd9
push str.t_saFile::Write
push str.__S_L:_d__
call fcn.005212c0
add edi, 4
add esp, 0xc
cmp dword [edi + 0x14], 8
jb 0x5127f7
mov edi, dword [edi]
push edi
push str.hFile_is_invalid__filename:_s_r_n
call fcn.005212c0
add esp, 8
jmp 0x512a03
push 0
lea edx, [esp + 0x14]
mov dword [esp + 0x14], 0
push edx
push esi
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x51290c
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [edi], 0x59b1c0
call ebx
mov dword [esp + 0x14], eax
cmp eax, 0x70
jne 0x5128d6
lea eax, [esp + 0x28]
xorps xmm0, xmm0
push eax
lea eax, [esp + 0x24]
movq qword [esp + 0x1c], xmm0
push eax
lea eax, [esp + 0x20]
movq qword [esp + 0x28], xmm0
push eax
push 0x59b2bc
movq qword [esp + 0x38], xmm0
call dword [sym.imp.KERNEL32.dll_GetDiskFreeSpaceExW]
test eax, eax
je 0x5128ab
call fcn.00521240
push 0xe9
push str.t_saFile::Write
push str.__S_L:_d__
call fcn.005212c0
push dword [esp + 0x28]
push dword [esp + 0x28]
push esi
push 0x70
push str.write_file_err__errcode:_d__writesize:_d__FreeBytesAvailable:_I64d_r_n
call fcn.005212c0
add esp, 0x20
jmp 0x5128d6
call ebx
mov esi, eax
call fcn.00521240
push 0xee
push str.t_saFile::Write
push str.__S_L:_d__
call fcn.005212c0
push esi
push str.GetDiskFreeSpaceEx_err__errcode:_d_r_n
call fcn.005212c0
add esp, 0x14
call fcn.00521240
push 0xf1
push str.t_saFile::Write
push str.__S_L:_d__
call fcn.005212c0
add edi, 4
add esp, 0xc
cmp dword [edi + 0x14], 8
jb 0x5128fd
mov edi, dword [edi]
push edi
push dword [esp + 0x18]
push str.write_file_err__errcode:_d__filename:_s_r_n
jmp 0x5129fb
mov eax, dword [esp + 0x10]
cmp esi, eax
je 0x512952
call fcn.00521240
push 0xf6
push str.t_saFile::Write
push str.__S_L:_d__
call fcn.005212c0
lea eax, [edi + 4]
add esp, 0xc
cmp dword [eax + 0x14], 8
jb 0x51293b
mov eax, dword [eax]
push eax
push dword [esp + 0x14]
push esi
push str.write_file__p_nSize___dwWritten__size:_d__written:_d__filename:_s_r_n
call fcn.005212c0
mov eax, dword [esp + 0x20]
add esp, 0x10
mov dword [ebx], eax
mov al, 1
mov dword [edi], 0
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x48]
xor ecx, esp
call fcn.004d6cfd
mov esp, ebp
pop ebp
ret 0xc
lea eax, [esp + 0x20]
mov dword [edi], 0x59997c
push eax
call fcn.004e2e2c
lea eax, [esp + 0x24]
push eax
lea eax, [esp + 0x38]
push eax
call fcn.004e4ceb
push dword [esp + 0x3c]
cmp dword [0x5c92e0], 8
mov ecx, 0x5c92cc
push dword [esp + 0x44]
cmovae ecx, dword [0x5c92cc]
push dword [esp + 0x4c]
mov eax, dword [esp + 0x58]
push dword [esp + 0x54]
inc eax
push eax
mov eax, dword [esp + 0x64]
add eax, 0x76c
push eax
push ecx
push 0x5d2130
push str.__s___s___04d__02d__02d__02d:_02d:_02d_
call fcn.005212c0
push 0xd2
push str.t_saFile::Write
push str.__S_L:_d__
call fcn.005212c0
add edi, 4
add esp, 0x3c
cmp dword [edi + 0x14], 8
jb 0x5129f4
mov edi, dword [edi]
push edi
push esi
push str.buf_is_null_or_size__d__is_err__filename:_s_r_n
call fcn.005212c0
add esp, 0xc
mov ecx, dword [esp + 0x54]
xor al, al
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.004d6cfd
mov esp, ebp
pop ebp
ret 0xc