Function at 0x40d440
Capabilities:
Manipulate console buffer

Disassembly:
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x60
mov rbx, rdx
mov r12, 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 rsi, rax
je 0x40dec5
mov rcx, rbx
call sub.msvcrt.dll_fflush
lea rdx, [rsp + 0x30]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40d4e0
lea rdi, [0x0047128c]
movzx ebx, byte [r12]
test bl, bl
je 0x40d4e0
lea eax, [rbx - 0x80]
cmp eax, 0x1f
jbe 0x40d510
mov rdx, r12
jmp 0x40d4cb
sub eax, 0x40
cmp al, 0x1f
ja 0x40d4c0
test r8b, r8b
jne 0x40d660
lea eax, [rbx - 0x80]
mov rdx, rcx
cmp eax, 0x1f
jbe 0x40d513
cmp ebx, 0x1b
movzx ebx, byte [rdx + 1]
lea rcx, [rdx + 1]
sete r8b
test bl, bl
mov eax, ebx
jne 0x40d4b0
mov rcx, r12
call sub.msvcrt.dll_strlen
mov rdx, r12
mov r8, rax
mov rcx, rsi
call fcn.0040d200
mov eax, 1
add rsp, 0x60
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
ret
mov rcx, r12
sub ebx, 0x40
lea r13, [rcx + 1]
je 0x40d4e0
mov edx, 1
movzx eax, byte [r13]
test al, al
je 0x40d554
sub eax, 0x40
mov rbp, r13
cmp eax, 0x3e
ja 0x40d548
jmp 0x40d570
sub eax, 0x40
cmp eax, 0x3e
jbe 0x40d570
add rbp, 1
movzx eax, byte [rbp]
test al, al
jne 0x40d540
mov eax, 1
add rsp, 0x60
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
ret
movsxd rax, edx
mov r8, r13
mov rdx, r12
sub r8, rax
mov rcx, rsi
movzx ebx, bl
sub r8, r12
call fcn.0040d200
movzx eax, byte [rbp]
shl eax, 8
or ebx, eax
cmp bx, 0x465b
je 0x40db7b
jg 0x40d621
cmp bx, 0x435b
je 0x40db00
jg 0x40d670
cmp bx, 0x415b
je 0x40d754
cmp bx, 0x425b
jne 0x40d653
cmp r13, rbp
je 0x40de08
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov r12d, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx ecx, word [rsp + 0x46]
movsx edx, word [rsp + 0x42]
mov eax, ecx
mov ebx, edx
sub edx, ecx
add eax, r12d
cmp edx, r12d
jmp 0x40d7a6
cmp bx, 0x4a5b
je 0x40da73
jle 0x40d6f0
cmp bx, 0x665b
je 0x40d894
cmp bx, 0x6d5b
je 0x40d837
cmp bx, 0x4b5b
je 0x40d9c6
lea r12, [rbp + 1]
jmp 0x40d493
lea r13, [rdx + 2]
mov edx, 2
jmp 0x40d521
cmp bx, 0x445b
je 0x40d7c5
cmp bx, 0x455b
jne 0x40d653
cmp r13, rbp
je 0x40de43
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov r12d, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx ecx, word [rsp + 0x46]
movsx edx, word [rsp + 0x42]
mov eax, ecx
mov ebx, edx
sub edx, ecx
add eax, r12d
cmp edx, r12d
cmovg ebx, eax
mov rcx, rsi
shl ebx, 0x10
mov edx, ebx
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x40d653
cmp bx, 0x475b
jne 0x40d889
cmp r13, rbp
je 0x40ddcd
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov r12d, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
xor eax, eax
sub r12d, 1
movzx ebx, word [rsp + 0x46]
js 0x40db61
jmp 0x40ddeb
cmp r13, rbp
je 0x40ddfe
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov ebx, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx edx, word [rsp + 0x46]
mov eax, edx
sub eax, ebx
cmp edx, ebx
mov ebx, 0
cmovg ebx, eax
mov rcx, rsi
mov eax, ebx
movzx ebx, word [rsp + 0x44]
shl eax, 0x10
or ebx, eax
mov edx, ebx
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x40d653
cmp r13, rbp
je 0x40de94
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov ebx, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx edx, word [rsp + 0x44]
mov rcx, rsi
mov eax, edx
sub eax, ebx
cmp edx, ebx
mov ebx, 0
cmovg ebx, eax
movzx eax, word [rsp + 0x46]
movzx ebx, bx
shl eax, 0x10
or ebx, eax
mov edx, ebx
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x40d653
cmp r13, rbp
mov edx, 7
je 0x40d9b8
lea rbx, [rsp + 0x38]
xor r12d, r12d
xor r14d, r14d
mov rdx, rbx
mov r8d, 0xa
mov rcx, r13
call sub.msvcrt.dll_strtol
mov rdx, qword [rsp + 0x38]
cmp byte [rdx], 0x3b
je 0x40d874
cmp rdx, rbp
jne case.0x40d886.38
cmp eax, 0x31
ja case.0x40d886.2
mov ecx, eax
movsxd r8, dword [rdi + rcx*4]
add r8, rdi
jmp r8
cmp bx, 0x485b
jne 0x40d653
cmp r13, rbp
je 0x40dea8
mov r8, rbp
mov edx, 0x3b
mov rcx, r13
sub r8, r13
lea rbx, [rsp + 0x38]
call sub.msvcrt.dll_memchr
test rax, rax
mov r12, rax
mov r8d, 0xa
mov rdx, rbx
mov rcx, r13
je 0x40ddb0
call sub.msvcrt.dll_strtol
cmp r12, qword [rsp + 0x38]
mov r13d, eax
jne 0x40d653
lea rcx, [r12 + 1]
mov rdx, rbx
mov r8d, 0xa
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov ebx, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx eax, word [rsp + 0x4c]
movsx edx, word [rsp + 0x4a]
lea eax, [r13 + rax - 1]
lea ecx, [rbx + rdx - 1]
xor edx, edx
test eax, eax
js 0x40d93e
movsx r8d, word [rsp + 0x42]
mov edx, r8d
cmp eax, r8d
cmovle edx, eax
xor eax, eax
test ecx, ecx
js 0x40d953
movsx r8d, word [rsp + 0x40]
mov eax, r8d
cmp ecx, r8d
cmovle eax, ecx
shl edx, 0x10
movzx eax, ax
mov rcx, rsi
or eax, edx
mov edx, eax
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x40d653
or r14d, 7
mov r12d, 0xffffffff
lea r13, [rdx + 1]
cmp r13, rbp
jne 0x40d850
cmp r12w, 0xffff
jne 0x40dbd2
test r14w, 0x4000
movzx edx, r14w
je 0x40d9b8
mov eax, edx
shl edx, 4
and r14w, 0xbf00
sar eax, 4
mov ecx, eax
movzx eax, dl
and ecx, 0xf
or eax, ecx
or r14d, eax
movzx edx, r14w
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_SetConsoleTextAttribute]
jmp 0x40d653
cmp r13, rbp
je 0x40de13
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov r12d, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
test r12d, r12d
movzx ebx, word [rsp + 0x46]
je 0x40de2e
cmp r12d, 1
jne 0x40deb8
movsx r12d, word [rsp + 0x44]
xor eax, eax
add r12d, 1
mov edx, ebx
movzx ebx, ax
shl edx, 0x10
or ebx, edx
lea r13, [rsp + 0x34]
mov r9d, ebx
mov r8d, r12d
mov rcx, rsi
mov edx, 0x20
mov qword [rsp + 0x20], r13
call qword [sym.imp.KERNEL32.dll_FillConsoleOutputCharacterW]
movzx edx, word [rsp + 0x48]
mov qword [rsp + 0x20], r13
mov r9d, ebx
mov r8d, r12d
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_FillConsoleOutputAttribute]
jmp 0x40d653
cmp r13, rbp
je 0x40de58
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov ebx, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
cmp ebx, 1
je 0x40deeb
cmp ebx, 2
je 0x40deca
test ebx, ebx
je 0x40de6e
movsx edx, word [rsp + 0x42]
xor ecx, ecx
xor eax, eax
xor r8d, r8d
test edx, edx
js 0x40d653
movsx r12d, word [rsp + 0x40]
shl ecx, 0x10
movzx eax, ax
or eax, ecx
mov ebx, eax
imul edx, r12d
lea r12d, [rdx + r8]
jmp 0x40da37
cmp r13, rbp
je 0x40de9e
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov ebx, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx r8d, word [rsp + 0x44]
movsx ecx, word [rsp + 0x40]
mov edx, r8d
mov eax, ecx
sub ecx, r8d
add edx, ebx
cmp ecx, ebx
movzx ebx, word [rsp + 0x46]
cmovg eax, edx
mov edx, ebx
movzx ebx, ax
mov rcx, rsi
shl edx, 0x10
or ebx, edx
mov edx, ebx
call qword [sym.imp.KERNEL32.dll_SetConsoleCursorPosition]
jmp 0x40d653
cmp r13, rbp
je 0x40de4e
lea rbx, [rsp + 0x38]
mov r8d, 0xa
mov rcx, r13
mov rdx, rbx
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov ebx, eax
jne 0x40d653
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx edx, word [rsp + 0x46]
mov eax, edx
sub eax, ebx
cmp edx, ebx
mov ebx, 0
jmp 0x40d6d3
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d98d
mov eax, r12d
not eax
and ax, word [rsp + 0x48]
or r14d, eax
jmp 0x40d98d
lea r13, [rdx + 1]
and r14d, 0xffffff8f
or r12d, 0x70
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
and r14d, 0xffffff8f
sub eax, 0x28
lea r13, [rdx + 1]
mov ecx, r14d
or ecx, 0x40
test al, 1
cmovne r14d, ecx
mov ecx, r14d
or ecx, 0x20
test al, 2
cmovne r14d, ecx
mov ecx, r14d
or ecx, 0x10
test al, 4
cmovne r14d, ecx
or r12d, 0x70
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
or r14d, 7
or r12d, 7
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
and r14d, 0xfffffff8
sub eax, 0x1e
lea r13, [rdx + 1]
mov ecx, r14d
or ecx, 4
test al, 1
cmovne r14d, ecx
mov ecx, r14d
or ecx, 2
test al, 2
cmovne r14d, ecx
mov ecx, r14d
or ecx, 1
test al, 4
cmovne r14d, ecx
or r12d, 7
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
and r14w, 0xbfff
or r12w, 0x4000
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
and r14b, 0x7f
or r12b, 0x80
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
and r14w, 0x7fff
or r12w, 0x8000
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
and r14d, 0xfffffff7
or r12d, 8
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
or r14w, 0x4000
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
or r14b, 0x80
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
or r14w, 0x8000
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
lea r13, [rdx + 1]
or r14d, 8
cmp r13, rbp
jne 0x40d850
jmp case.0x40d886.38
call sub.msvcrt.dll_strtol
cmp qword [rsp + 0x38], rbp
mov r13d, eax
mov ebx, 1
jne 0x40d653
jmp 0x40d900
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movzx ebx, word [rsp + 0x46]
xor r12d, r12d
movsx edx, word [rsp + 0x40]
mov eax, edx
cmp edx, r12d
cmovge eax, r12d
jmp 0x40db61
mov ebx, 1
jmp 0x40d780
mov r12d, 1
jmp 0x40d5f4
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movzx ebx, word [rsp + 0x46]
movsx edx, word [rsp + 0x44]
movsx r12d, word [rsp + 0x40]
mov eax, edx
sub r12d, edx
jmp 0x40da2d
mov r12d, 1
jmp 0x40d6ab
mov ebx, 1
jmp 0x40dba7
lea rdx, [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
test eax, eax
je 0x40d653
movsx edx, word [rsp + 0x44]
movsx r8d, word [rsp + 0x40]
movsx r9d, word [rsp + 0x46]
mov eax, edx
sub r8d, edx
movsx edx, word [rsp + 0x50]
mov ecx, r9d
sub edx, r9d
jmp 0x40dadb
mov ebx, 1
jmp 0x40d7f1
mov ebx, 1
jmp 0x40db2c
mov ebx, 1
mov r13d, 1
jmp 0x40d900
movsx r12d, word [rsp + 0x40]
xor eax, eax
jmp 0x40da2d
jmp 0x40d4fb
movsx r8d, word [rsp + 0x4c]
movsx edx, word [rsp + 0x50]
movzx eax, word [rsp + 0x4a]
sub edx, r8d
mov ecx, r8d
xor r8d, r8d
add edx, 1
jmp 0x40dadb
movsx eax, word [rsp + 0x4c]
movsx r8d, word [rsp + 0x44]
movsx edx, word [rsp + 0x46]
mov ecx, eax
add r8d, 1
sub edx, eax
xor eax, eax
jmp 0x40dadb