Function at 0x21006ee60
Capabilities:
Manipulate console buffer

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x68
mov rdi, rcx
mov ecx, 0xaa00
mov qword [rsp + 0x48], rdx
call sym.malloc_1
mov ecx, 0xaa00
mov r12, rax
call sym.malloc_1
mov qword [rsp + 0x30], rax
test r12, r12
je 0x21006f9c9
test rax, rax
je 0x21006f9c9
mov rax, qword [0x21034b1a0]
mov rdx, qword [0x21024fce8]
movzx eax, byte [rax + 0x13]
and eax, 0x40
cmp al, 1
mov rax, qword [0x21024fa28]
sbb r13d, r13d
and r13d, 0x80
mov esi, dword [rax + 0x90]
add r13d, 0x800
cmp dword [rdx], esi
jne 0x21006f9c9
mov dword [rsp + 0x40], 0x880
lea rbp, [rsp + 0x58]
lea rbx, [0x21028a874]
jmp 0x21006ef92
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov rcx, qword [rdi]
lea rdx, [rsp + 0x50]
call sym.GetNumberOfConsoleInputEvents
call sym.release_attach_mutex__
mov eax, dword [rsp + 0x50]
cmp eax, 0x800
jbe 0x21006efc5
mov r8d, 5
mov rdx, rbp
lea r15, [rsp + 0x54]
xor ecx, ecx
mov qword [rsp + 0x58], 0xfffffffffff9e580
call sym.cygwait_void___LARGE_INTEGER__unsigned_int_
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov rcx, qword [rdi]
mov rdx, r15
call sym.GetNumberOfConsoleInputEvents
call sym.release_attach_mutex__
mov eax, dword [rsp + 0x54]
cmp eax, dword [rsp + 0x50]
jae 0x21006efc1
mov rax, qword [0x21024fa28]
mov byte [rax + 0x5a2], 1
mov rdx, qword [0x21024fce8]
mov esi, dword [rdx]
cmp dword [rax + 0x90], esi
jne 0x21006f9c9
cmp byte [rax + 0x5a1], 0
je 0x21006ef00
mov r8d, 5
mov rdx, rbp
xor ecx, ecx
mov qword [rsp + 0x58], 0xfffffffffff9e580
call sym.cygwait_void___LARGE_INTEGER__unsigned_int_
mov rax, qword [0x21024fa28]
jmp 0x21006ef7d
mov dword [rsp + 0x50], eax
mov rdx, qword [0x21024fa28]
lea esi, [rax + 0x80]
mov byte [rdx + 0x5a2], 0
cmp esi, dword [rsp + 0x40]
ja 0x21006f386
mov rcx, qword [rdi + 0x10]
mov edx, dword [0x21024fa70]
call sym.WaitForSingleObject
mov rcx, qword [rdi]
mov rdx, rbp
mov r8d, 5
mov dword [rsp + 0x50], 0
mov qword [rsp + 0x58], 0
call sym.cygwait_void___LARGE_INTEGER__unsigned_int_
cmp eax, 2
ja 0x21006f1e7
test eax, eax
jne 0x21006f093
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov dword [rsp + 0x50], 0
mov esi, dword [rsp + 0x40]
jmp 0x21006f070
mov eax, dword [rsp + 0x50]
cmp eax, esi
jae 0x21006f08e
mov r8d, esi
mov rcx, qword [rdi]
mov r9, rbp
sub r8d, eax
lea rax, [rax + rax*4]
cmp r8d, r13d
lea rdx, [r12 + rax*4]
cmova r8d, r13d
call sym.ReadConsoleInputW
mov eax, dword [rsp + 0x58]
add dword [rsp + 0x50], eax
mov rcx, qword [rdi]
mov r8d, 5
mov rdx, rbp
mov qword [rsp + 0x58], 0
call sym.cygwait_void___LARGE_INTEGER__unsigned_int_
test eax, eax
je 0x21006f040
call sym.release_attach_mutex__
mov rdx, qword [0x21034b1a0]
mov rax, qword [0x21024fa28]
test byte [rdx + 0x12], 0x10
je 0x21006f214
test rax, rax
je 0x21006f0bd
cmp byte [rax + 0x94], 0
jne 0x21006f214
mov r15d, dword [rax + 0x5a4]
mov esi, dword [rsp + 0x50]
cmp esi, r15d
jbe 0x21006f1cb
mov dword [rsp + 0x44], r13d
mov rsi, qword [rsp + 0x48]
mov r13d, r15d
mov qword [rsp + 0x38], rbp
jmp 0x21006f182
mov rcx, qword [0x21024fa28]
mov rdx, qword [rdi + 8]
movzx eax, word [rcx + 0x52a]
movzx r15d, word [rcx + 0x52c]
add rcx, 0x90
mov word [rsp + 0x28], ax
call method.dev_console.fillin_void_
mov rax, qword [0x21024fa28]
cmp word [rax + 0x52c], r15w
je 0x21006f310
mov rdx, qword [0x21034b1a0]
mov dword [rax + 0x510], 0xffff0000
test byte [rdx + 0x12], 0x10
je 0x21006f154
cmp byte [rax + 0x94], 0
je 0x21006f324
mov edx, 0x1c
xor r8d, r8d
mov rcx, rsi
call method.tty_min.kill_pgrp_int__int_
mov eax, dword [rsp + 0x50]
lea edx, [r13 + 1]
lea r15d, [rax - 1]
cmp eax, edx
ja 0x21006f2e8
mov dword [rsp + 0x50], r15d
cmp r13d, r15d
jae 0x21006f1b7
mov eax, r13d
lea r14, [rax + rax*4]
shl r14, 2
lea rbp, [r12 + r14]
movzx eax, word [rbp]
cmp ax, 1
je 0x21006f280
cmp ax, 4
je 0x21006f0f0
mov r15d, dword [rsp + 0x50]
add r13d, 1
cmp r13d, r15d
jb 0x21006f182
mov r13d, dword [rsp + 0x44]
mov rbp, qword [rsp + 0x38]
mov esi, r15d
mov rax, qword [0x21024fa28]
mov dword [rax + 0x5a4], esi
test esi, esi
jne 0x21006f40a
mov rcx, qword [rdi + 0x10]
call sym.ReleaseMutex
jmp 0x21006ef9f
cmp eax, 0x102
jne 0x21006f3de
mov rax, qword [0x21024fa28]
mov rdx, qword [0x21034b1a0]
mov dword [rax + 0x5a4], 0
test byte [rdx + 0x12], 0x10
jne 0x21006f0b0
mov rdx, qword [rdi + 8]
lea rcx, [rax + 0x90]
movzx r14d, word [rax + 0x52c]
movzx esi, word [rax + 0x52a]
call method.dev_console.fillin_void_
mov rax, qword [0x21024fa28]
cmp word [rax + 0x52c], r14w
jne 0x21006f251
cmp word [rax + 0x52a], si
je 0x21006f0bd
mov rcx, qword [rsp + 0x48]
xor r8d, r8d
mov edx, 0x1c
mov dword [rax + 0x510], 0xffff0000
call method.tty_min.kill_pgrp_int__int_
mov rax, qword [0x21024fa28]
jmp 0x21006f0bd
mov eax, dword [rbp + 4]
test eax, eax
je 0x21006f1a9
movzx ecx, word [rbp + 0xe]
lea eax, [rcx - 1]
cmp ax, 0x7e
ja 0x21006f1a9
movzx r15d, cx
xor r8d, r8d
mov rdx, rsi
mov ecx, r15d
call method.fhandler_termios.process_sigs_char__tty__fhandler_termios_
cmp eax, 4
ja 0x21006f365
mov ecx, 0x15
bt rcx, rax
jae 0x21006f365
mov byte [rsi + 0xc], 0
test byte [rsi + 0x34], 0x40
je 0x21006f9fb
mov eax, dword [rsp + 0x50]
lea edx, [r13 + 1]
lea r15d, [rax - 1]
cmp edx, eax
jae 0x21006f178
mov eax, r15d
lea rdx, [r12 + r14 + 0x14]
mov rcx, rbp
sub eax, r13d
lea r8, [rax + rax*4]
shl r8, 2
call sym.msys_2.0.dll_memmove
jmp 0x21006f178
movzx ecx, word [rsp + 0x28]
cmp word [rax + 0x52a], cx
jne 0x21006f130
jmp 0x21006f2d4
mov ecx, dword [0x21024fa70]
mov r15, qword [rdi + 8]
call sym.acquire_attach_mutex_unsigned_int_
mov rdx, qword [rsp + 0x38]
mov rcx, r15
call sym.GetConsoleMode
mov edx, dword [rsp + 0x58]
mov rcx, r15
and edx, 0xfffffffb
call sym.SetConsoleMode
mov edx, dword [rsp + 0x58]
mov rcx, r15
call sym.SetConsoleMode
call sym.release_attach_mutex__
jmp 0x21006f154
mov rdx, rsi
mov ecx, r15d
call method.fhandler_termios.process_stop_start_char__tty_
test al, al
jne 0x21006f2d4
mov r15d, dword [rsp + 0x50]
add r13d, 1
jmp 0x21006f17d
mov eax, esi
mov rcx, r12
lea r14, [rax + rax*4]
shl r14, 2
mov rdx, r14
call sym.realloc_1
mov rdx, r14
mov r15, rax
test rax, rax
je 0x21006fa2b
mov rcx, qword [rsp + 0x30]
call sym.realloc_1
test rax, rax
je 0x21006fa23
mov rdx, qword [0x21034b1a0]
test byte [rdx + 0x13], 0x40
jne 0x21006f3f9
mov qword [rsp + 0x30], rax
mov r13d, esi
mov r12, r15
mov dword [rsp + 0x40], esi
jmp 0x21006efe3
mov rcx, qword [rdi + 0x10]
call sym.ReleaseMutex
nop
add rsp, 0x68
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov qword [rsp + 0x30], rax
mov r12, r15
mov dword [rsp + 0x40], esi
jmp 0x21006efe3
lea r15, [rsp + 0x54]
mov rsi, qword [rsp + 0x30]
mov qword [rsp + 0x28], r15
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov r8d, dword [rsp + 0x50]
mov dword [rsp + 0x54], 0
xor eax, eax
test r8d, r8d
je 0x21006f473
nop dword [rax + rax]
sub r8d, eax
mov rcx, qword [rdi]
lea rax, [rax + rax*4]
mov r9, rbp
cmp r8d, r13d
lea rdx, [r12 + rax*4]
cmova r8d, r13d
call sym.WriteConsoleInputW
mov r8d, dword [rsp + 0x50]
mov eax, dword [rsp + 0x58]
add eax, dword [rsp + 0x54]
mov dword [rsp + 0x54], eax
cmp eax, r8d
jb 0x21006f440
call sym.release_attach_mutex__
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov rdx, qword [rsp + 0x28]
mov rcx, qword [rdi]
call sym.GetNumberOfConsoleInputEvents
call sym.release_attach_mutex__
mov eax, dword [rsp + 0x54]
lea r14d, [rax + 0x80]
cmp r14d, dword [rsp + 0x40]
ja 0x21006f970
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov r9, qword [rsp + 0x28]
mov rcx, qword [rdi]
mov r8d, r13d
mov rdx, rsi
call sym.PeekConsoleInputW
call sym.release_attach_mutex__
mov eax, dword [rsp + 0x50]
cmp r13d, eax
cmovbe eax, r13d
cmp dword [rsp + 0x54], eax
jb 0x21006f535
test eax, eax
je 0x21006f535
sub eax, 1
mov r14, rsi
lea r8, [0x21028a830]
mov rcx, rsi
lea rax, [rax + rax*4]
lea r9, [r12 + rax*4 + 0x14]
mov rax, r12
nop
movzx edx, word [rax]
cmp dx, word [rcx]
jne 0x21006f55f
cmp dx, 0x10
ja case.0x21006f515.0
movsxd rdx, dword [r8 + rdx*4]
add rdx, r8
jmp rdx
mov edx, dword [rcx + 4]
cmp dword [rax + 4], edx
jne 0x21006f55f
add rax, 0x14
add rcx, 0x14
cmp rax, r9
jne 0x21006f500
mov qword [rsp + 0x30], rsi
jmp 0x21006f1d9
mov edx, dword [rcx + 4]
cmp dword [rax + 4], edx
jne 0x21006f55f
mov edx, dword [rcx + 8]
cmp dword [rax + 8], edx
jne 0x21006f55f
mov edx, dword [rcx + 0xc]
cmp dword [rax + 0xc], edx
jne 0x21006f55f
mov edx, dword [rcx + 0x10]
cmp dword [rax + 0x10], edx
je case.0x21006f515.0
mov ecx, dword [0x21024fa70]
call sym.acquire_attach_mutex_unsigned_int_
mov dword [rsp + 0x54], 0
mov r15d, dword [rsp + 0x40]
jmp 0x21006f5b1
mov eax, dword [rsp + 0x54]
cmp eax, r15d
jae 0x21006f5cf
mov r8d, r15d
mov rcx, qword [rdi]
mov r9, rbp
sub r8d, eax
lea rax, [rax + rax*4]
cmp r8d, r13d
lea rdx, [rsi + rax*4]
cmova r8d, r13d
call sym.ReadConsoleInputW
mov eax, dword [rsp + 0x58]
add dword [rsp + 0x54], eax
mov rcx, qword [rdi]
mov r8d, 5
mov rdx, rbp
mov qword [rsp + 0x58], 0
call sym.cygwait_void___LARGE_INTEGER__unsigned_int_
test eax, eax
je 0x21006f580
call sym.release_attach_mutex__
mov eax, dword [rsp + 0x54]
mov r11d, dword [rsp + 0x50]
mov dword [rsp + 0x38], eax
sub eax, r11d
mov dword [rsp + 0x30], eax
je 0x21006f7a2
mov r15d, dword [rsp + 0x30]
lea eax, [r11 - 1]
lea rax, [r15 + rax + 1]
lea r8, [r15 + r15*4]
lea rax, [rax + rax*4]
shl r8, 2
lea r10, [rsi + rax*4]
nop dword [rax]
mov r9d, r15d
test r11d, r11d
je 0x21006f6dd
lea rax, [rsi + r8]
mov rcx, r12
nop dword [rax + rax]
movzx edx, word [rcx]
cmp dx, word [rax]
jne 0x21006f790
cmp dx, 0x10
ja case.0x21006f645.0
movsxd rdx, dword [rbx + rdx*4]
add rdx, rbx
jmp rdx
mov edx, dword [rcx + 4]
cmp dword [rax + 4], edx
jne 0x21006f55f
movzx edx, word [rcx + 0xe]
cmp word [rax + 0xe], dx
jne 0x21006f55f
movzx edx, word [rcx + 8]
cmp word [rax + 8], dx
jne 0x21006f55f
add rax, 0x14
add rcx, 0x14
cmp rax, r9
jne 0x21006f500
jmp 0x21006f535
movzx edx, word [rcx + 4]
cmp word [rax + 4], dx
jne 0x21006f55f
movzx edx, word [rcx + 6]
cmp word [rax + 6], dx
jne 0x21006f55f
add rax, 0x14
add rcx, 0x14
cmp rax, r9
jne 0x21006f500
jmp 0x21006f535
mov edx, dword [rax + 4]
cmp dword [rcx + 4], edx
jne 0x21006f790
add rax, 0x14
add rcx, 0x14
cmp rax, r10
jne 0x21006f628
mov r14d, r11d
mov rdx, rsi
mov dword [rsp + 0x44], r9d
lea rax, [r14 + r14*4]
add r15, r14
lea rcx, [r12 + rax*4]
call sym.msys_2.0.dll_memcpy
mov eax, dword [rsp + 0x30]
mov r9d, dword [rsp + 0x44]
lea rdx, [r15 + r15*4]
shl rdx, 2
sub eax, r9d
lea rcx, [r12 + rdx]
add rdx, rsi
lea r8, [rax + rax*4]
shl r8, 2
call sym.msys_2.0.dll_memcpy
mov eax, dword [rsp + 0x38]
mov dword [rsp + 0x50], eax
jmp 0x21006f419
mov edx, dword [rax + 4]
cmp dword [rcx + 4], edx
jne 0x21006f790
mov edx, dword [rax + 8]
cmp dword [rcx + 8], edx
jne 0x21006f790
mov edx, dword [rax + 0xc]
cmp dword [rcx + 0xc], edx
jne 0x21006f790
mov edx, dword [rax + 0x10]
cmp dword [rcx + 0x10], edx
jne 0x21006f790
add rax, 0x14
add rcx, 0x14
cmp r10, rax
jne 0x21006f628
jmp 0x21006f6dd
mov edx, dword [rax + 4]
cmp dword [rcx + 4], edx
jne 0x21006f790
movzx edx, word [rax + 0xe]
cmp word [rcx + 0xe], dx
jne 0x21006f790
movzx edx, word [rax + 8]
cmp word [rcx + 8], dx
je 0x21006f750
nop dword [rax]
sub r8, 0x14
sub r10, 0x14
sub r15, 1
jne 0x21006f610
mov r15d, dword [rsp + 0x38]
mov r8d, r11d
xor r9d, r9d
lea rcx, [0x21028a8b8]
lea r10d, [r15 + r11]
test r15d, r15d
je 0x21006f720
cmp r11d, r9d
je 0x21006f857
nop word [rax + rax]
mov eax, r9d
lea rax, [rax + rax*4]
lea rdx, [r12 + rax*4]
movzx eax, word [rdx]
cmp ax, word [r14]
jne 0x21006f857
cmp ax, 0x10
ja case.0x21006f7f1.0
movsxd rax, dword [rcx + rax*4]
add rax, rcx
jmp rax
movzx edx, word [rax + 4]
cmp word [rcx + 4], dx
jne 0x21006f790
movzx edx, word [rax + 6]
cmp word [rcx + 6], dx
je 0x21006f750
sub r8, 0x14
sub r10, 0x14
sub r15, 1
jne 0x21006f610
jmp 0x21006f7a2
mov eax, dword [r14 + 4]
cmp dword [rdx + 4], eax
jne 0x21006f857
add r9d, 1
add r8d, 1
add r14, 0x14
cmp r10d, r8d
je 0x21006f720
cmp r11d, r9d
jne 0x21006f7d0
mov eax, r8d
sub eax, r9d
cmp r15d, eax
jbe 0x21006f8a1
movdqu xmm0, xmmword [r14]
mov edx, dword [r14 + 0x10]
lea rax, [rax + rax*4]
lea rax, [r12 + rax*4]
mov dword [rax + 0x10], edx
movups xmmword [rax], xmm0
jmp 0x21006f83d
movzx eax, word [r14 + 4]
cmp word [rdx + 4], ax
jne 0x21006f857
movzx eax, word [r14 + 6]
cmp word [rdx + 6], ax
je case.0x21006f7f1.0
mov eax, r8d
sub eax, r9d
cmp r15d, eax
ja 0x21006f862
mov ecx, dword [0x21024fa70]
mov qword [rsp + 0x30], rsi
xor esi, esi
call sym.acquire_attach_mutex_unsigned_int_
mov r8d, dword [rsp + 0x54]
mov r14, qword [rsp + 0x30]
test r8d, r8d
je 0x21006f8f5
nop word [rax + rax]
sub r8d, esi
mov eax, esi
mov rcx, qword [rdi]
mov r9, rbp
cmp r8d, r13d
lea rax, [rax + rax*4]
cmova r8d, r13d
lea rdx, [r14 + rax*4]
call sym.WriteConsoleInputW
mov r8d, dword [rsp + 0x54]
add esi, dword [rsp + 0x58]
cmp r8d, esi
ja 0x21006f8c8
call sym.release_attach_mutex__
jmp 0x21006f1d9
mov eax, dword [r14 + 4]
cmp dword [rdx + 4], eax
jne 0x21006f857
mov eax, dword [r14 + 8]
cmp dword [rdx + 8], eax
jne 0x21006f857
mov eax, dword [r14 + 0xc]
cmp dword [rdx + 0xc], eax
jne 0x21006f857
mov eax, dword [r14 + 0x10]
cmp dword [rdx + 0x10], eax
je case.0x21006f7f1.0
jmp 0x21006f857
mov eax, dword [r14 + 4]
cmp dword [rdx + 4], eax
jne 0x21006f857
movzx eax, word [r14 + 0xe]
cmp word [rdx + 0xe], ax
jne 0x21006f857
movzx eax, word [r14 + 8]
cmp word [rdx + 8], ax
je case.0x21006f7f1.0
jmp 0x21006f857
mov eax, r14d
mov rcx, r12
lea r15, [rax + rax*4]
shl r15, 2
mov rdx, r15
call sym.realloc_1
test rax, rax
je 0x21006fa49
mov rdx, r15
mov rcx, rsi
mov qword [rsp + 0x30], rax
call sym.realloc_1
mov r8, qword [rsp + 0x30]
test rax, rax
je 0x21006fa1b
mov rdx, qword [0x21034b1a0]
test byte [rdx + 0x13], 0x40
jne 0x21006f9eb
mov dword [rsp + 0x40], r14d
mov r13d, r14d
mov rsi, rax
mov r12, r8
jmp 0x21006f4ab
mov rcx, r12
call sym.free_1
mov rcx, qword [rsp + 0x30]
add rsp, 0x68
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.free_1
mov dword [rsp + 0x40], r14d
mov rsi, rax
mov r12, r8
jmp 0x21006f4ab
mov rax, qword [0x21024fa28]
mov r13d, dword [rsp + 0x44]
mov rbp, qword [rsp + 0x38]
mov dword [rax + 0x5a4], 0
jmp 0x21006f1d9
mov r12, r8
jmp 0x21006f4ab
mov r12, r15
jmp 0x21006efe3
mov rsi, qword [rsp + 0x30]
mov rcx, rsi
call sym.realloc_1
test rax, rax
cmove rax, rsi
mov qword [rsp + 0x30], rax
jmp 0x21006efe3
mov rcx, rsi
mov rdx, r15
call sym.realloc_1
test rax, rax
cmovne rsi, rax
jmp 0x21006f4ab