Function at 0x404580
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x414
push ebx
push esi
push edi
mov ebx, dword [ebp + 0x10]
mov eax, dword [ebp + 8]
mov edx, dword [0x40be7c]
cmp eax, edx
jae 0x4045b6
mov eax, dword [ebp + 8]
and eax, 0x1f
mov edx, dword [ebp + 8]
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 1
jne 0x4045c8
mov dword [0x40b8e0], 9
or eax, 0xffffffff
jmp 0x40481b
test ebx, ebx
jne 0x4045d3
xor eax, eax
jmp 0x40481b
mov eax, dword [ebp + 8]
and eax, 0x1f
mov edx, dword [ebp + 8]
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x20
je 0x4045fd
push 2
push 0
mov eax, dword [ebp + 8]
push eax
call fcn.00406b60
add esp, 0xc
mov eax, dword [ebp + 8]
and eax, 0x1f
mov edx, dword [ebp + 8]
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x80
je 0x404772
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x40c], eax
xor esi, esi
mov dword [ebp - 0x410], 0
jmp 0x40475b
lea eax, [ebp - 0x405]
mov dword [ebp - 0x414], eax
jmp 0x40467f
mov eax, dword [ebp - 0x40c]
cmp byte [eax], 0xa
jne 0x404663
inc dword [ebp - 0x410]
mov eax, dword [ebp - 0x414]
mov byte [eax], 0xd
inc dword [ebp - 0x414]
mov edx, dword [ebp - 0x414]
mov eax, dword [ebp - 0x40c]
mov al, byte [eax]
mov byte [edx], al
inc dword [ebp - 0x40c]
inc dword [ebp - 0x414]
mov eax, dword [ebp - 0x414]
lea edx, [ebp - 0x405]
sub eax, edx
cmp eax, 0x400
jge 0x4046a3
mov eax, dword [ebp - 0x40c]
mov edx, dword [ebp + 0xc]
sub eax, edx
cmp ebx, eax
ja 0x404643
mov eax, dword [ebp + 8]
and eax, 0x1f
mov edx, dword [ebp + 8]
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x40
je 0x404702
mov eax, dword [ebp + 8]
push eax
call fcn.00406df0
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x404702
call dword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
mov edx, dword [ebp - 0x414]
lea ecx, [ebp - 0x405]
sub edx, ecx
push edx
lea edx, [ebp - 0x405]
push edx
mov edx, dword [0x40b8d8]
push edx
push eax
call fcn.00406f10
add esp, 0x10
mov eax, dword [ebp + 8]
push eax
call fcn.00406df0
pop ecx
push 0
lea edx, [ebp - 4]
push edx
mov edx, dword [ebp - 0x414]
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 0x404751
mov eax, dword [ebp - 4]
lea edx, [esi + eax]
mov esi, edx
xor edi, edi
mov edx, dword [ebp - 0x414]
lea ecx, [ebp - 0x405]
sub edx, ecx
cmp eax, edx
jae 0x40475b
jmp 0x4047b9
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x4047b9
xor edi, edi
mov eax, dword [ebp - 0x40c]
mov edx, dword [ebp + 0xc]
sub eax, edx
cmp ebx, eax
ja 0x404635
jmp 0x4047b9
mov eax, dword [ebp + 8]
push eax
call fcn.00406df0
pop ecx
push 0
lea edx, [ebp - 4]
push edx
push ebx
mov edx, dword [ebp + 0xc]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4047a5
mov eax, dword [ebp - 4]
mov esi, eax
xor edi, edi
mov dword [ebp - 0x410], 0
jmp 0x4047b9
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
xor esi, esi
mov dword [ebp - 0x410], 0
test esi, esi
jne 0x404813
test edi, edi
je 0x4047de
cmp edi, 5
jne 0x4047d2
mov dword [0x40b8e0], 9
jmp 0x4047d9
push edi
call fcn.00406fc0
pop ecx
or eax, 0xffffffff
jmp 0x40481b
mov eax, dword [ebp + 8]
and eax, 0x1f
mov edx, dword [ebp + 8]
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x40
je 0x404804
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x404804
xor eax, eax
jmp 0x40481b
mov dword [0x40b8e0], 0x1c
or eax, 0xffffffff
jmp 0x40481b
mov eax, esi
sub eax, dword [ebp - 0x410]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret