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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x101c
call fcn.00412aa0
mov eax, dword [0x4285e0]
push ebx
push esi
mov esi, dword [ebp + 0x10]
xor eax, ebp
test esi, esi
mov dword [esp + 0x1020], eax
push edi
mov dword [esp + 0x18], ecx
mov dword [esp + 0x14], esi
je 0x40c116
cmp byte [esi], 0
je 0x40c116
mov eax, dword [ecx + 0x24]
test eax, eax
je 0x40c116
mov dl, byte [ecx + 0x20]
test dl, dl
je 0x40bf2b
push str.Const_Mode
push 3
jmp 0x40c11d
mov edi, dword [ebp + 8]
push 0
push 0
push edi
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40bf5b
push edi
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.winErr_d__point_d
push 6
call fcn.0040add0
add esp, 0x10
jmp 0x40c125
push 0
push 0x8000027
push 3
push 0
push 3
push 0x80000000
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x40bf97
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.Open_file:__s__WinErr_d
push 3
call fcn.0040add0
add esp, 0x10
jmp 0x40c125
xor eax, eax
mov byte [esp + 0x20], 0
mov ecx, 0x3ff
lea edi, [esp + 0x21]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
push 0
stosb byte es:[edi], al
lea eax, [esp + 0x14]
push eax
push 0x1000
lea ecx, [esp + 0x2c]
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, dword [esp + 0x10]
xor esi, esi
test ecx, ecx
je 0x40c086
test eax, eax
je 0x40c039
mov edi, dword [ebp + 0xc]
lea edx, [esi + ecx]
cmp edx, edi
jbe 0x40bfe8
mov ecx, edi
sub ecx, esi
mov dword [esp + 0x10], ecx
mov edx, dword [esp + 0x18]
push 0
lea eax, [esp + 0x20]
push eax
mov eax, dword [edx + 0x24]
push ecx
lea ecx, [esp + 0x2c]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40c064
mov eax, dword [esp + 0x1c]
cmp dword [esp + 0x10], eax
jne 0x40c064
add esi, eax
cmp esi, edi
jae 0x40c089
push 0
lea ecx, [esp + 0x14]
push ecx
push 0x1000
lea edx, [esp + 0x2c]
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, dword [esp + 0x10]
test ecx, ecx
jne 0x40bfd2
jmp 0x40c089
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x26
je 0x40c086
mov eax, dword [esp + 0x14]
push eax
push str.file:__s
push 4
call fcn.0040add0
add esp, 0xc
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40c125
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.winErr:__d
push 5
call fcn.0040add0
add esp, 0xc
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40c125
mov edi, dword [ebp + 0xc]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp esi, edi
jb 0x40c0b0
mov al, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x1018]
xor ecx, ebp
call fcn.00410a75
mov esp, ebp
pop ebp
ret 0xc
mov edi, dword [ebp + 0xc]
mov eax, edi
sub eax, esi
cmp eax, 0x1000
mov ebx, 0x1000
ja 0x40c0c2
mov ebx, eax
xor eax, eax
push eax
mov ecx, 0x400
lea edi, [esp + 0x24]
rep stosd dword es:[edi], eax
mov eax, dword [esp + 0x1c]
lea ecx, [esp + 0x18]
push ecx
mov ecx, dword [eax + 0x24]
push ebx
lea edx, [esp + 0x2c]
push edx
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40c0fe
mov eax, dword [esp + 0x14]
cmp ebx, eax
jne 0x40c0fe
add esi, eax
cmp esi, dword [ebp + 0xc]
jb 0x40c0ad
jmp 0x40c094
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.winErr:__d
push 5
call fcn.0040add0
add esp, 0xc
jmp 0x40c125
push 0x421880
push 0xa
call fcn.0040add0
add esp, 8
mov ecx, dword [esp + 0x1024]
pop edi
pop esi
xor ecx, ebp
xor al, al
pop ebx
call fcn.00410a75
mov esp, ebp
pop ebp
ret 0xc