Function at 0x408e21
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
push edi
xor edi, edi
cmp dword [ebp + 0xc], edi
je 0x4090fc
cmp dword [ebp + 0x10], edi
je 0x4090fc
cmp dword [ebp + 0x14], edi
je 0x4090fc
push ebx
push esi
push dword [ebp + 0xc]
mov esi, dword [sym.imp.KERNEL32.dll_lstrlenA]
mov dword [ebp - 0xc], edi
call esi
push dword [ebp + 0x10]
mov ebx, eax
call esi
cmp dword [ebp + 8], edi
lea ebx, [ebx + eax + 0x10]
je 0x408e6c
push dword [ebp + 8]
call esi
add ebx, eax
push edi
push 0x80
push 4
push edi
push edi
push 0xc0000000
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [ebp - 0x10], eax
je 0x4090f5
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
cmp edi, 0xffffffff
jne 0x408ea1
xor edi, edi
lea eax, [ebp - 0x28]
push eax
lea eax, [edi + ebx]
push eax
call fcn.004091e5
mov ebx, eax
xor eax, eax
pop ecx
cmp ebx, eax
pop ecx
je 0x4090ec
and byte [ebx], al
cmp edi, eax
mov dword [ebp - 0x14], eax
mov dword [ebp - 4], eax
mov dword [ebp + 0x14], eax
mov dword [ebp - 8], eax
je 0x408f81
mov dword [ebp - 0xc], eax
lea eax, [ebp - 0x20]
push eax
push edi
call fcn.004091e5
pop ecx
mov dword [ebp - 0x18], eax
test eax, eax
pop ecx
je 0x4090e5
lea ecx, [ebp - 0x1c]
push 0
push ecx
push edi
push eax
mov dword [ebp - 0x1c], edi
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x408f6c
cmp dword [ebp - 0x1c], edi
jne 0x408f6c
push 0
mov dword [ebp - 0xc], 1
push dword [ebp - 0x20]
push dword [ebp - 0x18]
push ebx
call fcn.0040917b
mov eax, dword [ebp - 0x20]
add esp, 0x10
and byte [eax + ebx], 0
mov eax, dword [ebp + 8]
test eax, eax
je 0x408f59
cmp byte [eax], 0
je 0x408f59
push eax
lea eax, [ebp - 4]
push eax
push ebx
call fcn.00408cf1
add esp, 0xc
mov dword [ebp - 0x14], eax
test eax, eax
je 0x408f6c
mov ecx, dword [ebp - 4]
push dword [ebp + 0xc]
mov dword [ebp - 8], ecx
lea ecx, [ebp - 8]
push ecx
push eax
jmp 0x408f61
push dword [ebp + 0xc]
lea eax, [ebp - 8]
push eax
push ebx
call fcn.00408d7c
add esp, 0xc
mov dword [ebp + 0x14], eax
push dword [ebp - 0x18]
call fcn.0040923e
cmp dword [ebp - 0xc], 0
pop ecx
je 0x4090e5
xor eax, eax
push ebx
mov dword [ebp - 0xc], eax
call fcn.004379d0
pop ecx
xor edx, edx
mov ecx, dword [ebp - 8]
mov dword [ebp - 0x18], eax
cmp ecx, edx
je 0x408fe0
cmp dword [ebp + 0x14], edx
jne 0x408f9f
mov dword [ebp + 0x14], ecx
push dword [ebp + 0x10]
call esi
mov edi, eax
mov eax, dword [ebp + 0x14]
sub eax, dword [ebp - 8]
add edi, eax
mov eax, dword [ebp - 0x18]
sub eax, dword [ebp - 8]
push edi
lea eax, [eax + ebx + 1]
push eax
push dword [ebp - 8]
call fcn.00409103
add esp, 0xc
push dword [ebp + 0x10]
call esi
push eax
push dword [ebp + 0x10]
push dword [ebp + 0x14]
call fcn.004371c0
add esp, 0xc
xor esi, esi
jmp 0x40907e
cmp dword [ebp - 0x14], edx
jne 0x408ff8
mov ecx, dword [ebp + 8]
cmp ecx, edx
je 0x408ff8
cmp byte [ecx], 0
mov dword [ebp - 0x14], 1
jne 0x408ffb
mov dword [ebp - 0x14], edx
mov ecx, dword [ebp - 4]
cmp ecx, edx
jne 0x409008
lea ecx, [eax + ebx]
mov dword [ebp - 4], ecx
mov al, byte [ecx]
push dword [ebp + 0xc]
mov byte [ebp + 0x17], al
call esi
push dword [ebp + 0x10]
mov edi, eax
call esi
cmp dword [ebp - 0x14], 0
lea edi, [edi + eax + 3]
je 0x40902c
push dword [ebp + 8]
call esi
lea edi, [edi + eax + 4]
mov eax, dword [ebp - 0x18]
push edi
sub eax, dword [ebp - 4]
lea eax, [eax + ebx + 1]
push eax
push dword [ebp - 4]
call fcn.00409103
add esp, 0xc
xor esi, esi
cmp dword [ebp - 0x14], esi
push dword [ebp + 0x10]
push dword [ebp + 0xc]
je 0x409065
push dword [ebp + 8]
push str._r_n__s__r_n_s_s
push dword [ebp - 4]
call fcn.0043819a
add esp, 0x14
jmp 0x409075
push str._r_n_s_s
push dword [ebp - 4]
call fcn.0043819a
add esp, 0x10
mov eax, dword [ebp - 4]
mov cl, byte [ebp + 0x17]
mov byte [edi + eax], cl
lea eax, [ebp - 0x1c]
push eax
mov eax, dword [ebp - 0x18]
add edi, eax
push edi
call fcn.004091e5
mov edi, eax
pop ecx
cmp edi, esi
pop ecx
je 0x4090e5
push 1
push dword [ebp - 0x1c]
push ebx
push edi
call fcn.0040917b
add esp, 0x10
push esi
push esi
push esi
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea eax, [ebp - 0x24]
push esi
push eax
push dword [ebp - 0x1c]
push edi
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4090de
mov eax, dword [ebp - 0x1c]
cmp eax, dword [ebp - 0x24]
jne 0x4090de
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov dword [ebp - 0xc], 1
push edi
call fcn.0040923e
pop ecx
push ebx
call fcn.0040923e
pop ecx
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0xc]
pop esi
pop ebx
jmp 0x4090fe
xor eax, eax
pop edi
leave
ret 0x10