Function at 0x412a20
Capabilities:
Manipulate console buffer
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x130
mov eax, dword [0x456d10]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [0x45a93c]
push ebx
push esi
push edi
xor edi, edi
mov dword [ebp - 0x130], edx
xor esi, esi
mov dword [ebp - 0x12c], eax
mov dword [ebp - 0x128], edi
mov bl, cl
test al, 4
je 0x412cbd
push eax
push str.console_mode__0x_08x_n
push 2
call fcn.0041a380
add esp, 0xc
cmp bl, 2
je 0x412cbd
cmp bl, 1
je 0x412cbd
cmp bl, 8
je 0x412b5c
cmp bl, 0xd
je 0x412b5c
cmp bl, 0xa
je 0x412b5c
cmp bl, 3
je 0x412b5c
push 1
call dword [sym.imp.KERNEL32.dll_Sleep]
push dword [0x47bacc]
movsx eax, bl
push eax
push str.Handle_echo_of_char__0x_02x__charinaline___d_n
push 2
call fcn.0041a380
add esp, 0x10
lea eax, [ebp - 0x124]
push eax
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
mov ecx, dword [ebp - 0x130]
mov ax, word [ebp - 0x11e]
mov dx, word [ebp - 0x120]
movsx esi, dx
mov word [ecx + 2], ax
mov eax, dword [0x47b994]
mov word [ecx], dx
movsx ecx, ax
sub esi, ecx
test esi, esi
jle 0x412b51
lea ecx, [ebp - 0x10c]
push ecx
push eax
push esi
lea eax, [ebp - 0x108]
push eax
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_ReadConsoleOutputCharacterA]
test eax, eax
jne 0x412b51
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ReadConsoleOutputCharacter_failed_with__d_n
push 2
call fcn.0041a380
add esp, 0xc
mov byte [ebp - 0x108], bl
inc dword [0x47bacc]
lea esi, [edi + 1]
jmp 0x412c0d
add dword [0x47bacc], esi
jmp 0x412c0d
mov eax, dword [ebp - 0x12c]
test al, 2
je 0x412c0d
test al, 1
je 0x412c0d
push dword [0x47bacc]
movsx eax, bl
push eax
push str.Handle_echo_of_special_char__0x_02x__charinaline___d_n
push 2
call fcn.0041a380
mov eax, dword [0x47bacc]
add esp, 0x10
cmp bl, 8
jne 0x412bb3
test eax, eax
jle 0x412bb3
dec eax
mov word [ebp - 0x108], 0x2008
mov byte [ebp - 0x106], bl
mov esi, 3
mov dword [0x47bacc], eax
mov ecx, dword [0x45a94c]
cmp ecx, 1
jne 0x412bda
cmp bl, 3
jne 0x412bda
mov word [ebp + esi - 0x108], 0x435e
add esi, 2
add eax, 2
mov dword [0x47bacc], eax
jmp 0x412c0d
cmp bl, 0xd
jne 0x412bed
mov byte [ebp + esi - 0x108], bl
inc esi
mov dword [0x47bacc], edi
cmp ecx, 1
jne 0x412c0d
cmp bl, 0xa
jne 0x412c0d
mov dword [0x47bacc], edi
mov edi, ecx
mov byte [ebp + esi - 0x108], bl
inc esi
mov dword [ebp - 0x128], edi
push esi
push str.EchoBufLen___d_n
push 2
call fcn.0041a380
add esp, 0xc
test esi, esi
je 0x412cbd
cmp dword [0x47b504], 0
je 0x412cd0
lea eax, [esi + 0x2c]
push eax
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov ebx, eax
test ebx, ebx
je 0x412cbd
lea eax, [esi + 0x2c]
push eax
push 0
push ebx
call fcn.0042bf20
xor eax, eax
mov dword [ebx + 0x18], esi
mov word [ebx], ax
lea eax, [esi + 0x2c]
mov dword [ebx + 4], eax
lea eax, [ebp - 0x108]
push esi
push eax
lea eax, [ebx + 0x20]
push eax
call fcn.0042a7d0
add esp, 0x18
lea eax, [ebp - 0x10c]
push 0
push eax
push dword [ebx + 4]
push ebx
push dword [0x47b504]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x412ca7
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Echo_WriteFile_failed_with__d_n
push 2
call fcn.0041a380
add esp, 0xc
jmp 0x412cb6
push str.Echo_WriteFile_succeeded_n
push 2
call fcn.0041a380
add esp, 8
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, edi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004265fb
mov esp, ebp
pop ebp
ret
xor edi, edi
test esi, esi
jle 0x412d13
jmp 0x412ce0
mov ecx, dword [0x45af98]
mov al, byte [ebp + edi - 0x108]
mov byte [ecx], al
inc ecx
movsx eax, byte [ebp + edi - 0x108]
push eax
push str.Echo_char__c_n
push 2
mov dword [0x45af98], ecx
call fcn.0041a380
inc edi
add esp, 0xc
cmp edi, esi
jl 0x412ce0
mov esi, dword [ebp - 0x128]
test esi, esi
je 0x412d2f
or ecx, 0xffffffff
call fcn.00412710
call fcn.00414fb0
call fcn.00412780
mov ecx, dword [ebp - 4]
mov eax, esi
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004265fb
mov esp, ebp
pop ebp
ret