user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<xrectsel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x0,%edi
  call   <XOpenDisplay@plt>
  mov    %rax,-0x38(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L136
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <DefaultRootWindow@plt>
  mov    %eax,-0x44(%rbp)
  movl   $0x0,-0x60(%rbp)
  movl   $0x0,-0x5c(%rbp)
  movl   $0x0,-0x58(%rbp)
  movl   $0x0,-0x54(%rbp)
  movl   $0x0,-0x50(%rbp)
  movl   $0x0,-0x4c(%rbp)
  movl   $0x0,-0x48(%rbp)
  mov    D1(%rip),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <XCreateFontCursor@plt>
  mov    %eax,-0x40(%rbp)
  mov    D28(%rip),%rax
  mov    (%rax),%r8d
  mov    D91(%rip),%rax
  mov    (%rax),%edi
  mov    D139(%rip),%rax
  mov    (%rax),%r9d
  mov    D139(%rip),%rax
  mov    (%rax),%r10d
  mov    D89(%rip),%rax
  mov    (%rax),%edx
  mov    D111(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    D176(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%ecx
  or     %eax,%ecx
  mov    D84(%rip),%rax
  mov    (%rax),%edx
  mov    -0x44(%rbp),%esi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  push   %r8
  mov    -0x40(%rbp),%r8d
  push   %r8
  push   %rdi
  mov    %r10d,%r8d
  mov    %rax,%rdi
  call   <XGrabPointer@plt>
  add    $0x20,%rsp
  mov    D134(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x24(%rbp)
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x2c(%rbp)
  mov    D54(%rip),%rax
  mov    (%rax),%edx
  mov    D179(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    D69(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%edi
  or     %eax,%edi
  lea    -0x2c(%rbp),%rdx
  mov    -0x44(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rcx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <XCreateGC@plt>
  mov    %eax,-0x3c(%rbp)
L133:
  lea    -0x20(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <XNextEvent@plt>
  mov    -0x20(%rbp),%rdx
  mov    D165(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L31
  movl   $0x1,-0x60(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x5c(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  mov    -0x48(%rbp),%eax
  mov    %eax,-0x58(%rbp)
  movl   $0x0,-0x50(%rbp)
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x54(%rbp)
  jmp    L133
L31:
  mov    -0x20(%rbp),%rdx
  mov    D121(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L33
  cmpl   $0x0,-0x60(%rbp)
  je     L111
  mov    -0x54(%rbp),%r9d
  mov    -0x58(%rbp),%r8d
  mov    -0x5c(%rbp),%ecx
  mov    -0x3c(%rbp),%edx
  mov    -0x44(%rbp),%esi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  mov    -0x50(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <XDrawRectangle@plt>
  add    $0x10,%rsp
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x5c(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x5c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jle    L34
  mov    -0x5c(%rbp),%eax
  sub    -0x4c(%rbp),%eax
  mov    %eax,-0x54(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x5c(%rbp)
  jmp    L116
L34:
  mov    -0x4c(%rbp),%eax
  sub    -0x5c(%rbp),%eax
  mov    %eax,-0x54(%rbp)
L116:
  mov    -0x58(%rbp),%eax
  cmp    -0x48(%rbp),%eax
  jle    L98
  mov    -0x58(%rbp),%eax
  sub    -0x48(%rbp),%eax
  mov    %eax,-0x50(%rbp)
  mov    -0x48(%rbp),%eax
  mov    %eax,-0x58(%rbp)
  jmp    L117
L98:
  mov    -0x48(%rbp),%eax
  sub    -0x58(%rbp),%eax
  mov    %eax,-0x50(%rbp)
L117:
  mov    -0x54(%rbp),%r9d
  mov    -0x58(%rbp),%r8d
  mov    -0x5c(%rbp),%ecx
  mov    -0x3c(%rbp),%edx
  mov    -0x44(%rbp),%esi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  mov    -0x50(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <XDrawRectangle@plt>
  add    $0x10,%rsp
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <XFlush@plt>
  jmp    L133
L33:
  mov    -0x20(%rbp),%rdx
  mov    D116(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L15
  jmp    L133
L111:
  nop
  jmp    L133
L15:
  nop
  mov    -0x54(%rbp),%r9d
  mov    -0x58(%rbp),%r8d
  mov    -0x5c(%rbp),%ecx
  mov    -0x3c(%rbp),%edx
  mov    -0x44(%rbp),%esi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  mov    -0x50(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <XDrawRectangle@plt>
  add    $0x10,%rsp
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <XFlush@plt>
  mov    D28(%rip),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <XUngrabPointer@plt>
  mov    -0x40(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <XFreeCursor@plt>
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <XFreeGC@plt>
  mov    -0x38(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <XSync@plt>
  mov    -0x5c(%rbp),%edx
  mov    -0x68(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x58(%rbp),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x78(%rbp),%rax
  mov    -0x54(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x80(%rbp),%rax
  mov    -0x50(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <XCloseDisplay@plt>
  jmp    L32
L136:
  nop
L32:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L89
  call   <__stack_chk_fail@plt>
L89:
  leave
  ret
```

assistant: ```c
void xrectsel(unsigned *x_sel, unsigned *y_sel, unsigned *w_sel, unsigned *h_sel) {
  Display *dpy = XOpenDisplay(NULL);
  if (!dpy)
    return;
  Window root = DefaultRootWindow(dpy);
  XEvent ev;
  GC sel_gc;
  XGCValues sel_gv;
  int btn_pressed = 0;
  int x = 0, y = 0;
  unsigned int width = 0, height = 0;
  int start_x = 0, start_y = 0;
  Cursor cursor;
  cursor = XCreateFontCursor(dpy, XC_crosshair);
  XGrabPointer(dpy, root, True, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime);
  sel_gv.function = GXinvert;
  sel_gv.subwindow_mode = IncludeInferiors;
  sel_gv.line_width = 1;
  sel_gc = XCreateGC(dpy, root, GCFunction | GCSubwindowMode | GCLineWidth, &sel_gv);
  for (;;) {
    XNextEvent(dpy, &ev);
    if (ev.type == ButtonPress) {
      btn_pressed = 1;
      x = start_x = ev.xbutton.x_root;
      y = start_y = ev.xbutton.y_root;
      width = height = 0;
    } else if (ev.type == MotionNotify) {
      if (!btn_pressed)
        continue;
      XDrawRectangle(dpy, root, sel_gc, x, y, width, height);
      x = ev.xbutton.x_root;
      y = ev.xbutton.y_root;
      if (x > start_x) {
        width = x - start_x;
        x = start_x;
      } else {
        width = start_x - x;
      }
      if (y > start_y) {
        height = y - start_y;
        y = start_y;
      } else {
        height = start_y - y;
      }
      XDrawRectangle(dpy, root, sel_gc, x, y, width, height);
      XFlush(dpy);
    } else if (ev.type == ButtonRelease)
      break;
  }
  XDrawRectangle(dpy, root, sel_gc, x, y, width, height);
  XFlush(dpy);
  XUngrabPointer(dpy, CurrentTime);
  XFreeCursor(dpy, cursor);
  XFreeGC(dpy, sel_gc);
  XSync(dpy, 1);
  *x_sel = x;
  *y_sel = y;
  *w_sel = width;
  *h_sel = height;
  XCloseDisplay(dpy);
}
```