// File: /workspace/github_c_makefile_star2_O0/odknt[P]st/x.c
// Function: selrequest
void
selrequest(XEvent *e)
{
	XSelectionRequestEvent *xsre;
	XSelectionEvent xev;
	Atom xa_targets, string, clipboard;
	char *seltext;

	xsre = (XSelectionRequestEvent *) e;
	xev.type = SelectionNotify;
	xev.requestor = xsre->requestor;
	xev.selection = xsre->selection;
	xev.target = xsre->target;
	xev.time = xsre->time;
	if (xsre->property == None)
		xsre->property = xsre->target;

	/* reject */
	xev.property = None;

	xa_targets = XInternAtom(xw.dpy, "TARGETS", 0);
	if (xsre->target == xa_targets) {
		/* respond with the supported type */
		string = xsel.xtarget;
		XChangeProperty(xsre->display, xsre->requestor, xsre->property,
				XA_ATOM, 32, PropModeReplace,
				(uchar *) &string, 1);
		xev.property = xsre->property;
	} else if (xsre->target == xsel.xtarget || xsre->target == XA_STRING) {
		/*
		 * xith XA_STRING non ascii characters may be incorrect in the
		 * requestor. It is not our problem, use utf8.
		 */
		clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0);
		if (xsre->selection == XA_PRIMARY) {
			seltext = xsel.primary;
		} else if (xsre->selection == clipboard) {
			seltext = xsel.clipboard;
		} else {
			fprintf(stderr,
				"Unhandled clipboard selection 0x%lx\n",
				xsre->selection);
			return;
		}
		if (seltext != NULL) {
			XChangeProperty(xsre->display, xsre->requestor,
					xsre->property, xsre->target,
					8, PropModeReplace,
					(uchar *)seltext, strlen(seltext));
			xev.property = xsre->property;
		}
	}

	/* all done, send a notification to the listener */
	if (!XSendEvent(xsre->display, xsre->requestor, 1, 0, (XEvent *) &xev))
		fprintf(stderr, "Error sending SelectionNotify event\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x1f, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x12b99
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x0, -0x20(%rbp)
movq 0xf9e8(%rip), %rdi      # 0x22590
leaq 0x2d90(%rip), %rsi      # 0x1593f
xorl %edx, %edx
callq 0x6870
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x60(%rbp), %rax
jne 0x12c1f
movq 0xfb59(%rip), %rax      # 0x22728
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdx
movl $0x4, %ecx
movl $0x20, %r8d
xorl %r9d, %r9d
leaq -0x68(%rbp), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x68f0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x12d50
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq 0xfafa(%rip), %rax      # 0x22728
je 0x12c3f
movq -0x10(%rbp), %rax
cmpq $0x1f, 0x38(%rax)
jne 0x12d4e
movq 0xf94a(%rip), %rdi      # 0x22590
leaq 0x25dc(%rip), %rsi      # 0x15229
xorl %edx, %edx
callq 0x6870
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x30(%rax)
jne 0x12c70
movq 0xfac6(%rip), %rax      # 0x22730
movq %rax, -0x78(%rbp)
jmp 0x12cb2
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x70(%rbp), %rax
jne 0x12c8b
movq 0xfab3(%rip), %rax      # 0x22738
movq %rax, -0x78(%rbp)
jmp 0x12cb0
movq 0x635e(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0x2ca3(%rip), %rsi      # 0x15947
movb $0x0, %al
callq 0x69d0
jmp 0x12d8f
jmp 0x12cb2
cmpq $0x0, -0x78(%rbp)
je 0x12d4c
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0x6410
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r10
movl $0x8, %r8d
xorl %r9d, %r9d
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x68f0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x12d4e
jmp 0x12d50
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
leaq -0x58(%rbp), %r8
callq 0x6750
cmpl $0x0, %eax
jne 0x12d8f
movq 0x6272(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x2be4(%rip), %rsi      # 0x1596c
movb $0x0, %al
callq 0x69d0
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)