// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_HandleKey
int OSD_HandleKey(int sc, int press)
{
	if (!osdinited) return sc;
	if (!osdvisible) return sc;

	if (!press) {
		if (sc == 42 || sc == 54) // shift
			osdeditshift = 0;
		if (sc == 29 || sc == 157)	// control
			osdeditcontrol = 0;
		if (sc == 56 || sc == 184)	// alt
			osdeditalt = 0;
		return 0;
	}

	keytime = gettime();

	if (sc != 15) lastmatch = NULL;		// reset tab-completion cycle

	switch (sc) {
		case 1:		// escape
			OSD_ShowDisplay(0); break;
		case 211:	// delete
			OSD_Manipulate(OSDOP_DELETE); break;
		case 199:	// home
			if (osdeditcontrol) {
				OSD_Manipulate(OSDOP_SCROLL_TOP);
			} else {
				OSD_Manipulate(OSDOP_START);
			}
			break;
		case 207:	// end
			if (osdeditcontrol) {
				OSD_Manipulate(OSDOP_SCROLL_BOTTOM);
			} else {
				OSD_Manipulate(OSDOP_END);
			}
			break;
		case 201:	// page up
			OSD_Manipulate(OSDOP_PAGE_UP); break;
		case 209:	// page down
			OSD_Manipulate(OSDOP_PAGE_DOWN); break;
		case 200:	// up
			OSD_Manipulate(OSDOP_HISTORY_UP); break;
		case 208:	// down
			OSD_Manipulate(OSDOP_HISTORY_DOWN); break;
		case 203:	// left
			if (osdeditcontrol) {
				OSD_Manipulate(OSDOP_LEFT_WORD);
			} else {
				OSD_Manipulate(OSDOP_LEFT);
			}
			break;
		case 205:	// right
			if (osdeditcontrol) {
				OSD_Manipulate(OSDOP_RIGHT_WORD);
			} else {
				OSD_Manipulate(OSDOP_RIGHT);
			}
			break;
		case 33:	// f
			if (osdeditalt) {
				OSD_Manipulate(OSDOP_RIGHT_WORD);
			}
			break;
		case 48:	// b
			if (osdeditalt) {
				OSD_Manipulate(OSDOP_LEFT_WORD);
			}
			break;
		case 210:	// insert
			osdovertype ^= 1; break;
		case 58:	// capslock
			osdeditcaps ^= 1; break;
		case 42:
		case 54:	// shift
			osdeditshift = 1; break;
		case 29:
		case 157:	// control
			osdeditcontrol = 1; break;
		case 56:
		case 184:	// alt
			osdeditalt = 1; break;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpb $0x0, 0x579723(%rip)    # 0x5e7298
jne 0x6db82
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6de91
cmpb $0x0, 0x57d723(%rip)    # 0x5eb2ac
jne 0x6db96
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6de91
cmpl $0x0, -0xc(%rbp)
jne 0x6dbf0
cmpl $0x2a, -0x8(%rbp)
je 0x6dba8
cmpl $0x36, -0x8(%rbp)
jne 0x6dbb2
movl $0x0, 0x57d6fe(%rip)    # 0x5eb2b0
cmpl $0x1d, -0x8(%rbp)
je 0x6dbc1
cmpl $0x9d, -0x8(%rbp)
jne 0x6dbcb
movl $0x0, 0x57d6e9(%rip)    # 0x5eb2b4
cmpl $0x38, -0x8(%rbp)
je 0x6dbda
cmpl $0xb8, -0x8(%rbp)
jne 0x6dbe4
movl $0x0, 0x57d6d4(%rip)    # 0x5eb2b8
movl $0x0, -0x4(%rbp)
jmp 0x6de91
callq *0x736f2(%rip)          # 0xe12e8
movl %eax, 0x57d6c0(%rip)    # 0x5eb2bc
cmpl $0xf, -0x8(%rbp)
je 0x6dc0d
movq $0x0, 0x57d6b3(%rip) # 0x5eb2c0
movl -0x8(%rbp), %eax
movl %eax, -0x10(%rbp)
subl $0x1, %eax
je 0x6dd3b
jmp 0x6dc1e
movl -0x10(%rbp), %eax
subl $0x1d, %eax
je 0x6de74
jmp 0x6dc2c
movl -0x10(%rbp), %eax
subl $0x21, %eax
je 0x6de1c
jmp 0x6dc3a
movl -0x10(%rbp), %eax
subl $0x2a, %eax
je 0x6de68
jmp 0x6dc48
movl -0x10(%rbp), %eax
subl $0x30, %eax
je 0x6de31
jmp 0x6dc56
movl -0x10(%rbp), %eax
subl $0x36, %eax
je 0x6de68
jmp 0x6dc64
movl -0x10(%rbp), %eax
subl $0x38, %eax
je 0x6de80
jmp 0x6dc72
movl -0x10(%rbp), %eax
subl $0x3a, %eax
je 0x6de57
jmp 0x6dc80
movl -0x10(%rbp), %eax
subl $0x9d, %eax
je 0x6de74
jmp 0x6dc90
movl -0x10(%rbp), %eax
subl $0xb8, %eax
je 0x6de80
jmp 0x6dca0
movl -0x10(%rbp), %eax
subl $0xc7, %eax
je 0x6dd56
jmp 0x6dcb0
movl -0x10(%rbp), %eax
subl $0xc8, %eax
je 0x6ddb9
jmp 0x6dcc0
movl -0x10(%rbp), %eax
subl $0xc9, %eax
je 0x6dd9b
jmp 0x6dcd0
movl -0x10(%rbp), %eax
subl $0xcb, %eax
je 0x6ddd7
jmp 0x6dce0
movl -0x10(%rbp), %eax
subl $0xcd, %eax
je 0x6ddfb
jmp 0x6dcf0
movl -0x10(%rbp), %eax
subl $0xcf, %eax
je 0x6dd77
jmp 0x6dcfc
movl -0x10(%rbp), %eax
subl $0xd0, %eax
je 0x6ddc8
jmp 0x6dd0c
movl -0x10(%rbp), %eax
subl $0xd1, %eax
je 0x6ddaa
jmp 0x6dd1c
movl -0x10(%rbp), %eax
subl $0xd2, %eax
je 0x6de46
jmp 0x6dd2c
movl -0x10(%rbp), %eax
subl $0xd3, %eax
je 0x6dd47
jmp 0x6de8a
xorl %edi, %edi
callq 0x6dea0
jmp 0x6de8a
movl $0x7, %edi
callq 0x6cde0
jmp 0x6de8a
cmpl $0x0, 0x57d557(%rip)    # 0x5eb2b4
je 0x6dd6b
movl $0x10, %edi
callq 0x6cde0
jmp 0x6dd72
xorl %edi, %edi
callq 0x6cde0
jmp 0x6de8a
cmpl $0x0, 0x57d536(%rip)    # 0x5eb2b4
je 0x6dd8c
movl $0x11, %edi
callq 0x6cde0
jmp 0x6dd96
movl $0x1, %edi
callq 0x6cde0
jmp 0x6de8a
movl $0x12, %edi
callq 0x6cde0
jmp 0x6de8a
movl $0x13, %edi
callq 0x6cde0
jmp 0x6de8a
movl $0xe, %edi
callq 0x6cde0
jmp 0x6de8a
movl $0xf, %edi
callq 0x6cde0
jmp 0x6de8a
cmpl $0x0, 0x57d4d6(%rip)    # 0x5eb2b4
je 0x6ddec
movl $0x3, %edi
callq 0x6cde0
jmp 0x6ddf6
movl $0x2, %edi
callq 0x6cde0
jmp 0x6de8a
cmpl $0x0, 0x57d4b2(%rip)    # 0x5eb2b4
je 0x6de10
movl $0x5, %edi
callq 0x6cde0
jmp 0x6de1a
movl $0x4, %edi
callq 0x6cde0
jmp 0x6de8a
cmpl $0x0, 0x57d495(%rip)    # 0x5eb2b8
je 0x6de2f
movl $0x5, %edi
callq 0x6cde0
jmp 0x6de8a
cmpl $0x0, 0x57d480(%rip)    # 0x5eb2b8
je 0x6de44
movl $0x3, %edi
callq 0x6cde0
jmp 0x6de8a
movl 0x57d47c(%rip), %eax    # 0x5eb2c8
xorl $0x1, %eax
movl %eax, 0x57d473(%rip)    # 0x5eb2c8
jmp 0x6de8a
movl 0x57d46f(%rip), %eax    # 0x5eb2cc
xorl $0x1, %eax
movl %eax, 0x57d466(%rip)    # 0x5eb2cc
jmp 0x6de8a
movl $0x1, 0x57d43e(%rip)    # 0x5eb2b0
jmp 0x6de8a
movl $0x1, 0x57d436(%rip)    # 0x5eb2b4
jmp 0x6de8a
movl $0x1, 0x57d42e(%rip)    # 0x5eb2b8
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)