// File: /workspace/github_c_makefile_star2_O0/impact-eintr[P]st/x.c
// Function: mousereport
void
mousereport(XEvent *e)
{
	int len, x = evcol(e), y = evrow(e),
	    button = e->xbutton.button, state = e->xbutton.state;
	char buf[40];
	static int ox, oy;

	/* from urxvt */
	if (e->xbutton.type == MotionNotify) {
		if (x == ox && y == oy)
			return;
		if (!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
			return;
		/* MOUSE_MOTION: no reporting if no button is pressed */
		if (IS_SET(MODE_MOUSEMOTION) && oldbutton == 3)
			return;

		button = oldbutton + 32;
		ox = x;
		oy = y;
	} else {
		if (!IS_SET(MODE_MOUSESGR) && e->xbutton.type == ButtonRelease) {
			button = 3;
		} else {
			button -= Button1;
			if (button >= 7)
				button += 128 - 7;
			else if (button >= 3)
				button += 64 - 3;
		}
		if (e->xbutton.type == ButtonPress) {
			oldbutton = button;
			ox = x;
			oy = y;
		} else if (e->xbutton.type == ButtonRelease) {
			oldbutton = 3;
			/* MODE_MOUSEX10: no button release reporting */
			if (IS_SET(MODE_MOUSEX10))
				return;
			if (button == 64 || button == 65)
				return;
		}
	}

	if (!IS_SET(MODE_MOUSEX10)) {
		button += ((state & ShiftMask  ) ? 4  : 0)
			+ ((state & Mod4Mask   ) ? 8  : 0)
			+ ((state & ControlMask) ? 16 : 0);
	}

	if (IS_SET(MODE_MOUSESGR)) {
		len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c",
				button, x+1, y+1,
				e->xbutton.type == ButtonRelease ? 'm' : 'M');
	} else if (x < 223 && y < 223) {
		len = snprintf(buf, sizeof(buf), "\033[M%c%c%c",
				32+button, 32+x+1, 32+y+1);
	} else {
		return;
	}

	ttywrite(buf, len, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x11060
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x110d0
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x54(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x10dae
movl -0x10(%rbp), %eax
cmpl 0xb736(%rip), %eax      # 0x1c470
jne 0x10d4c
movl -0x14(%rbp), %eax
cmpl 0xb72f(%rip), %eax      # 0x1c474
jne 0x10d4c
jmp 0x10f6c
movl 0xb656(%rip), %eax      # 0x1c3a8
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x10d6f
movl 0xb648(%rip), %eax      # 0x1c3a8
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
jne 0x10d6f
jmp 0x10f6c
movl 0xb633(%rip), %eax      # 0x1c3a8
andl $0x10, %eax
cmpl $0x0, %eax
je 0x10d8b
cmpl $0x3, 0x8f28(%rip)      # 0x19cac
jne 0x10d8b
jmp 0x10f6c
movl 0x8f1b(%rip), %eax      # 0x19cac
addl $0x20, %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %eax
movl %eax, 0xb6d0(%rip)      # 0x1c470
movl -0x14(%rbp), %eax
movl %eax, 0xb6cb(%rip)      # 0x1c474
jmp 0x10e62
movl 0xb5f4(%rip), %eax      # 0x1c3a8
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x10dd0
movq -0x8(%rbp), %rax
cmpl $0x5, (%rax)
jne 0x10dd0
movl $0x3, -0x18(%rbp)
jmp 0x10dfd
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x7, -0x18(%rbp)
jl 0x10dea
movl -0x18(%rbp), %eax
addl $0x79, %eax
movl %eax, -0x18(%rbp)
jmp 0x10dfb
cmpl $0x3, -0x18(%rbp)
jl 0x10df9
movl -0x18(%rbp), %eax
addl $0x3d, %eax
movl %eax, -0x18(%rbp)
jmp 0x10dfb
jmp 0x10dfd
movq -0x8(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x10e23
movl -0x18(%rbp), %eax
movl %eax, 0x8e9d(%rip)      # 0x19cac
movl -0x10(%rbp), %eax
movl %eax, 0xb658(%rip)      # 0x1c470
movl -0x14(%rbp), %eax
movl %eax, 0xb653(%rip)      # 0x1c474
jmp 0x10e60
movq -0x8(%rbp), %rax
cmpl $0x5, (%rax)
jne 0x10e5e
movl $0x3, 0x8e76(%rip)      # 0x19cac
movl 0xb56c(%rip), %eax      # 0x1c3a8
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x10e4b
jmp 0x10f6c
cmpl $0x40, -0x18(%rbp)
je 0x10e57
cmpl $0x41, -0x18(%rbp)
jne 0x10e5c
jmp 0x10f6c
jmp 0x10e5e
jmp 0x10e60
jmp 0x10e62
movl 0xb540(%rip), %eax      # 0x1c3a8
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0x10eb5
movl -0x1c(%rbp), %edx
andl $0x1, %edx
xorl %eax, %eax
movl $0x4, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl -0x1c(%rbp), %esi
andl $0x40, %esi
xorl %ecx, %ecx
movl $0x8, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movl -0x1c(%rbp), %esi
andl $0x4, %esi
xorl %ecx, %ecx
movl $0x10, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl 0xb4ed(%rip), %eax      # 0x1c3a8
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x10f0d
leaq -0x50(%rbp), %rdi
movl -0x18(%rbp), %ecx
movl -0x10(%rbp), %r8d
addl $0x1, %r8d
movl -0x14(%rbp), %r9d
addl $0x1, %r9d
movq -0x8(%rbp), %rax
movl (%rax), %esi
movl $0x4d, %eax
movl $0x6d, %edx
cmpl $0x5, %esi
cmovel %edx, %eax
movl $0x28, %esi
leaq 0x2724(%rip), %rdx      # 0x13622
movl %eax, (%rsp)
movb $0x0, %al
callq 0x50b0
movl %eax, -0xc(%rbp)
jmp 0x10f5d
cmpl $0xdf, -0x10(%rbp)
jge 0x10f59
cmpl $0xdf, -0x14(%rbp)
jge 0x10f59
leaq -0x50(%rbp), %rdi
movl -0x18(%rbp), %ecx
addl $0x20, %ecx
movl -0x10(%rbp), %r8d
addl $0x20, %r8d
addl $0x1, %r8d
movl -0x14(%rbp), %r9d
addl $0x20, %r9d
addl $0x1, %r9d
movl $0x28, %esi
leaq 0x26e3(%rip), %rdx      # 0x13630
movb $0x0, %al
callq 0x50b0
movl %eax, -0xc(%rbp)
jmp 0x10f5b
jmp 0x10f6c
jmp 0x10f5d
leaq -0x50(%rbp), %rdi
movslq -0xc(%rbp), %rsi
xorl %edx, %edx
callq 0x6fa0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)