Function at 0x404010
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x414
push ebx
push esi
push edi
mov esi, dword [ebp + 0x10]
mov eax, dword [ebp + 8]
cmp eax, dword [0x409254]
jae 0x40425d
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409154]
test byte [eax + edx*8 + 4], 1
je 0x40425d
test esi, esi
je 0x404259
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409154]
test byte [eax + edx*8 + 4], 0x20
je 0x404079
push 2
push 0
mov eax, dword [ebp + 8]
push eax
call fcn.00404dd0
add esp, 0xc
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409154]
test byte [eax + edx*8 + 4], 0x80
je 0x4041bb
mov eax, dword [ebp + 0xc]
mov edi, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
jmp 0x404194
lea eax, [ebp - 0x405]
jmp 0x4040d1
cmp byte [edi], 0xa
jne 0x4040cb
inc dword [ebp - 0x40c]
mov byte [eax], 0xd
inc eax
mov dl, byte [edi]
mov byte [eax], dl
inc edi
inc eax
mov ebx, eax
lea edx, [ebp - 0x405]
neg edx
add edx, ebx
cmp edx, 0x400
jge 0x4040f1
mov edx, edi
sub edx, dword [ebp - 0x414]
cmp esi, edx
ja 0x4040bc
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409154]
test byte [eax + edx*8 + 4], 0x40
je 0x40414b
mov eax, dword [ebp + 8]
push eax
call fcn.00405030
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40414b
call dword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
lea edx, [ebp - 0x405]
neg edx
add edx, ebx
push edx
lea edx, [ebp - 0x405]
push edx
mov edx, dword [0x408874]
push edx
push eax
call fcn.00405150
add esp, 0x10
mov eax, dword [ebp + 8]
push eax
call fcn.00405030
pop ecx
push 0
lea edx, [ebp - 4]
push edx
lea edx, [ebp - 0x405]
neg edx
add edx, ebx
push edx
lea edx, [ebp - 0x405]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4041b1
mov eax, dword [ebp - 0x410]
add eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
lea eax, [ebp - 0x405]
sub ebx, eax
cmp dword [ebp - 4], ebx
jb 0x4041ad
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x414], eax
mov eax, edi
sub eax, dword [ebp - 0x414]
cmp esi, eax
ja 0x4040b4
xor ebx, ebx
jmp 0x40420e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40420e
mov eax, dword [ebp + 8]
push eax
call fcn.00405030
pop ecx
push 0
lea edx, [ebp - 4]
push edx
push esi
mov edx, dword [ebp + 0xc]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4041f2
mov eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
mov dword [ebp - 0x40c], 0
xor ebx, ebx
jmp 0x40420e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
cmp dword [ebp - 0x410], 0
jne 0x40427b
test ebx, ebx
je 0x404238
cmp ebx, 5
jne 0x40422c
mov dword [0x40887c], 9
jmp 0x404233
push ebx
call fcn.00405210
pop ecx
or eax, 0xffffffff
jmp 0x404287
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409154]
test byte [eax + edx*8 + 4], 0x40
je 0x40426c
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x40426c
xor eax, eax
jmp 0x404287
mov dword [0x40887c], 9
or eax, 0xffffffff
jmp 0x404287
mov dword [0x40887c], 0x1c
or eax, 0xffffffff
jmp 0x404287
mov eax, dword [ebp - 0x410]
sub eax, dword [ebp - 0x40c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret