// File: /workspace/github_c_makefile_star2_O0/mcaimi[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 0x13fd9
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x0, -0x20(%rbp)
movq 0x109a0(%rip), %rdi     # 0x24988
leaq 0x7ae4(%rip), %rsi      # 0x1bad3
xorl %edx, %edx
callq 0x6810
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x60(%rbp), %rax
jne 0x1405f
movq 0x10b81(%rip), %rax     # 0x24b90
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 0x68b0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x14190
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq 0x10b22(%rip), %rax     # 0x24b90
je 0x1407f
movq -0x10(%rbp), %rax
cmpq $0x1f, 0x38(%rax)
jne 0x1418e
movq 0x10902(%rip), %rdi     # 0x24988
leaq 0x727e(%rip), %rsi      # 0x1b30b
xorl %edx, %edx
callq 0x6810
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x30(%rax)
jne 0x140b0
movq 0x10aee(%rip), %rax     # 0x24b98
movq %rax, -0x78(%rbp)
jmp 0x140f2
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x70(%rbp), %rax
jne 0x140cb
movq 0x10adb(%rip), %rax     # 0x24ba0
movq %rax, -0x78(%rbp)
jmp 0x140f0
movq 0xaf1e(%rip), %rax      # 0x1eff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0x79f7(%rip), %rsi      # 0x1badb
movb $0x0, %al
callq 0x6970
jmp 0x141cf
jmp 0x140f2
cmpq $0x0, -0x78(%rbp)
je 0x1418c
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 0x63b0
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 0x68b0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x1418e
jmp 0x14190
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 0x66d0
cmpl $0x0, %eax
jne 0x141cf
movq 0xae32(%rip), %rax      # 0x1eff0
movq (%rax), %rdi
leaq 0x7938(%rip), %rsi      # 0x1bb00
movb $0x0, %al
callq 0x6970
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)