// File: /workspace/github_c_makefile_star2_O0/odknt[P]st/st.c
// Function: tcontrolcode
void
tcontrolcode(uchar ascii)
{
	switch (ascii) {
	case '\t':   /* HT */
		tputtab(1);
		return;
	case '\b':   /* BS */
		tmoveto(term.c.x-1, term.c.y);
		return;
	case '\r':   /* CR */
		tmoveto(0, term.c.y);
		return;
	case '\f':   /* LF */
	case '\v':   /* VT */
	case '\n':   /* LF */
		/* go to first col if the mode is set */
		tnewline(IS_SET(MODE_CRLF));
		return;
	case '\a':   /* BEL */
		if (term.esc & ESC_STR_END) {
			/* backwards compatibility to xterm */
			strhandle();
		} else {
			xbell();
		}
		break;
	case '\033': /* ESC */
		csireset();
		term.esc &= ~(ESC_CSI|ESC_ALTCHARSET|ESC_TEST);
		term.esc |= ESC_START;
		return;
	case '\016': /* SO (LS1 -- Locking shift 1) */
	case '\017': /* SI (LS0 -- Locking shift 0) */
		term.charset = 1 - (ascii - '\016');
		return;
	case '\032': /* SUB */
		tsetchar('?', &term.c.attr, term.c.x, term.c.y);
		/* FALLTHROUGH */
	case '\030': /* CAN */
		csireset();
		break;
	case '\005': /* ENQ (IGNORED) */
	case '\000': /* NUL (IGNORED) */
	case '\021': /* XON (IGNORED) */
	case '\023': /* XOFF (IGNORED) */
	case 0177:   /* DEL (IGNORED) */
		return;
	case 0x80:   /* TODO: PAD */
	case 0x81:   /* TODO: HOP */
	case 0x82:   /* TODO: BPH */
	case 0x83:   /* TODO: NBH */
	case 0x84:   /* TODO: IND */
		break;
	case 0x85:   /* NEL -- Next line */
		tnewline(1); /* always go to first col */
		break;
	case 0x86:   /* TODO: SSA */
	case 0x87:   /* TODO: ESA */
		break;
	case 0x88:   /* HTS -- Horizontal tab stop */
		term.tabs[term.c.x] = 1;
		break;
	case 0x89:   /* TODO: HTJ */
	case 0x8a:   /* TODO: VTS */
	case 0x8b:   /* TODO: PLD */
	case 0x8c:   /* TODO: PLU */
	case 0x8d:   /* TODO: RI */
	case 0x8e:   /* TODO: SS2 */
	case 0x8f:   /* TODO: SS3 */
	case 0x91:   /* TODO: PU1 */
	case 0x92:   /* TODO: PU2 */
	case 0x93:   /* TODO: STS */
	case 0x94:   /* TODO: CCH */
	case 0x95:   /* TODO: MW */
	case 0x96:   /* TODO: SPA */
	case 0x97:   /* TODO: EPA */
	case 0x98:   /* TODO: SOS */
	case 0x99:   /* TODO: SGCI */
		break;
	case 0x9a:   /* DECID -- Identify Terminal */
		ttywrite(vtiden, strlen(vtiden), 0);
		break;
	case 0x9b:   /* TODO: CSI */
	case 0x9c:   /* TODO: ST */
		break;
	case 0x90:   /* DCS -- Device Control String */
	case 0x9d:   /* OSC -- Operating System Command */
	case 0x9e:   /* PM -- Privacy Message */
	case 0x9f:   /* APC -- Application Program Command */
		tstrsequence(ascii);
		return;
	}
	/* only CAN, SUB, \a and C1 chars interrupt a sequence */
	term.esc &= ~(ESC_STR_END|ESC_STR);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
movzbl -0x1(%rbp), %eax
movq %rax, -0x10(%rbp)
subq $0x9f, %rax
ja 0xadae
movq -0x10(%rbp), %rax
leaq 0x93b3(%rip), %rcx      # 0x14010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, %edi
callq 0xbf30
jmp 0xadbd
movl 0x1541d(%rip), %edi     # 0x20098
subl $0x1, %edi
movl 0x15418(%rip), %esi     # 0x2009c
callq 0x97e0
jmp 0xadbd
movl 0x15408(%rip), %esi     # 0x2009c
xorl %edi, %edi
callq 0x97e0
jmp 0xadbd
movl 0x1540e(%rip), %eax     # 0x200b4
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %edi
callq 0xbcd0
jmp 0xadbd
movl 0x153f4(%rip), %eax     # 0x200b8
andl $0x10, %eax
cmpl $0x0, %eax
je 0xacd3
callq 0xc080
jmp 0xacd8
callq 0xf890
jmp 0xadae
callq 0xc430
movl 0x153d0(%rip), %eax     # 0x200b8
andl $-0x2b, %eax
movl %eax, 0x153c7(%rip)     # 0x200b8
movl 0x153c1(%rip), %eax     # 0x200b8
orl $0x1, %eax
movl %eax, 0x153b8(%rip)     # 0x200b8
jmp 0xadbd
movzbl -0x1(%rbp), %ecx
subl $0xe, %ecx
movl $0x1, %eax
subl %ecx, %eax
movl %eax, 0x153a7(%rip)     # 0x200c0
jmp 0xadbd
movl 0x15374(%rip), %edx     # 0x20098
movl 0x15372(%rip), %ecx     # 0x2009c
movl $0x3f, %edi
leaq 0x114aa(%rip), %rsi     # 0x1c1e0
addq $0x3ea8, %rsi           # imm = 0x3EA8
callq 0xbd40
callq 0xc430
jmp 0xadae
jmp 0xadbd
jmp 0xadae
movl $0x1, %edi
callq 0xbcd0
jmp 0xadae
jmp 0xadae
movq 0x15366(%rip), %rax     # 0x200c8
movslq 0x1532f(%rip), %rcx     # 0x20098
movl $0x1, (%rax,%rcx,4)
jmp 0xadae
jmp 0xadae
leaq 0xea0d(%rip), %rax      # 0x19788
movq (%rax), %rax
movq %rax, -0x18(%rbp)
leaq 0xe9ff(%rip), %rax      # 0x19788
movq (%rax), %rdi
callq 0x6410
movq -0x18(%rbp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x8350
jmp 0xadae
jmp 0xadae
movzbl -0x1(%rbp), %edi
callq 0xc450
jmp 0xadbd
movl 0x15304(%rip), %eax     # 0x200b8
andl $-0x15, %eax
movl %eax, 0x152fb(%rip)     # 0x200b8
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)