// File: /workspace/github_c_makefile_star2_O0/uobikiemukot[P]yaft/./terminal.h
// Function: addch
void addch(struct terminal_t *term, uint32_t code)
{
	int width;
	const struct glyph_t *glyphp;

	logging(DEBUG, "addch: U+%.4X\n", code);

	width = wcwidth(code);

	if (width <= 0)                                /* zero width: not support combining characters */
		return;
	else if (0x100000 <= code && code <= 0x10FFFD) /* unicode private area: plane 16 (DRCSMMv1) */
		glyphp = drcs_glyph(term, code);
	else if (code >= UCS2_CHARS                    /* yaft support only UCS2 */
		|| term->glyph[code] == NULL           /* missing glyph */
		|| term->glyph[code]->width != width)  /* width unmatched */
		glyphp = (width == 1) ? term->glyph[SUBSTITUTE_HALF]: term->glyph[SUBSTITUTE_WIDE];
	else
		glyphp = term->glyph[code];

	if ((term->wrap_occurred && term->cursor.x == term->cols - 1) /* folding */
		|| (glyphp->width == WIDE && term->cursor.x == term->cols - 1)) {
		set_cursor(term, term->cursor.y, 0);
		move_cursor(term, 1, 0);
	}
	term->wrap_occurred = false;

	move_cursor(term, 0, set_cell(term, term->cursor.y, term->cursor.x, glyphp));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl -0xc(%rbp), %edx
xorl %edi, %edi
leaq 0x50cf1(%rip), %rsi     # 0x55cbc
movb $0x0, %al
callq 0x2450
movl -0xc(%rbp), %edi
callq 0x21e0
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jg 0x4fe8
jmp 0x5127
movl $0x100000, %eax         # imm = 0x100000
cmpl -0xc(%rbp), %eax
ja 0x500d
cmpl $0x10fffd, -0xc(%rbp)   # imm = 0x10FFFD
ja 0x500d
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x4f00
movq %rax, -0x18(%rbp)
jmp 0x5085
cmpl $0x10000, -0xc(%rbp)    # imm = 0x10000
jae 0x5040
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
cmpq $0x0, 0x488(%rax,%rcx,8)
je 0x5040
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movq 0x488(%rax,%rcx,8), %rax
movzbl 0x4(%rax), %eax
cmpl -0x10(%rbp), %eax
je 0x5070
cmpl $0x1, -0x10(%rbp)
jne 0x5057
movq -0x8(%rbp), %rax
movq 0x588(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x5066
movq -0x8(%rbp), %rax
movq 0x18488(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x5083
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movq 0x488(%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
jmp 0x5085
jmp 0x5087
movq -0x8(%rbp), %rax
testb $0x1, 0x3c(%rax)
je 0x50a7
movq -0x8(%rbp), %rax
movzwl 0x24(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x50ca
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x2, %eax
jne 0x50ed
movq -0x8(%rbp), %rax
movzwl 0x24(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x50ed
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movzwl 0x26(%rax), %esi
xorl %edx, %edx
callq 0x4e10
movq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x4cd0
movq -0x8(%rbp), %rax
movb $0x0, 0x3c(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movzwl 0x26(%rax), %esi
movq -0x8(%rbp), %rax
movzwl 0x24(%rax), %edx
movq -0x18(%rbp), %rcx
callq 0x4880
movq -0x28(%rbp), %rdi
movl %eax, %edx
xorl %esi, %esi
callq 0x4cd0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)