// File: /workspace/github_c_makefile_star2_O0/jaimecgomezz[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 0x10049
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x0, -0x20(%rbp)
movq 0xb248(%rip), %rdi      # 0x1b2a0
leaq 0x2546(%rip), %rsi      # 0x125a5
xorl %edx, %edx
callq 0x5730
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x60(%rbp), %rax
jne 0x100cf
movq 0xb391(%rip), %rax      # 0x1b410
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 0x57a0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x10200
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq 0xb332(%rip), %rax      # 0x1b410
je 0x100ef
movq -0x10(%rbp), %rax
cmpq $0x1f, 0x38(%rax)
jne 0x101fe
movq 0xb1aa(%rip), %rdi      # 0x1b2a0
leaq 0x1d6e(%rip), %rsi      # 0x11e6b
xorl %edx, %edx
callq 0x5730
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x30(%rax)
jne 0x10120
movq 0xb2fe(%rip), %rax      # 0x1b418
movq %rax, -0x78(%rbp)
jmp 0x10162
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x70(%rbp), %rax
jne 0x1013b
movq 0xb2eb(%rip), %rax      # 0x1b420
movq %rax, -0x78(%rbp)
jmp 0x10160
movq 0x5eae(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0x2459(%rip), %rsi      # 0x125ad
movb $0x0, %al
callq 0x5840
jmp 0x1023f
jmp 0x10162
cmpq $0x0, -0x78(%rbp)
je 0x101fc
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 0x5350
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 0x57a0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x101fe
jmp 0x10200
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 0x5610
cmpl $0x0, %eax
jne 0x1023f
movq 0x5dc2(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x239a(%rip), %rsi      # 0x125d2
movb $0x0, %al
callq 0x5840
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)