Function at 0x40fb70
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 0x40fddf
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 0x40fddf
test edi, edi
je 0x40fddb
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x20
je 0x40fbf1
push 2
push 0
push esi
call fcn.004108c0
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 0x40fd40
mov eax, dword [ebp + 0xc]
mov ebx, eax
mov dword [ebp - 0x414], 0
mov dword [ebp - 0x418], 0
jmp 0x40fd19
lea eax, [ebp - 0x405]
jmp 0x40fc4a
cmp byte [ebx], 0xa
jne 0x40fc44
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 0x40fc6e
mov edx, ebx
sub edx, dword [ebp - 0x41c]
cmp edi, edx
ja 0x40fc35
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x40
je 0x40fcc9
push esi
call fcn.00410b10
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40fcc9
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.00410c20
add esp, 0x10
push esi
call fcn.00410b10
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 0x40fd36
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 0x40fd32
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x41c], eax
mov eax, ebx
sub eax, dword [ebp - 0x41c]
cmp edi, eax
ja 0x40fc2d
xor ebx, ebx
jmp 0x40fd8f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40fd8f
push esi
call fcn.00410b10
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 0x40fd73
mov eax, dword [ebp - 4]
mov dword [ebp - 0x418], eax
mov dword [ebp - 0x414], 0
xor ebx, ebx
jmp 0x40fd8f
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 0x40fdfd
test ebx, ebx
je 0x40fdb9
cmp ebx, 5
jne 0x40fdad
mov dword [0x414dec], 9
jmp 0x40fdb4
push ebx
call fcn.00410cd0
pop ecx
or eax, 0xffffffff
jmp 0x40fe09
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x41bd58]
test byte [edx + eax*8 + 4], 0x40
je 0x40fdee
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x40fdee
xor eax, eax
jmp 0x40fe09
mov dword [0x414dec], 9
or eax, 0xffffffff
jmp 0x40fe09
mov dword [0x414dec], 0x1c
or eax, 0xffffffff
jmp 0x40fe09
mov eax, dword [ebp - 0x418]
sub eax, dword [ebp - 0x414]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret