Function at 0x403030
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x420
push ebx
push esi
push edi
mov esi, dword [ebp + 8]
mov edi, dword [ebp + 0x10]
cmp esi, dword [0x406210]
jae 0x40329f
mov eax, esi
and eax, 0x1f
mov dword [ebp - 0x410], eax
mov eax, esi
shr eax, 5
mov dword [ebp - 0x40c], eax
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x406110]
test byte [edx + eax*8 + 4], 1
je 0x40329f
test edi, edi
je 0x40329b
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x406110]
test byte [edx + eax*8 + 4], 0x20
je 0x4030b1
push 2
push 0
push esi
call fcn.00403400
add esp, 0xc
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x406110]
test byte [edx + eax*8 + 4], 0x80
je 0x403200
mov eax, dword [ebp + 0xc]
mov ebx, eax
mov dword [ebp - 0x414], 0
mov dword [ebp - 0x418], 0
jmp 0x4031d9
lea eax, [ebp - 0x405]
jmp 0x40310a
cmp byte [ebx], 0xa
jne 0x403104
inc dword [ebp - 0x414]
mov byte [eax], 0xd
inc eax
mov dl, byte [ebx]
mov byte [eax], dl
inc ebx
inc eax
mov edx, eax
mov dword [ebp - 0x420], edx
lea ecx, [ebp - 0x405]
sub edx, ecx
cmp edx, 0x400
jge 0x40312e
mov edx, ebx
sub edx, dword [ebp - 0x41c]
cmp edi, edx
ja 0x4030f5
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x406110]
test byte [edx + eax*8 + 4], 0x40
je 0x403189
push esi
call fcn.00403650
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x403189
call dword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
mov edx, dword [ebp - 0x420]
lea ecx, [ebp - 0x405]
sub edx, ecx
push edx
lea edx, [ebp - 0x405]
push edx
push dword [0x405ca0]
push eax
call fcn.00403760
add esp, 0x10
push esi
call fcn.00403650
pop ecx
push 0
lea edx, [ebp - 4]
push edx
mov edx, dword [ebp - 0x420]
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 0x4031f6
mov eax, dword [ebp - 0x418]
add eax, dword [ebp - 4]
mov dword [ebp - 0x418], eax
mov eax, dword [ebp - 0x420]
lea edx, [ebp - 0x405]
sub eax, edx
cmp dword [ebp - 4], eax
jb 0x4031f2
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x41c], eax
mov eax, ebx
sub eax, dword [ebp - 0x41c]
cmp edi, eax
ja 0x4030ed
xor ebx, ebx
jmp 0x40324f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40324f
push esi
call fcn.00403650
pop ecx
push 0
lea edx, [ebp - 4]
push edx
push edi
push dword [ebp + 0xc]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x403233
mov eax, dword [ebp - 4]
mov dword [ebp - 0x418], eax
mov dword [ebp - 0x414], 0
xor ebx, ebx
jmp 0x40324f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
mov dword [ebp - 0x414], 0
mov dword [ebp - 0x418], 0
cmp dword [ebp - 0x418], 0
jne 0x4032bd
test ebx, ebx
je 0x403279
cmp ebx, 5
jne 0x40326d
mov dword [0x405b94], 9
jmp 0x403274
push ebx
call fcn.00403810
pop ecx
or eax, 0xffffffff
jmp 0x4032c9
mov eax, dword [ebp - 0x410]
mov edx, dword [ebp - 0x40c]
mov edx, dword [edx*4 + 0x406110]
test byte [edx + eax*8 + 4], 0x40
je 0x4032ae
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x4032ae
xor eax, eax
jmp 0x4032c9
mov dword [0x405b94], 9
or eax, 0xffffffff
jmp 0x4032c9
mov dword [0x405b94], 0x1c
or eax, 0xffffffff
jmp 0x4032c9
mov eax, dword [ebp - 0x418]
sub eax, dword [ebp - 0x414]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret