Function at 0x405700
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 [0x40d204]
jae 0x40594d
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d104]
test byte [eax + edx*8 + 4], 1
je 0x40594d
test esi, esi
je 0x405949
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d104]
test byte [eax + edx*8 + 4], 0x20
je 0x405769
push 2
push 0
mov eax, dword [ebp + 8]
push eax
call fcn.00407c40
add esp, 0xc
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d104]
test byte [eax + edx*8 + 4], 0x80
je 0x4058ab
mov eax, dword [ebp + 0xc]
mov edi, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
jmp 0x405884
lea eax, [ebp - 0x405]
jmp 0x4057c1
cmp byte [edi], 0xa
jne 0x4057bb
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 0x4057e1
mov edx, edi
sub edx, dword [ebp - 0x414]
cmp esi, edx
ja 0x4057ac
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d104]
test byte [eax + edx*8 + 4], 0x40
je 0x40583b
mov eax, dword [ebp + 8]
push eax
call fcn.00407b20
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40583b
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 [0x40c874]
push edx
push eax
call fcn.00407cd0
add esp, 0x10
mov eax, dword [ebp + 8]
push eax
call fcn.00407b20
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 0x4058a1
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 0x40589d
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x414], eax
mov eax, edi
sub eax, dword [ebp - 0x414]
cmp esi, eax
ja 0x4057a4
xor ebx, ebx
jmp 0x4058fe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x4058fe
mov eax, dword [ebp + 8]
push eax
call fcn.00407b20
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 0x4058e2
mov eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
mov dword [ebp - 0x40c], 0
xor ebx, ebx
jmp 0x4058fe
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 0x40596b
test ebx, ebx
je 0x405928
cmp ebx, 5
jne 0x40591c
mov dword [0x40c87c], 9
jmp 0x405923
push ebx
call fcn.00407d90
pop ecx
or eax, 0xffffffff
jmp 0x405977
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40d104]
test byte [eax + edx*8 + 4], 0x40
je 0x40595c
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x40595c
xor eax, eax
jmp 0x405977
mov dword [0x40c87c], 9
or eax, 0xffffffff
jmp 0x405977
mov dword [0x40c87c], 0x1c
or eax, 0xffffffff
jmp 0x405977
mov eax, dword [ebp - 0x410]
sub eax, dword [ebp - 0x40c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret