Function at 0x40e040
Capabilities:
Manipulate console buffer

Disassembly:
push ebp
mov ebp, esp
push edi
mov edi, ecx
push esi
push ebx
sub esp, 0x5c
mov esi, dword [ebp + 8]
cmp byte [ecx], 0
je 0x40e1d8
mov dword [esp], 0x520d9b
call fcn.00428c00
mov eax, dword [ebp + 0xc]
test eax, eax
je 0x40e0b2
mov eax, esi
call fcn.0040ddb0
lea eax, [ebp - 0x39]
mov dword [esp + 4], eax
lea ecx, [ebp - 0x30]
mov dword [esp], 0x520d99
call fcn.004e0d80
lea eax, [ebp - 0x30]
sub esp, 8
call fcn.0040ddb0
mov eax, dword [ebp - 0x30]
lea ebx, [eax - 0xc]
cmp ebx, 0x51af30
jne 0x40e281
mov byte [edi + 1], 1
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret 8
lea eax, [ebp - 0x30]
mov dword [esp + 4], eax
mov eax, dword [edi + 4]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
movsx eax, word [ebp - 0x30]
sub esp, 8
mov dword [esp + 8], eax
lea eax, [ebp - 0x38]
mov dword [esp], eax
mov dword [esp + 4], esi
call fcn.0040dde0
lea eax, [ebp - 0x38]
mov ecx, esi
mov dword [esp], eax
call fcn.004df8e0
mov eax, dword [ebp - 0x38]
lea ebx, [eax - 0xc]
sub esp, 4
cmp ebx, 0x51af30
jne 0x40e2a4
movzx edx, word [ebp - 0x30]
movzx ecx, word [ebp - 0x2c]
movzx eax, word [ebp - 0x2a]
mov dword [ebp - 0x50], 0x10000
movsx ebx, dx
mov word [ebp - 0x38], cx
test ebx, ebx
lea ecx, [edx + ecx - 1]
mov word [ebp - 0x50], dx
mov word [ebp - 0x36], ax
mov word [ebp - 0x34], cx
mov word [ebp - 0x32], ax
mov dword [ebp - 0x4c], 0
jne 0x40e240
xor ebx, ebx
test dx, dx
mov eax, dword [ebp - 0x4c]
je 0x40e18b
mov dword [ebp - 0x54], edi
mov edi, esi
mov esi, eax
nop
mov edx, dword [edi]
mov ecx, 0x20
cmp ebx, dword [edx - 0xc]
jae 0x40e170
mov ecx, dword [edx - 4]
test ecx, ecx
js 0x40e16c
mov ecx, edi
call fcn.004df030
mov edx, dword [edi]
movzx ecx, byte [edx + ebx]
mov byte [esi], cl
movzx edx, word [ebp - 0x28]
add ebx, 1
add esi, 4
mov word [esi - 2], dx
movsx edx, word [ebp - 0x30]
cmp edx, ebx
ja 0x40e150
mov edi, dword [ebp - 0x54]
lea eax, [ebp - 0x38]
mov esi, dword [ebp - 0x4c]
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x50]
mov dword [esp + 0xc], 0
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov eax, dword [edi + 4]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_WriteConsoleOutputW]
mov byte [edi + 1], 0
sub esp, 0x14
test esi, esi
je 0x40e0a8
mov eax, dword [ebp - 0x4c]
mov dword [esp], eax
call fcn.005108c0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret 8
lea ecx, [ebp - 0x30]
mov dword [esp], esi
call fcn.004e0e20
lea ecx, [ebp - 0x30]
sub esp, 4
mov dword [esp + 4], 1
mov dword [esp], 0x520d99
call fcn.004dfb20
lea eax, [ebp - 0x30]
sub esp, 8
call fcn.0040ddb0
mov eax, dword [ebp - 0x30]
lea ebx, [eax - 0xc]
cmp ebx, 0x51af30
je 0x40e0a8
sub eax, 4
call fcn.00512bc8
test eax, eax
jg 0x40e0a8
lea eax, [ebp - 0x38]
mov ecx, ebx
mov dword [esp], eax
call fcn.004df650
push eax
jmp 0x40e0a8
cmp ebx, 0x3fffffff
ja 0x40e27c
lea eax, [ebx*4]
mov dword [esp], eax
call fcn.00510970
mov dword [ebp - 0x4c], eax
lea esi, [esi]
xor edx, edx
xor ecx, ecx
mov word [eax], dx
add eax, 4
mov word [eax - 2], cx
sub ebx, 1
jne 0x40e260
movzx edx, word [ebp - 0x30]
jmp 0x40e13e
call fcn.0050b040
sub eax, 4
call fcn.00512bc8
test eax, eax
jg 0x40e0a4
lea eax, [ebp - 0x38]
mov ecx, ebx
mov dword [esp], eax
call fcn.004df650
push eax
jmp 0x40e0a4
sub eax, 4
call fcn.00512bc8
test eax, eax
nop
jg 0x40e101
lea eax, [ebp - 0x39]
mov ecx, ebx
mov dword [esp], eax
call fcn.004df650
push ebx
jmp 0x40e101