Function at 0x409030
Capabilities:
Manipulate console buffer

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x78
mov rsi, rdx
mov r13, rcx
mov rcx, rdx
call qword [sym.imp.msvcrt.dll__fileno]
mov ecx, eax
call qword [sym.imp.msvcrt.dll__get_osfhandle]
cmp rax, 0xffffffffffffffff
mov rbx, rax
je 0x409b6d
mov rcx, rsi
call sub.msvcrt.dll_fflush
lea rdx, [rsp + 0x40]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x4090e3
mov rax, qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
mov qword [rsp + 0x38], rax
mov rdi, rax
nop dword [rax]
movzx r14d, byte [r13]
test r14b, r14b
je 0x4090e3
lea eax, [r14 - 0x80]
cmp eax, 0x1f
jbe 0x40910f
mov rdx, r13
jmp 0x4090cb
sub eax, 0x40
cmp al, 0x1f
ja 0x4090bf
test cl, cl
jne 0x4092d0
lea eax, [r14 - 0x80]
mov rdx, r9
cmp eax, 0x1f
jbe 0x409112
cmp r14d, 0x1b
movzx r14d, byte [rdx + 1]
lea r9, [rdx + 1]
sete cl
test r14b, r14b
mov eax, r14d
jne 0x4090b0
mov rcx, r13
call sub.msvcrt.dll_strlen
mov rdx, r13
mov r8, rax
mov rcx, rbx
call fcn.00408de0
mov eax, 1
add rsp, 0x78
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov r9, r13
sub r14d, 0x40
lea rsi, [r9 + 1]
je 0x4090e3
mov edx, 1
movzx eax, byte [rsi]
test al, al
je 0x40914a
sub eax, 0x40
mov r12, rsi
cmp eax, 0x3e
ja 0x40913d
jmp 0x409151
sub eax, 0x40
cmp eax, 0x3e
jbe 0x409151
add r12, 1
movzx eax, byte [r12]
test al, al
jne 0x409135
mov eax, 1
jmp 0x4090fe
movsxd rax, edx
mov r8, rsi
mov rdx, r13
sub r8, rax
mov rcx, rbx
movzx r14d, r14b
sub r8, r13
call fcn.00408de0
movzx eax, byte [r12]
shl eax, 8
or r14d, eax
cmp r14w, 0x465b
je 0x409511
jg 0x4091f0
cmp r14w, 0x435b
je 0x409611
jg 0x4092e0
cmp r14w, 0x415b
je 0x4093f7
cmp r14w, 0x425b
jne 0x4091e0
cmp rsi, r12
je 0x4099bc
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
je 0x4099c2
nop dword [rax + rax]
lea r13, [r12 + 1]
jmp 0x409090
cmp r14w, 0x4a5b
je 0x409587
jle 0x409370
cmp r14w, 0x665b
je 0x4096a2
cmp r14w, 0x6d5b
je 0x409454
cmp r14w, 0x4b5b
jne 0x4091e0
cmp rsi, r12
je 0x409a6a
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
test r13d, r13d
je 0x409a81
cmp r13d, 1
je 0x409a34
movzx edx, word [rsp + 0x56]
movsx r14d, word [rsp + 0x50]
xor eax, eax
shl edx, 0x10
lea r15, [rsp + 0x44]
movzx eax, ax
or eax, edx
mov r8d, r14d
mov edx, 0x20
mov r13d, eax
mov r9d, eax
mov rcx, rbx
mov qword [rsp + 0x20], r15
call qword [sym.imp.KERNEL32.dll_FillConsoleOutputCharacterW]
movzx edx, word [rsp + 0x58]
mov r9d, r13d
mov qword [rsp + 0x20], r15
mov r8d, r14d
mov rcx, rbx
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_FillConsoleOutputAttribute]
jmp 0x409090
lea rsi, [rdx + 2]
mov edx, 2
jmp 0x409121
cmp r14w, 0x445b
je 0x409780
cmp r14w, 0x455b
jne 0x4091e0
cmp rsi, r12
je 0x409a4a
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r14d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx ecx, word [rsp + 0x56]
movsx edx, word [rsp + 0x52]
mov eax, ecx
mov r13d, edx
sub edx, ecx
add eax, r14d
cmp edx, r14d
mov rcx, rbx
cmovg r13d, eax
shl r13d, 0x10
mov edx, r13d
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x409090
cmp r14w, 0x475b
jne 0x409696
cmp rsi, r12
je 0x409af6
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
xor eax, eax
sub r13d, 1
movzx edx, word [rsp + 0x56]
js 0x4093da
movsx ecx, word [rsp + 0x50]
mov eax, ecx
cmp ecx, r13d
cmovge eax, r13d
shl edx, 0x10
movzx eax, ax
mov rcx, rbx
or eax, edx
lea r13, [r12 + 1]
mov edx, eax
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x409090
cmp rsi, r12
je 0x409ae0
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx edx, word [rsp + 0x56]
mov eax, edx
sub eax, r13d
cmp edx, r13d
mov edx, 0
cmovle eax, edx
jmp 0x4099f4
cmp rsi, r12
je 0x409a55
lea rbp, [rsp + 0x48]
lea r14, [0x0045dc28]
xor r15d, r15d
xor r13d, r13d
nop
mov r8d, 0xa
mov rdx, rbp
mov rcx, rsi
call sub.msvcrt.dll_strtol
mov r9, qword [rsp + 0x48]
cmp byte [r9], 0x3b
je 0x409491
cmp r9, r12
jne case.0x40949f.38
cmp eax, 0x31
ja case.0x40949f.2
mov edx, eax
movsxd rdx, dword [r14 + rdx*4]
add rdx, r14
jmp rdx
or r13d, 7
or r15d, 7
lea rsi, [r9 + 1]
cmp rsi, r12
jne 0x409470
cmp r15w, 0xffff
je 0x4094d3
lea rdx, [rsp + 0x50]
mov rcx, rbx
call rdi
test eax, eax
je 0x4094d3
not r15d
and r15w, word [rsp + 0x58]
or r13d, r15d
test r13w, 0x4000
movzx edx, r13w
je 0x4094fe
mov eax, edx
shl edx, 4
sar eax, 4
mov ecx, eax
movzx eax, dl
mov edx, r13d
and ecx, 0xf
and dx, 0xbf00
or eax, ecx
or edx, eax
movzx edx, dx
mov rcx, rbx
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_SetConsoleTextAttribute]
jmp 0x409090
cmp rsi, r12
je 0x409ad5
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r14d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx edx, word [rsp + 0x56]
mov rcx, rbx
mov eax, edx
sub eax, r14d
cmp edx, r14d
mov r13d, eax
mov eax, 0
cmovle r13d, eax
shl r13d, 0x10
mov edx, r13d
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x409090
cmp rsi, r12
je 0x409a9b
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
cmp r13d, 1
je 0x409b4f
cmp r13d, 2
je 0x409b2a
test r13d, r13d
je 0x409ab1
movsx edx, word [rsp + 0x52]
xor r13d, r13d
xor eax, eax
xor ecx, ecx
test edx, edx
js 0x4091e0
movsx r14d, word [rsp + 0x50]
imul edx, r14d
lea r14d, [rdx + rcx]
mov edx, r13d
jmp 0x40927d
cmp rsi, r12
je 0x409a5f
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx r8d, word [rsp + 0x54]
movsx ecx, word [rsp + 0x50]
mov edx, r8d
mov eax, ecx
sub ecx, r8d
add edx, r13d
cmp ecx, r13d
movzx r13d, word [rsp + 0x56]
cmovg eax, edx
mov rcx, rbx
movzx eax, ax
shl r13d, 0x10
or r13d, eax
mov edx, r13d
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x409090
cmp r14w, 0x485b
jne 0x4091e0
cmp rsi, r12
je 0x409b19
mov r8, r12
mov edx, 0x3b
mov rcx, rsi
sub r8, rsi
lea rbp, [rsp + 0x48]
call sub.msvcrt.dll_memchr
test rax, rax
mov r13, rax
mov r8d, 0xa
mov rdx, rbp
mov rcx, rsi
je 0x409a16
call sub.msvcrt.dll_strtol
cmp r13, qword [rsp + 0x48]
mov r14d, eax
jne 0x4091e0
lea rcx, [r13 + 1]
mov r8d, 0xa
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r13d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx eax, word [rsp + 0x5c]
lea edx, [r14 + rax - 1]
movsx eax, word [rsp + 0x5a]
lea ecx, [r13 + rax - 1]
xor eax, eax
test edx, edx
js 0x40974d
movsx r8d, word [rsp + 0x52]
mov eax, r8d
cmp edx, r8d
cmovle eax, edx
test ecx, ecx
js 0x409b48
movsx r8d, word [rsp + 0x50]
mov edx, r8d
cmp ecx, r8d
cmovle edx, ecx
shl eax, 0x10
movzx edx, dx
mov rcx, rbx
or edx, eax
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x4091e0
cmp rsi, r12
je 0x409aeb
lea rbp, [rsp + 0x48]
mov r8d, 0xa
mov rcx, rsi
mov rdx, rbp
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r14d, eax
jne 0x4091e0
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx edx, word [rsp + 0x54]
mov rcx, rbx
mov eax, edx
sub eax, r14d
cmp edx, r14d
movzx r13d, ax
mov eax, 0
cmovle r13d, eax
movzx eax, word [rsp + 0x56]
shl eax, 0x10
or r13d, eax
mov edx, r13d
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x409090
lea rsi, [r9 + 1]
and r13d, 0xffffff8f
or r15d, 0x70
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
and r13d, 0xffffff8f
sub eax, 0x28
lea rsi, [r9 + 1]
mov edx, r13d
or edx, 0x40
test al, 1
cmovne r13d, edx
mov edx, r13d
or edx, 0x20
test al, 2
cmovne r13d, edx
mov edx, r13d
or edx, 0x10
test al, 4
cmovne r13d, edx
or r15d, 0x70
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
and r13d, 0xfffffff8
sub eax, 0x1e
lea rsi, [r9 + 1]
mov edx, r13d
or edx, 4
test al, 1
cmovne r13d, edx
mov edx, r13d
or edx, 2
test al, 2
cmovne r13d, edx
mov edx, r13d
or edx, 1
test al, 4
cmovne r13d, edx
or r15d, 7
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
and r13w, 0xbfff
or r15w, 0x4000
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
and r13b, 0x7f
or r15b, 0x80
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
and r13w, 0x7fff
or r15w, 0x8000
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
and r13d, 0xfffffff7
or r15d, 8
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
or r13w, 0x4000
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
or r13b, 0x80
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
or r13w, 0x8000
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
or r13d, 8
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
lea rsi, [r9 + 1]
or r13d, 7
mov r15d, 0xffffffff
cmp rsi, r12
jne 0x409470
jmp case.0x40949f.38
mov r13d, 1
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx r8d, word [rsp + 0x56]
movsx ecx, word [rsp + 0x52]
mov edx, r8d
mov eax, ecx
sub ecx, r8d
add edx, r13d
cmp ecx, r13d
cmovg eax, edx
movzx r13d, word [rsp + 0x54]
shl eax, 0x10
mov rcx, rbx
or r13d, eax
mov edx, r13d
lea r13, [r12 + 1]
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x409090
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x48], r12
mov r14d, eax
mov r13d, 1
jne 0x4091e0
jmp 0x40970e
movsx r14d, word [rsp + 0x54]
movzx edx, word [rsp + 0x56]
xor eax, eax
add r14d, 1
jmp 0x40927d
mov r14d, 1
jmp 0x409325
mov edx, 7
jmp 0x4094fe
mov r13d, 1
jmp 0x40963e
lea rdx, [rsp + 0x50]
mov rcx, rbx
mov rax, qword [rsp + 0x38]
call rax
test eax, eax
je 0x4091e0
movsx ecx, word [rsp + 0x54]
movsx r14d, word [rsp + 0x50]
movzx edx, word [rsp + 0x56]
mov eax, ecx
sub r14d, ecx
jmp 0x40927d
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movsx edx, word [rsp + 0x54]
movsx ecx, word [rsp + 0x50]
movsx r8d, word [rsp + 0x56]
mov eax, edx
sub ecx, edx
movsx edx, word [rsp + 0x60]
mov r13d, r8d
sub edx, r8d
jmp 0x4095f3
mov r14d, 1
jmp 0x40953e
mov r13d, 1
jmp 0x409424
mov r14d, 1
jmp 0x4097ad
lea rdx, [rsp + 0x50]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x4091e0
movzx edx, word [rsp + 0x56]
xor r13d, r13d
jmp 0x4093cc
mov r13d, 1
mov r14d, 1
jmp 0x40970e
movsx ecx, word [rsp + 0x5c]
movsx edx, word [rsp + 0x60]
movzx eax, word [rsp + 0x5a]
sub edx, ecx
mov r13d, ecx
xor ecx, ecx
add edx, 1
jmp 0x4095f3
xor edx, edx
jmp 0x409764
movsx eax, word [rsp + 0x5c]
movsx ecx, word [rsp + 0x54]
movsx edx, word [rsp + 0x56]
mov r13d, eax
add ecx, 1
sub edx, eax
xor eax, eax
jmp 0x4095f3
jmp 0x4090fe