// File: /workspace/github_c_makefile_star2_O0/odknt[P]st/st.c
// Function: tsetchar
void
tsetchar(Rune u, const Glyph *attr, int x, int y)
{
	static const char *vt100_0[62] = { /* 0x41 - 0x7e */
		"↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */
		0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
		0, 0, 0, 0, 0, 0, 0, 0, /* P - W */
		0, 0, 0, 0, 0, 0, 0, " ", /* X - _ */
		"◆", "▒", "␉", "␌", "␍", "␊", "°", "±", /* ` - g */
		"␤", "␋", "┘", "┐", "┌", "└", "┼", "⎺", /* h - o */
		"⎻", "─", "⎼", "⎽", "├", "┤", "┴", "┬", /* p - w */
		"│", "≤", "≥", "π", "≠", "£", "·", /* x - ~ */
	};

	/*
	 * The table is proudly stolen from rxvt.
	 */
	if (term.trantbl[term.charset] == CS_GRAPHIC0 &&
	   BETWEEN(u, 0x41, 0x7e) && vt100_0[u - 0x41])
		utf8decode(vt100_0[u - 0x41], &u, UTF_SIZ);

	if (term.line[y][x].mode & ATTR_WIDE) {
		if (x+1 < term.col) {
			term.line[y][x+1].u = ' ';
			term.line[y][x+1].mode &= ~ATTR_WDUMMY;
		}
	} else if (term.line[y][x].mode & ATTR_WDUMMY) {
		term.line[y][x-1].u = ' ';
		term.line[y][x-1].mode &= ~ATTR_WIDE;
	}

	term.dirty[y] = 1;
	term.line[y][x] = *attr;
	term.line[y][x].u = u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movslq 0x14364(%rip), %rcx     # 0x200c0
leaq 0x1047d(%rip), %rax     # 0x1c1e0
movsbl 0x3edc(%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xbdbb
movl $0x41, %eax
cmpl -0x4(%rbp), %eax
ja 0xbdbb
cmpl $0x7e, -0x4(%rbp)
ja 0xbdbb
movl -0x4(%rbp), %eax
subl $0x41, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0xd7ff(%rip), %rax      # 0x19590
cmpq $0x0, (%rax,%rcx,8)
je 0xbdbb
movl -0x4(%rbp), %eax
subl $0x41, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0xd7e7(%rip), %rax      # 0x19590
movq (%rax,%rcx,8), %rdi
leaq -0x4(%rbp), %rsi
movl $0x4, %edx
callq 0xa550
movq 0x10426(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0xbe45
movl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl 0x103f5(%rip), %eax     # 0x1c1e4
jge 0xbe43
movq 0x103f0(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl $0x20, (%rax)
movq 0x103cb(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %ecx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
movw %cx, 0x4(%rax)
jmp 0xbec1
movq 0x1039c(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0xbebf
movq 0x10374(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl $0x20, (%rax)
movq 0x1034f(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movw %cx, 0x4(%rax)
jmp 0xbec1
movq 0x141b8(%rip), %rax     # 0x20080
movslq -0x18(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movq 0x1030e(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movl -0x4(%rbp), %ecx
movq 0x102df(%rip), %rax     # 0x1c1e8
movslq -0x18(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x14(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)