Function at 0x40870f
Capabilities:
Write file on windows

Disassembly:
push ebp
mov eax, dword [0x4129e8]
lea ebp, [esp - 0x518]
add esp, 0xfffffa6c
xor eax, ebp
mov dword [ebp + 0x514], eax
mov eax, dword [ebp + 0x524]
push ebx
xor ebx, ebx
cmp dword [ebp + 0x528], ebx
mov dword [ebp - 0x64], eax
mov dword [ebp - 0x60], ebx
mov dword [ebp - 0x68], ebx
jne 0x40874b
xor eax, eax
jmp 0x408cbf
cmp eax, ebx
jne 0x408776
call fcn.00404edb
mov dword [eax], ebx
call fcn.00404ec8
push ebx
push ebx
push ebx
push ebx
push ebx
mov dword [eax], 0x16
call fcn.00404e69
add esp, 0x14
or eax, 0xffffffff
jmp 0x408cbf
mov ebx, dword [ebp + 0x520]
mov eax, ebx
push esi
push edi
mov esi, ebx
and esi, 0x1f
imul esi, esi, 0x28
sar eax, 5
lea edi, [eax*4 + 0x414860]
mov eax, dword [edi]
add eax, esi
mov cl, byte [eax + 0x24]
add cl, cl
sar cl, 1
cmp cl, 2
mov dword [ebp - 0x70], edi
mov byte [ebp - 0x55], cl
je 0x4087ad
cmp cl, 1
jne 0x4087e0
mov ecx, dword [ebp + 0x528]
not ecx
test cl, 1
jne 0x4087e0
call fcn.00404edb
xor ebx, ebx
mov dword [eax], ebx
call fcn.00404ec8
push ebx
push ebx
push ebx
push ebx
push ebx
mov dword [eax], 0x16
call fcn.00404e69
add esp, 0x14
jmp 0x408cb5
test byte [eax + 4], 0x20
je 0x4087f5
push 2
push 0
push 0
push ebx
call fcn.0040b25b
add esp, 0x10
push ebx
call fcn.0040b43b
or eax, eax
pop ecx
je 0x4089fa
mov eax, dword [edi]
test byte [esi + eax + 4], 0x80
je 0x4089fa
call fcn.00409027
xor ecx, ecx
mov eax, dword [eax + 0x6c]
cmp dword [eax + 0x14], ecx
lea eax, [ebp - 0x7c]
sete cl
mov ebx, ecx
push eax
mov eax, dword [edi]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
or eax, eax
je 0x4089fa
test ebx, ebx
je 0x408848
cmp byte [ebp - 0x55], 0
je 0x4089fa
call dword [sym.imp.KERNEL32.dll_GetConsoleCP]
and dword [ebp - 0x50], 0
cmp dword [ebp + 0x528], 0
mov ebx, dword [ebp - 0x64]
mov dword [ebp - 0x7c], eax
mov dword [ebp - 0x74], ebx
jbe 0x408c67
and dword [ebp - 0x5c], 0
jmp 0x408871
mov ebx, dword [ebp - 0x74]
mov al, byte [ebp - 0x55]
test al, al
jne 0x408982
mov al, byte [ebx]
xor ecx, ecx
cmp al, 0xa
sete cl
movsx eax, al
push eax
mov dword [ebp - 0x78], ecx
call fcn.0040c08b
pop ecx
test eax, eax
jne 0x4088b0
lea eax, [ebp - 0x54]
push 1
push ebx
push eax
call fcn.0040c9e7
sub esp, 0xfffffff4
cmp eax, 0xffffffff
je 0x408c5d
jmp 0x4088e0
mov eax, dword [ebp - 0x64]
sub eax, ebx
add eax, dword [ebp + 0x528]
cmp eax, 1
jbe 0x408c5d
lea eax, [ebp - 0x54]
push 2
push ebx
push eax
call fcn.0040c9e7
sub esp, 0xfffffff4
cmp eax, 0xffffffff
je 0x408c5d
inc ebx
inc dword [ebp - 0x5c]
lea ecx, [ebp + 0x50c]
xor eax, eax
inc ebx
push eax
push eax
push 5
push ecx
lea ecx, [ebp - 0x54]
push 1
push ecx
push eax
push dword [ebp - 0x7c]
inc dword [ebp - 0x5c]
mov dword [ebp - 0x74], ebx
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov ebx, eax
test ebx, ebx
je 0x408c5d
push 0
lea eax, [ebp - 0x50]
push eax
lea eax, [ebp + 0x50c]
push ebx
push eax
mov eax, dword [edi]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
or eax, eax
je 0x408c54
mov eax, dword [ebp - 0x50]
add dword [ebp - 0x60], eax
cmp eax, ebx
jl 0x408c5d
cmp dword [ebp - 0x78], 0
je 0x4089e6
lea ebx, [ebp - 0x50]
push 0
push ebx
lea ebx, [ebp + 0x50c]
push 1
push ebx
mov eax, dword [edi]
mov byte [ebp + 0x50c], 0xd
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
or eax, eax
je 0x408c54
cmp dword [ebp - 0x50], 1
jl 0x408c5d
inc dword [ebp - 0x68]
inc dword [ebp - 0x60]
jmp 0x4089e6
cmp al, 1
je 0x40898a
cmp al, 2
jne 0x4089a5
movzx ecx, word [ebx]
xor edx, edx
cmp cx, 0xa
sete dl
inc ebx
inc ebx
sub dword [ebp - 0x5c], 0xfffffffe
mov dword [ebp - 0x54], ecx
mov dword [ebp - 0x74], ebx
mov dword [ebp - 0x78], edx
cmp al, 1
je 0x4089ad
cmp al, 2
jne 0x4089e6
push dword [ebp - 0x54]
call fcn.0040c812
pop ecx
cmp ax, word [ebp - 0x54]
jne 0x408c54
inc dword [ebp - 0x60]
cmp dword [ebp - 0x78], 0
je 0x4089e6
push 0xd
pop eax
push eax
mov dword [ebp - 0x54], eax
call fcn.0040c812
cmp ax, word [ebp - 0x54]
pop ecx
jne 0x408c54
inc dword [ebp - 0x60]
inc dword [ebp - 0x68]
mov eax, dword [ebp + 0x528]
cmp dword [ebp - 0x5c], eax
jb 0x40886e
jmp 0x408c5d
mov eax, dword [edi]
add eax, esi
test byte [eax + 4], 0x80
je 0x408c2d
xor ebx, ebx
mov eax, dword [ebp - 0x64]
cmp byte [ebp - 0x55], 0
mov dword [ebp - 0x54], ebx
jne 0x408aab
cmp dword [ebp + 0x528], ebx
mov dword [ebp - 0x50], eax
jbe 0x408c8e
lea eax, [ebp - 0x4c]
mov ecx, dword [ebp - 0x50]
and dword [ebp - 0x5c], 0
sub ecx, dword [ebp - 0x64]
cmp ecx, dword [ebp + 0x528]
jae 0x408a65
mov edx, dword [ebp - 0x50]
inc dword [ebp - 0x50]
mov dl, byte [edx]
inc ecx
cmp dl, 0xa
jne 0x408a56
inc dword [ebp - 0x68]
mov byte [eax], 0xd
inc eax
inc dword [ebp - 0x5c]
mov byte [eax], dl
inc eax
inc dword [ebp - 0x5c]
cmp dword [ebp - 0x5c], 0x400
jb 0x408a36
mov ebx, eax
push 0
lea eax, [ebp - 0x4c]
sub ebx, eax
lea eax, [ebp - 0x6c]
push eax
push ebx
lea eax, [ebp - 0x4c]
push eax
mov eax, dword [edi]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
or eax, eax
je 0x408c54
mov eax, dword [ebp - 0x6c]
add dword [ebp - 0x60], eax
cmp eax, ebx
jl 0x408c5d
mov eax, dword [ebp - 0x50]
sub eax, dword [ebp - 0x64]
cmp eax, dword [ebp + 0x528]
jb 0x408a29
jmp 0x408c5d
cmp byte [ebp - 0x55], 2
jne 0x408b52
cmp dword [ebp + 0x528], ebx
mov dword [ebp - 0x50], eax
jbe 0x408c8e
xor ebx, ebx
lea eax, [ebp - 0x4c]
mov ecx, dword [ebp - 0x50]
sub ecx, dword [ebp - 0x64]
cmp ecx, dword [ebp + 0x528]
jae 0x408b08
mov edx, dword [ebp - 0x50]
sub dword [ebp - 0x50], 0xfffffffe
movzx edx, word [edx]
inc ecx
inc ecx
cmp dx, 0xa
jne 0x408af6
sub dword [ebp - 0x68], 0xfffffffe
mov word [eax], 0xd
inc eax
inc eax
inc ebx
inc ebx
mov edi, dword [ebp - 0x70]
mov word [eax], dx
inc eax
inc eax
inc ebx
inc ebx
cmp ebx, 0x3ff
jb 0x408acf
mov ebx, eax
lea eax, [ebp - 0x4c]
sub ebx, eax
push 0
lea eax, [ebp - 0x6c]
push eax
push ebx
lea eax, [ebp - 0x4c]
push eax
mov eax, dword [edi]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
or eax, eax
je 0x408c54
mov eax, dword [ebp - 0x6c]
add dword [ebp - 0x60], eax
cmp eax, ebx
jl 0x408c5d
mov ebx, dword [ebp - 0x50]
sub ebx, dword [ebp - 0x64]
cmp ebx, dword [ebp + 0x528]
jb 0x408ac4
jmp 0x408c5d
cmp dword [ebp + 0x528], ebx
mov dword [ebp - 0x5c], eax
jbe 0x408c8e
mov ebx, dword [ebp - 0x5c]
and dword [ebp - 0x50], 0
sub ebx, dword [ebp - 0x64]
push 2
pop ecx
lea eax, [ebp + 0x3b8]
cmp ebx, dword [ebp + 0x528]
jae 0x408ba8
mov edx, dword [ebp - 0x5c]
movzx edx, word [edx]
add dword [ebp - 0x5c], ecx
add ebx, ecx
cmp dx, 0xa
jne 0x408b97
mov word [eax], 0xd
add eax, ecx
add dword [ebp - 0x50], ecx
add dword [ebp - 0x50], ecx
mov word [eax], dx
add eax, ecx
cmp dword [ebp - 0x50], 0x152
jb 0x408b74
lea ecx, [ebp + 0x3b8]
xor ebx, ebx
push ebx
lea edi, [ebp + 0x108]
sub eax, ecx
push ebx
push 0x2ab
push edi
cdq
sub eax, edx
sar eax, 1
push eax
mov eax, ecx
push eax
push ebx
push 0xfde9
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov edi, eax
cmp edi, ebx
je 0x408c54
lea eax, [ebp - 0x6c]
push 0
push eax
mov eax, edi
sub eax, ebx
push eax
lea eax, [ebp + ebx + 0x108]
push eax
mov eax, dword [ebp - 0x70]
mov eax, dword [eax]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
or eax, eax
je 0x408c09
add ebx, dword [ebp - 0x6c]
cmp edi, ebx
jg 0x408bdb
jmp 0x408c12
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x54], eax
cmp edi, ebx
jg 0x408c5d
mov ebx, dword [ebp - 0x5c]
sub ebx, dword [ebp - 0x64]
cmp ebx, dword [ebp + 0x528]
mov dword [ebp - 0x60], ebx
jb 0x408b61
jmp 0x408c5d
lea ecx, [ebp - 0x6c]
push 0
push ecx
push dword [ebp + 0x528]
push dword [ebp - 0x64]
push dword [eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x408c54
mov eax, dword [ebp - 0x6c]
and dword [ebp - 0x54], 0
mov dword [ebp - 0x60], eax
jmp 0x408c5d
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x54], eax
mov eax, dword [ebp - 0x60]
or eax, eax
jne 0x408cba
mov edi, dword [ebp - 0x70]
xor ebx, ebx
cmp dword [ebp - 0x54], ebx
je 0x408c8e
push 5
pop ebx
cmp dword [ebp - 0x54], ebx
jne 0x408c83
call fcn.00404ec8
mov dword [eax], 9
jmp 0x408cae
push dword [ebp - 0x54]
call fcn.00404eee
pop ebx
jmp 0x408cb5
mov eax, dword [edi]
test byte [esi + eax + 4], 0x40
je 0x408ca3
mov eax, dword [ebp - 0x64]
cmp byte [eax], 0x1a
jne 0x408ca3
xor eax, eax
jmp 0x408cbd
call fcn.00404ec8
mov dword [eax], 0x1c
call fcn.00404edb
mov dword [eax], ebx
or eax, 0xffffffff
jmp 0x408cbd
sub eax, dword [ebp - 0x68]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x514]
xor ecx, ebp
call fcn.004038f9
sub ebp, 0xfffffae8
leave
ret