// File: JD297[P]cedit/src/cedit.cpp
// Function: cedit::Cedit::run()
void Cedit::run()
{
	while(this->isrunning)
	{
		if(this->refreshDisplay)
			this->display();
		else
			this->display_current_line();

		this->refreshDisplay = true;

		this->key = wgetch(this->wcontent);

		switch(this->key)
		{
			case 19:
				this->event_save();
			break;
			case 15:
				this->event_open();
			break;
			case 27:
				this->isrunning = false;
				endwin();
			break;
			case KEY_BACKSPACE:
				this->event_backspace();
			break;
			case KEY_DC:
				this->event_delete();
			break;
			case KEY_LEFT:
				this->event_left();
			break;
			case KEY_RIGHT:
				this->event_right();
			break;
			case KEY_UP:
				this->event_up();
			break;
			case KEY_DOWN:
				this->event_down();
			break;
			case KEY_NPAGE:
				this->event_pagedown();
			break;
			case KEY_PPAGE:
				this->event_pageup();
			break;
			case KEY_HOME:
				this->event_pos1();
			break;
			case KEY_END:
				this->event_end();
			break;
			case 12:
				this->event_toggle_linenumbers();
			break;
			case 7:
				this->event_goto();
			break;
			case 20:
				this->event_change_tab();
			break;
			default:
				this->event_write();
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x6e(%rax)
je 0x4f00
movq -0x10(%rbp), %rax
testb $0x1, 0x6c(%rax)
je 0x4d17
movq -0x10(%rbp), %rdi
callq 0x4f10
jmp 0x4d20
movq -0x10(%rbp), %rdi
callq 0x5260
movq -0x10(%rbp), %rax
movb $0x1, 0x6c(%rax)
movq 0xa8(%rax), %rdi
callq 0x41d0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x68(%rax)
movl 0x68(%rax), %eax
movl %eax, -0x14(%rbp)
subl $0x7, %eax
je 0x4edc
jmp 0x4d4e
movl -0x14(%rbp), %eax
subl $0xc, %eax
je 0x4ed1
jmp 0x4d5c
movl -0x14(%rbp), %eax
subl $0xf, %eax
je 0x4e3d
jmp 0x4d6a
movl -0x14(%rbp), %eax
subl $0x13, %eax
je 0x4e2f
jmp 0x4d78
movl -0x14(%rbp), %eax
subl $0x14, %eax
je 0x4ee7
jmp 0x4d86
movl -0x14(%rbp), %eax
subl $0x1b, %eax
je 0x4e4b
jmp 0x4d94
movl -0x14(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x4e9a
jmp 0x4da4
movl -0x14(%rbp), %eax
subl $0x103, %eax            # imm = 0x103
je 0x4e8f
jmp 0x4db4
movl -0x14(%rbp), %eax
subl $0x104, %eax            # imm = 0x104
je 0x4e79
jmp 0x4dc4
movl -0x14(%rbp), %eax
subl $0x105, %eax            # imm = 0x105
je 0x4e84
jmp 0x4dd4
movl -0x14(%rbp), %eax
subl $0x106, %eax            # imm = 0x106
je 0x4ebb
jmp 0x4de4
movl -0x14(%rbp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x4e5d
jmp 0x4df0
movl -0x14(%rbp), %eax
subl $0x14a, %eax            # imm = 0x14A
je 0x4e6b
jmp 0x4dfc
movl -0x14(%rbp), %eax
subl $0x152, %eax            # imm = 0x152
je 0x4ea5
jmp 0x4e0c
movl -0x14(%rbp), %eax
subl $0x153, %eax            # imm = 0x153
je 0x4eb0
jmp 0x4e1c
movl -0x14(%rbp), %eax
subl $0x168, %eax            # imm = 0x168
je 0x4ec6
jmp 0x4ef2
movq -0x10(%rbp), %rdi
callq 0x5720
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x5d10
jmp 0x4efb
movq -0x10(%rbp), %rax
movb $0x0, 0x6e(%rax)
callq 0x4540
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x5d80
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6180
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x64d0
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x65b0
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6720
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x67f0
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6960
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6a90
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6b40
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6b70
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6c50
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6c70
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x6e40
jmp 0x4efb
movq -0x10(%rbp), %rdi
callq 0x7000
jmp 0x4cf4
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)