Function at 0x40fb80
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x420
push ebx
push esi
push edi
mov esi, dword [ebp + 8]
mov edi, dword [ebp + 0x10]
cmp esi, dword [0x41be58]
jae 0x40fdef
mov eax, esi
and eax, 0x1f
mov dword [ebp - 0x410], eax
mov eax, esi
shr eax, 5
mov dword [ebp - 0x40c], eax
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 1
je 0x40fdef
test edi, edi
je 0x40fdeb
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x20
je 0x40fc01
push 2
push 0
push esi
call fcn.004108d0
add esp, 0xc
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x80
je 0x40fd50
mov eax, dword [ebp + 0xc]
mov ebx, eax
mov dword [ebp - 0x414], 0
mov dword [ebp - 0x418], 0
jmp 0x40fd29
lea eax, [ebp - 0x405]
jmp 0x40fc5a
cmp byte [ebx], 0xa
jne 0x40fc54
inc dword [ebp - 0x414]
mov byte [eax], 0xd
inc eax
mov dl, byte [ebx]
mov byte [eax], dl
inc ebx
inc eax
mov edx, eax
mov dword [ebp - 0x420], edx
lea ecx, [ebp - 0x405]
sub edx, ecx
cmp edx, 0x400
jge 0x40fc7e
mov edx, ebx
sub edx, dword [ebp - 0x41c]
cmp edi, edx
ja 0x40fc45
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x40
je 0x40fcd9
push esi
call fcn.00410b20
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40fcd9
call dword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
mov edx, dword [ebp - 0x420]
lea ecx, [ebp - 0x405]
sub edx, ecx
push edx
lea edx, [ebp - 0x405]
push edx
push dword [0x415618]
push eax
call fcn.00410c30
add esp, 0x10
push esi
call fcn.00410b20
pop ecx
push 0
lea edx, [ebp - 4]
push edx
mov edx, dword [ebp - 0x420]
lea ecx, [ebp - 0x405]
sub edx, ecx
push edx
lea edx, [ebp - 0x405]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40fd46
mov eax, dword [ebp - 0x418]
add eax, dword [ebp - 4]
mov dword [ebp - 0x418], eax
mov eax, dword [ebp - 0x420]
lea edx, [ebp - 0x405]
sub eax, edx
cmp dword [ebp - 4], eax
jb 0x40fd42
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x41c], eax
mov eax, ebx
sub eax, dword [ebp - 0x41c]
cmp edi, eax
ja 0x40fc3d
xor ebx, ebx
jmp 0x40fd9f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40fd9f
push esi
call fcn.00410b20
pop ecx
push 0
lea edx, [ebp - 4]
push edx
push edi
push dword [ebp + 0xc]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40fd83
mov eax, dword [ebp - 4]
mov dword [ebp - 0x418], eax
mov dword [ebp - 0x414], 0
xor ebx, ebx
jmp 0x40fd9f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
mov dword [ebp - 0x414], 0
mov dword [ebp - 0x418], 0
cmp dword [ebp - 0x418], 0
jne 0x40fe0d
test ebx, ebx
je 0x40fdc9
cmp ebx, 5
jne 0x40fdbd
mov dword [0x414ddc], 9
jmp 0x40fdc4
push ebx
call fcn.00410ce0
pop ecx
or eax, 0xffffffff
jmp 0x40fe19
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x40
je 0x40fdfe
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x40fdfe
xor eax, eax
jmp 0x40fe19
mov dword [0x414ddc], 9
or eax, 0xffffffff
jmp 0x40fe19
mov dword [0x414ddc], 0x1c
or eax, 0xffffffff
jmp 0x40fe19
mov eax, dword [ebp - 0x418]
sub eax, dword [ebp - 0x414]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret