// File: /workspace/github_c_makefile_star2_O0/odknt[P]st/st.c
// Function: tsetattr
void
tsetattr(const int *attr, int l)
{
	int i;
	int32_t idx;

	for (i = 0; i < l; i++) {
		switch (attr[i]) {
		case 0:
			term.c.attr.mode &= ~(
				ATTR_BOLD       |
				ATTR_FAINT      |
				ATTR_ITALIC     |
				ATTR_UNDERLINE  |
				ATTR_BLINK      |
				ATTR_REVERSE    |
				ATTR_INVISIBLE  |
				ATTR_STRUCK     );
			term.c.attr.fg = defaultfg;
			term.c.attr.bg = defaultbg;
			break;
		case 1:
			term.c.attr.mode |= ATTR_BOLD;
			break;
		case 2:
			term.c.attr.mode |= ATTR_FAINT;
			break;
		case 3:
			term.c.attr.mode |= ATTR_ITALIC;
			break;
		case 4:
			term.c.attr.mode |= ATTR_UNDERLINE;
			break;
		case 5: /* slow blink */
			/* FALLTHROUGH */
		case 6: /* rapid blink */
			term.c.attr.mode |= ATTR_BLINK;
			break;
		case 7:
			term.c.attr.mode |= ATTR_REVERSE;
			break;
		case 8:
			term.c.attr.mode |= ATTR_INVISIBLE;
			break;
		case 9:
			term.c.attr.mode |= ATTR_STRUCK;
			break;
		case 22:
			term.c.attr.mode &= ~(ATTR_BOLD | ATTR_FAINT);
			break;
		case 23:
			term.c.attr.mode &= ~ATTR_ITALIC;
			break;
		case 24:
			term.c.attr.mode &= ~ATTR_UNDERLINE;
			break;
		case 25:
			term.c.attr.mode &= ~ATTR_BLINK;
			break;
		case 27:
			term.c.attr.mode &= ~ATTR_REVERSE;
			break;
		case 28:
			term.c.attr.mode &= ~ATTR_INVISIBLE;
			break;
		case 29:
			term.c.attr.mode &= ~ATTR_STRUCK;
			break;
		case 38:
			if ((idx = tdefcolor(attr, &i, l)) >= 0)
				term.c.attr.fg = idx;
			break;
		case 39:
			term.c.attr.fg = defaultfg;
			break;
		case 48:
			if ((idx = tdefcolor(attr, &i, l)) >= 0)
				term.c.attr.bg = idx;
			break;
		case 49:
			term.c.attr.bg = defaultbg;
			break;
		default:
			if (BETWEEN(attr[i], 30, 37)) {
				term.c.attr.fg = attr[i] - 30;
			} else if (BETWEEN(attr[i], 40, 47)) {
				term.c.attr.bg = attr[i] - 40;
			} else if (BETWEEN(attr[i], 90, 97)) {
				term.c.attr.fg = attr[i] - 90 + 8;
			} else if (BETWEEN(attr[i], 100, 107)) {
				term.c.attr.bg = attr[i] - 100 + 8;
			} else {
				fprintf(stderr,
					"erresc(default): gfx attr %d unknown\n",
					attr[i]);
				csidump();
			}
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xda2b
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x20(%rbp)
subq $0x31, %rax
ja 0xd907
movq -0x20(%rbp), %rax
leaq 0x6f32(%rip), %rcx      # 0x14638
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x12976(%rip), %eax     # 0x2008c
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
movw %ax, 0x1296a(%rip)      # 0x2008c
leaq 0xc083(%rip), %rax      # 0x197ac
movl (%rax), %eax
movl %eax, 0x1295f(%rip)     # 0x20090
leaq 0xc078(%rip), %rax      # 0x197b0
movl (%rax), %eax
movl %eax, 0x12954(%rip)     # 0x20094
jmp 0xda1b
movzwl 0x12940(%rip), %eax     # 0x2008c
orl $0x1, %eax
movw %ax, 0x12936(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x1292a(%rip), %eax     # 0x2008c
orl $0x2, %eax
movw %ax, 0x12920(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x12914(%rip), %eax     # 0x2008c
orl $0x4, %eax
movw %ax, 0x1290a(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x128fe(%rip), %eax     # 0x2008c
orl $0x8, %eax
movw %ax, 0x128f4(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x128e8(%rip), %eax     # 0x2008c
orl $0x10, %eax
movw %ax, 0x128de(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x128d2(%rip), %eax     # 0x2008c
orl $0x20, %eax
movw %ax, 0x128c8(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x128bc(%rip), %eax     # 0x2008c
orl $0x40, %eax
movw %ax, 0x128b2(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x128a6(%rip), %eax     # 0x2008c
orl $0x80, %eax
movw %ax, 0x1289a(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x1288e(%rip), %eax     # 0x2008c
andl $-0x4, %eax
movw %ax, 0x12884(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x12878(%rip), %eax     # 0x2008c
andl $-0x5, %eax
movw %ax, 0x1286e(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x12862(%rip), %eax     # 0x2008c
andl $-0x9, %eax
movw %ax, 0x12858(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x1284c(%rip), %eax     # 0x2008c
andl $-0x11, %eax
movw %ax, 0x12842(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x12836(%rip), %eax     # 0x2008c
andl $-0x21, %eax
movw %ax, 0x1282c(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x12820(%rip), %eax     # 0x2008c
andl $-0x41, %eax
movw %ax, 0x12816(%rip)      # 0x2008c
jmp 0xda1b
movzwl 0x1280a(%rip), %eax     # 0x2008c
andl $0xffffff7f, %eax       # imm = 0xFFFFFF7F
movw %ax, 0x127fe(%rip)      # 0x2008c
jmp 0xda1b
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x10(%rbp), %rsi
callq 0xda40
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0xd8b4
movl -0x14(%rbp), %eax
movl %eax, 0x127dc(%rip)     # 0x20090
jmp 0xda1b
leaq 0xbeec(%rip), %rax      # 0x197ac
movl (%rax), %eax
movl %eax, 0x127c8(%rip)     # 0x20090
jmp 0xda1b
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x10(%rbp), %rsi
callq 0xda40
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0xd8ee
movl -0x14(%rbp), %eax
movl %eax, 0x127a6(%rip)     # 0x20094
jmp 0xda1b
leaq 0xbeb6(%rip), %rax      # 0x197b0
movl (%rax), %eax
movl %eax, 0x12792(%rip)     # 0x20094
jmp 0xda1b
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
movl $0x1e, %eax
cmpl (%rcx,%rdx,4), %eax
jg 0xd940
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
cmpl $0x25, (%rax,%rcx,4)
jg 0xd940
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1e, %eax
movl %eax, 0x12755(%rip)     # 0x20090
jmp 0xda19
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
movl $0x28, %eax
cmpl (%rcx,%rdx,4), %eax
jg 0xd979
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
cmpl $0x2f, (%rax,%rcx,4)
jg 0xd979
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x28, %eax
movl %eax, 0x12720(%rip)     # 0x20094
jmp 0xda17
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
movl $0x5a, %eax
cmpl (%rcx,%rdx,4), %eax
jg 0xd9b2
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
cmpl $0x61, (%rax,%rcx,4)
jg 0xd9b2
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x5a, %eax
addl $0x8, %eax
movl %eax, 0x126e0(%rip)     # 0x20090
jmp 0xda15
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
movl $0x64, %eax
cmpl (%rcx,%rdx,4), %eax
jg 0xd9eb
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
cmpl $0x6b, (%rax,%rcx,4)
jg 0xd9eb
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x64, %eax
addl $0x8, %eax
movl %eax, 0x126ab(%rip)     # 0x20094
jmp 0xda13
movq 0xb5fe(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x72c2(%rip), %rsi      # 0x14cc9
movb $0x0, %al
callq 0x69d0
callq 0xcaf0
jmp 0xda15
jmp 0xda17
jmp 0xda19
jmp 0xda1b
jmp 0xda1d
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xd6d6
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)