Function at 0x404740
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 [0x40d124]
jae 0x40498d
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d128]
test byte [eax + edx*8 + 4], 1
je 0x40498d
test esi, esi
je 0x404989
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d128]
test byte [eax + edx*8 + 4], 0x20
je 0x4047a9
push 2
push 0
mov eax, dword [ebp + 8]
push eax
call fcn.004078e0
add esp, 0xc
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d128]
test byte [eax + edx*8 + 4], 0x80
je 0x4048eb
mov eax, dword [ebp + 0xc]
mov edi, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
jmp 0x4048c4
lea eax, [ebp - 0x405]
jmp 0x404801
cmp byte [edi], 0xa
jne 0x4047fb
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 0x404821
mov edx, edi
sub edx, dword [ebp - 0x414]
cmp esi, edx
ja 0x4047ec
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d128]
test byte [eax + edx*8 + 4], 0x40
je 0x40487b
mov eax, dword [ebp + 8]
push eax
call fcn.00404b90
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40487b
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 [0x40c86c]
push edx
push eax
call fcn.00407970
add esp, 0x10
mov eax, dword [ebp + 8]
push eax
call fcn.00404b90
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 0x4048e1
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 0x4048dd
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x414], eax
mov eax, edi
sub eax, dword [ebp - 0x414]
cmp esi, eax
ja 0x4047e4
xor ebx, ebx
jmp 0x40493e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40493e
mov eax, dword [ebp + 8]
push eax
call fcn.00404b90
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 0x404922
mov eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
mov dword [ebp - 0x40c], 0
xor ebx, ebx
jmp 0x40493e
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 0x4049ab
test ebx, ebx
je 0x404968
cmp ebx, 5
jne 0x40495c
mov dword [0x40c760], 9
jmp 0x404963
push ebx
call fcn.00404cb0
pop ecx
or eax, 0xffffffff
jmp 0x4049b7
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d128]
test byte [eax + edx*8 + 4], 0x40
je 0x40499c
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x40499c
xor eax, eax
jmp 0x4049b7
mov dword [0x40c760], 9
or eax, 0xffffffff
jmp 0x4049b7
mov dword [0x40c760], 0x1c
or eax, 0xffffffff
jmp 0x4049b7
mov eax, dword [ebp - 0x410]
sub eax, dword [ebp - 0x40c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret