// File: /workspace/github_c_makefile_star2_O0/impact-eintr[P]st/x.c
// Function: kpress
void
kpress(XEvent *ev)
{
	XKeyEvent *e = &ev->xkey;
	KeySym ksym;
	char buf[64], *customkey;
	int len;
	Rune c;
	Status status;
	Shortcut *bp;

	if (IS_SET(MODE_KBDLOCK))
		return;

	if (xw.ime.xic)
		len = XmbLookupString(xw.ime.xic, e, buf, sizeof buf, &ksym, &status);
	else
		len = XLookupString(e, buf, sizeof buf, &ksym, NULL);
	/* 1. shortcuts */
	for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
		if (ksym == bp->keysym && match(bp->mod, e->state)) {
			bp->func(&(bp->arg));
			return;
		}
	}

	/* 2. custom keys from config.h */
	if ((customkey = kmap(ksym, e->state))) {
		ttywrite(customkey, strlen(customkey), 1);
		return;
	}

	/* 3. composed string from input method */
	if (len == 0)
		return;
	if (len == 1 && e->state & Mod1Mask) {
		if (IS_SET(MODE_8BIT)) {
			if (*buf < 0177) {
				c = *buf | 0x80;
				len = utf8encode(c, buf);
			}
		} else {
			buf[1] = buf[0];
			buf[0] = '\033';
			len = 2;
		}
	}
	ttywrite(buf, len, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl 0xc67b(%rip), %eax      # 0x1c3a8
andl $0x40, %eax
cmpl $0x0, %eax
je 0xfd3a
jmp 0xfeae
cmpq $0x0, 0xc58e(%rip)      # 0x1c2d0
je 0xfd6a
movq 0xc585(%rip), %rdi      # 0x1c2d0
movq -0x10(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movl $0x40, %ecx
leaq -0x18(%rbp), %r8
leaq -0x74(%rbp), %r9
callq 0x5730
movl %eax, -0x6c(%rbp)
jmp 0xfd88
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movl $0x40, %edx
leaq -0x18(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x5150
movl %eax, -0x6c(%rbp)
leaq 0x8361(%rip), %rax      # 0x180f0
movq %rax, -0x80(%rbp)
leaq 0x8356(%rip), %rax      # 0x180f0
addq $0x180, %rax            # imm = 0x180
cmpq %rax, -0x80(%rbp)
jae 0xfdf2
movq -0x18(%rbp), %rax
movq -0x80(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0xfde2
movq -0x80(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movl 0x50(%rax), %esi
callq 0x108d0
cmpl $0x0, %eax
je 0xfde2
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x80(%rbp), %rdi
addq $0x18, %rdi
callq *%rax
jmp 0xfeae
jmp 0xfde4
movq -0x80(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x80(%rbp)
jmp 0xfd93
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x50(%rax), %esi
callq 0x10910
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0xfe36
movq -0x68(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x68(%rbp), %rdi
callq 0x5370
movq -0x88(%rbp), %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x6fa0
jmp 0xfeae
cmpl $0x0, -0x6c(%rbp)
jne 0xfe3e
jmp 0xfeae
cmpl $0x1, -0x6c(%rbp)
jne 0xfe9c
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xfe9c
movl 0xc54f(%rip), %eax      # 0x1c3a8
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0xfe89
movsbl -0x60(%rbp), %eax
cmpl $0x7f, %eax
jge 0xfe87
movsbl -0x60(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %edi
leaq -0x60(%rbp), %rsi
callq 0x5be0
movl %eax, -0x6c(%rbp)
jmp 0xfe9a
movb -0x60(%rbp), %al
movb %al, -0x5f(%rbp)
movb $0x1b, -0x60(%rbp)
movl $0x2, -0x6c(%rbp)
jmp 0xfe9c
leaq -0x60(%rbp), %rdi
movslq -0x6c(%rbp), %rsi
movl $0x1, %edx
callq 0x6fa0
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)