Function at 0x404050
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 [0x409250]
jae 0x40429d
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409150]
test byte [eax + edx*8 + 4], 1
je 0x40429d
test esi, esi
je 0x404299
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409150]
test byte [eax + edx*8 + 4], 0x20
je 0x4040b9
push 2
push 0
mov eax, dword [ebp + 8]
push eax
call fcn.00404e10
add esp, 0xc
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409150]
test byte [eax + edx*8 + 4], 0x80
je 0x4041fb
mov eax, dword [ebp + 0xc]
mov edi, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
jmp 0x4041d4
lea eax, [ebp - 0x405]
jmp 0x404111
cmp byte [edi], 0xa
jne 0x40410b
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 0x404131
mov edx, edi
sub edx, dword [ebp - 0x414]
cmp esi, edx
ja 0x4040fc
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409150]
test byte [eax + edx*8 + 4], 0x40
je 0x40418b
mov eax, dword [ebp + 8]
push eax
call fcn.00405070
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40418b
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.00405190
add esp, 0x10
mov eax, dword [ebp + 8]
push eax
call fcn.00405070
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 0x4041f1
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 0x4041ed
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x414], eax
mov eax, edi
sub eax, dword [ebp - 0x414]
cmp esi, eax
ja 0x4040f4
xor ebx, ebx
jmp 0x40424e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40424e
mov eax, dword [ebp + 8]
push eax
call fcn.00405070
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 0x404232
mov eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
mov dword [ebp - 0x40c], 0
xor ebx, ebx
jmp 0x40424e
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 0x4042bb
test ebx, ebx
je 0x404278
cmp ebx, 5
jne 0x40426c
mov dword [0x40887c], 9
jmp 0x404273
push ebx
call fcn.00405250
pop ecx
or eax, 0xffffffff
jmp 0x4042c7
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x409150]
test byte [eax + edx*8 + 4], 0x40
je 0x4042ac
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x4042ac
xor eax, eax
jmp 0x4042c7
mov dword [0x40887c], 9
or eax, 0xffffffff
jmp 0x4042c7
mov dword [0x40887c], 0x1c
or eax, 0xffffffff
jmp 0x4042c7
mov eax, dword [ebp - 0x410]
sub eax, dword [ebp - 0x40c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret