// File: /workspace/github_c_makefile_star2_O0/odknt[P]st/st.c
// Function: eschandle
int
eschandle(uchar ascii)
{
	switch (ascii) {
	case '[':
		term.esc |= ESC_CSI;
		return 0;
	case '#':
		term.esc |= ESC_TEST;
		return 0;
	case '%':
		term.esc |= ESC_UTF8;
		return 0;
	case 'P': /* DCS -- Device Control String */
	case '_': /* APC -- Application Program Command */
	case '^': /* PM -- Privacy Message */
	case ']': /* OSC -- Operating System Command */
	case 'k': /* old title set compatibility */
		tstrsequence(ascii);
		return 0;
	case 'n': /* LS2 -- Locking shift 2 */
	case 'o': /* LS3 -- Locking shift 3 */
		term.charset = 2 + (ascii - 'n');
		break;
	case '(': /* GZD4 -- set primary charset G0 */
	case ')': /* G1D4 -- set secondary charset G1 */
	case '*': /* G2D4 -- set tertiary charset G2 */
	case '+': /* G3D4 -- set quaternary charset G3 */
		term.icharset = ascii - '(';
		term.esc |= ESC_ALTCHARSET;
		return 0;
	case 'D': /* IND -- Linefeed */
		if (term.c.y == term.bot) {
			tscrollup(term.top, 1, 1);
		} else {
			tmoveto(term.c.x, term.c.y+1);
		}
		break;
	case 'E': /* NEL -- Next line */
		tnewline(1); /* always go to first col */
		break;
	case 'H': /* HTS -- Horizontal tab stop */
		term.tabs[term.c.x] = 1;
		break;
	case 'M': /* RI -- Reverse index */
		if (term.c.y == term.top) {
			tscrolldown(term.top, 1, 1);
		} else {
			tmoveto(term.c.x, term.c.y-1);
		}
		break;
	case 'Z': /* DECID -- Identify Terminal */
		ttywrite(vtiden, strlen(vtiden), 0);
		break;
	case 'c': /* RIS -- Reset to initial state */
		treset();
		resettitle();
		xloadcols();
		break;
	case '=': /* DECPAM -- Application keypad */
		xsetmode(1, MODE_APPKEYPAD);
		break;
	case '>': /* DECPNM -- Normal keypad */
		xsetmode(0, MODE_APPKEYPAD);
		break;
	case '7': /* DECSC -- Save Cursor */
		tcursor(CURSOR_SAVE);
		break;
	case '8': /* DECRC -- Restore Cursor */
		tcursor(CURSOR_LOAD);
		break;
	case '\\': /* ST -- String Terminator */
		if (term.esc & ESC_STR_END)
			strhandle();
		break;
	default:
		fprintf(stderr, "erresc: unknown sequence ESC 0x%02X '%c'\n",
			(uchar) ascii, isprint(ascii)? ascii:'.');
		break;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dil, %al
movb %al, -0x5(%rbp)
movzbl -0x5(%rbp), %eax
addl $-0x23, %eax
movl %eax, %ecx
movq %rcx, -0x10(%rbp)
subl $0x4c, %eax
ja 0xbc5d
movq -0x10(%rbp), %rax
leaq 0x8981(%rip), %rcx      # 0x14400
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x1462a(%rip), %eax     # 0x200b8
orl $0x2, %eax
movl %eax, 0x14621(%rip)     # 0x200b8
movl $0x0, -0x4(%rbp)
jmp 0xbcc1
movl 0x1460f(%rip), %eax     # 0x200b8
orl $0x20, %eax
movl %eax, 0x14606(%rip)     # 0x200b8
movl $0x0, -0x4(%rbp)
jmp 0xbcc1
movl 0x145f4(%rip), %eax     # 0x200b8
orl $0x40, %eax
movl %eax, 0x145eb(%rip)     # 0x200b8
movl $0x0, -0x4(%rbp)
jmp 0xbcc1
movzbl -0x5(%rbp), %edi
callq 0xc450
movl $0x0, -0x4(%rbp)
jmp 0xbcc1
movzbl -0x5(%rbp), %eax
subl $0x6e, %eax
addl $0x2, %eax
movl %eax, 0x145c2(%rip)     # 0x200c0
jmp 0xbcba
movzbl -0x5(%rbp), %eax
subl $0x28, %eax
movl %eax, 0x145b4(%rip)     # 0x200c4
movl 0x145a2(%rip), %eax     # 0x200b8
orl $0x8, %eax
movl %eax, 0x14599(%rip)     # 0x200b8
movl $0x0, -0x4(%rbp)
jmp 0xbcc1
movl 0x1456b(%rip), %eax     # 0x2009c
cmpl 0x14579(%rip), %eax     # 0x200b0
jne 0xbb4d
movl 0x1456d(%rip), %edi     # 0x200ac
movl $0x1, %edx
movl %edx, %esi
callq 0xcd50
jmp 0xbb61
movl 0x14545(%rip), %edi     # 0x20098
movl 0x14543(%rip), %esi     # 0x2009c
addl $0x1, %esi
callq 0x97e0
jmp 0xbcba
movl $0x1, %edi
callq 0xbcd0
jmp 0xbcba
movq 0x1454c(%rip), %rax     # 0x200c8
movslq 0x14515(%rip), %rcx     # 0x20098
movl $0x1, (%rax,%rcx,4)
jmp 0xbcba
movl 0x14507(%rip), %eax     # 0x2009c
cmpl 0x14511(%rip), %eax     # 0x200ac
jne 0xbbb1
movl 0x14509(%rip), %edi     # 0x200ac
movl $0x1, %edx
movl %edx, %esi
callq 0xcec0
jmp 0xbbc5
movl 0x144e1(%rip), %edi     # 0x20098
movl 0x144df(%rip), %esi     # 0x2009c
subl $0x1, %esi
callq 0x97e0
jmp 0xbcba
leaq 0xdbb7(%rip), %rax      # 0x19788
movq (%rax), %rax
movq %rax, -0x18(%rbp)
leaq 0xdba9(%rip), %rax      # 0x19788
movq (%rax), %rdi
callq 0x6410
movq -0x18(%rbp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x8350
jmp 0xbcba
callq 0x8f60
callq 0x9bd0
callq 0xdda0
jmp 0xbcba
movl $0x1, %edi
movl $0x4, %esi
callq 0xf7f0
jmp 0xbcba
xorl %edi, %edi
movl $0x4, %esi
callq 0xf7f0
jmp 0xbcba
xorl %edi, %edi
callq 0x9af0
jmp 0xbcba
movl $0x1, %edi
callq 0x9af0
jmp 0xbcba
movl 0x1446a(%rip), %eax     # 0x200b8
andl $0x10, %eax
cmpl $0x0, %eax
je 0xbc5b
callq 0xc080
jmp 0xbcba
movq 0xd38c(%rip), %rax      # 0x18ff0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movzbl -0x5(%rbp), %eax
movl %eax, -0x1c(%rbp)
callq 0x6460
movq (%rax), %rax
movzbl -0x5(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0xbc98
movzbl -0x5(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0xbca2
movl $0x2e, %eax
movl %eax, -0x2c(%rbp)
jmp 0xbca2
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %ecx
leaq 0x90e9(%rip), %rsi      # 0x14d9c
movb $0x0, %al
callq 0x69d0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)