Function at 0x404320
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x410
push ebx
push esi
push edi
mov ebx, dword [ebp + 8]
cmp ebx, dword [0x40c27c]
jae 0x40455c
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 1
je 0x40455c
cmp dword [ebp + 0x10], 0
je 0x404558
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 0x20
jne 0x404528
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 0x80
je 0x4044ab
mov eax, dword [ebp + 0xc]
mov esi, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
jmp 0x40448b
lea edi, [ebp - 0x405]
jmp 0x4043d4
cmp byte [esi], 0xa
jne 0x4043ce
inc dword [ebp - 0x40c]
mov byte [edi], 0xd
inc edi
mov al, byte [esi]
mov byte [edi], al
inc esi
inc edi
lea eax, [ebp - 0x405]
neg eax
add eax, edi
cmp eax, 0x400
jge 0x4043ef
mov eax, esi
sub eax, dword [ebp + 0xc]
cmp dword [ebp + 0x10], eax
ja 0x4043bf
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 0x40
je 0x404445
push ebx
call fcn.00406c10
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x404445
call dword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
lea edx, [ebp - 0x405]
neg edx
add edx, edi
push edx
lea edx, [ebp - 0x405]
push edx
mov edx, dword [0x40b888]
push edx
push eax
call fcn.00406d30
add esp, 0x10
push ebx
call fcn.00406c10
pop ecx
push 0
lea edx, [ebp - 4]
push edx
lea edx, [ebp - 0x405]
neg edx
add edx, edi
push edx
lea edx, [ebp - 0x405]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4044a1
mov eax, dword [ebp - 0x410]
add eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
lea eax, [ebp - 0x405]
sub edi, eax
cmp dword [ebp - 4], edi
jb 0x40449d
mov eax, esi
sub eax, dword [ebp + 0xc]
cmp dword [ebp + 0x10], eax
ja 0x4043b7
xor esi, esi
jmp 0x4044fe
xor esi, esi
jmp 0x4044fe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
jmp 0x4044fe
push ebx
call fcn.00406c10
pop ecx
push 0
lea edx, [ebp - 4]
push edx
mov edx, dword [ebp + 0x10]
push edx
mov edx, dword [ebp + 0xc]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4044e2
mov eax, dword [ebp - 4]
mov dword [ebp - 0x410], eax
mov dword [ebp - 0x40c], 0
xor esi, esi
jmp 0x4044fe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
mov dword [ebp - 0x40c], 0
mov dword [ebp - 0x410], 0
cmp dword [ebp - 0x410], 0
jne 0x40457a
test esi, esi
je 0x40453a
cmp esi, 5
jne 0x40451c
mov dword [0x40b890], 9
jmp 0x404523
push esi
call fcn.00406df0
pop ecx
or eax, 0xffffffff
jmp 0x404586
push 2
push 0
push ebx
call fcn.00406f70
add esp, 0xc
jmp 0x40437d
mov eax, ebx
and eax, 0x1f
shr ebx, 5
mov ebx, dword [ebx*4 + 0x40c17c]
test byte [ebx + eax*8 + 4], 0x40
je 0x40456b
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0x1a
jne 0x40456b
xor eax, eax
jmp 0x404586
mov dword [0x40b890], 9
or eax, 0xffffffff
jmp 0x404586
mov dword [0x40b890], 0x1c
or eax, 0xffffffff
jmp 0x404586
mov eax, dword [ebp - 0x410]
sub eax, dword [ebp - 0x40c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret