user: Demonstrate the C code that generates the assembly output below:

```asm
<poll>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x48(%rbp)
  jne    L220
  cmpq   $0x0,-0x50(%rbp)
  je     L220
  mov    D100(%rip),%rax
  mov    (%rax),%edx
  mov    D81(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L249
L220:
  cmpl   $0x0,-0x54(%rbp)
  jne    L265
  lea    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x20(%rbp),%rax
  movl   $0x0,0x4(%rax)
  jmp    L254
L265:
  cmpl   $0x0,-0x54(%rbp)
  jle    L141
  lea    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x54(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x54(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  imul   $0x3e8,%edx,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,0x4(%rax)
  jmp    L254
L141:
  cmpl   $0xffffffff,-0x54(%rbp)
  jne    L8
  movq   $0x0,-0x20(%rbp)
  jmp    L254
L8:
  mov    D168(%rip),%rax
  mov    (%rax),%edx
  mov    D81(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L249
L254:
  movl   $0xffffffff,-0x2c(%rbp)
  lea    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x34(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  movq   $0x0,-0x18(%rbp)
  jmp    L158
L181:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L57
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    0x4(%rax),%edx
  mov    D91(%rip),%rax
  mov    (%rax),%ecx
  mov    D139(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L160
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    -0x38(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
L160:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    0x4(%rax),%edx
  mov    D174(%rip),%rax
  mov    (%rax),%ecx
  mov    D99(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D37(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L82
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    -0x34(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
L82:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    0x4(%rax),%edx
  mov    D108(%rip),%rax
  mov    (%rax),%ecx
  mov    D57(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L90
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    -0x30(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
L90:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x2c(%rbp)
  jg     L219
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    0x4(%rax),%edx
  mov    D91(%rip),%rax
  mov    (%rax),%ecx
  mov    D174(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D108(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D139(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D57(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D99(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D37(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L219
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x2c(%rbp)
  mov    D60(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x2c(%rbp)
  jle    L219
  mov    D19(%rip),%rax
  mov    (%rax),%edx
  mov    D81(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L249
L57:
  nop
L219:
  addq   $0x1,-0x18(%rbp)
L158:
  mov    -0x18(%rbp),%rax
  cmp    -0x50(%rbp),%rax
  jb     L181
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x20(%rbp),%rsi
  lea    -0x30(%rbp),%rcx
  lea    -0x34(%rbp),%rdx
  lea    -0x38(%rbp),%rax
  mov    %rsi,%r8
  mov    %rax,%rsi
  call   <select@plt>
  mov    %eax,-0x28(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  jns    L187
  mov    -0x28(%rbp),%eax
  jmp    L249
L187:
  movl   $0x0,-0x28(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L133
L185:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L173
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,0x8(%rax)
  jmp    L188
L173:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    0x4(%rax),%esi
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    -0x30(%rbp),%rdi
  lea    -0x34(%rbp),%rcx
  lea    -0x38(%rbp),%rdx
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <compute_revents@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  je     L188
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    %eax,0x8(%rdx)
  addl   $0x1,-0x28(%rbp)
L188:
  addq   $0x1,-0x18(%rbp)
L133:
  mov    -0x18(%rbp),%rax
  cmp    -0x50(%rbp),%rax
  jb     L185
  mov    -0x28(%rbp),%eax
L249:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L78
  call   <__stack_chk_fail@plt>
L78:
  leave
  ret
```

assistant: ```c
int poll(struct pollfd *pfd, nfds_t nfd, int timeout) {
  fd_set rfds, wfds, efds;
  struct timeval tv;
  struct timeval *ptv;
  int maxfd, rc;
  nfds_t i;
  if (!pfd && nfd) {
    errno = EFAULT;
    return -1;
  }
  if (timeout == 0) {
    ptv = &tv;
    ptv->tv_sec = 0;
    ptv->tv_usec = 0;
  } else if (timeout > 0) {
    ptv = &tv;
    ptv->tv_sec = timeout / 1000;
    ptv->tv_usec = (timeout % 1000) * 1000;
  } else if (timeout == (-1))
    ptv = NULL;
  else {
    errno = EINVAL;
    return -1;
  }
  maxfd = -1;
  FD_ZERO(&rfds);
  FD_ZERO(&wfds);
  FD_ZERO(&efds);
  for (i = 0; i < nfd; i++) {
    if (pfd[i].fd < 0)
      continue;
    if (pfd[i].events & (POLLIN | POLLRDNORM))
      FD_SET(pfd[i].fd, &rfds);
    if (pfd[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND))
      FD_SET(pfd[i].fd, &wfds);
    if (pfd[i].events & (POLLPRI | POLLRDBAND))
      FD_SET(pfd[i].fd, &efds);
    if (pfd[i].fd >= maxfd && (pfd[i].events & (POLLIN | POLLOUT | POLLPRI | POLLRDNORM | POLLRDBAND | POLLWRNORM | POLLWRBAND))) {
      maxfd = pfd[i].fd;
      if (maxfd > FD_SETSIZE) {
        errno = EOVERFLOW;
        return -1;
      }
    }
  }
  rc = select(maxfd + 1, &rfds, &wfds, &efds, ptv);
  if (rc < 0)
    return rc;
  rc = 0;
  for (i = 0; i < nfd; i++)
    if (pfd[i].fd < 0)
      pfd[i].revents = 0;
    else {
      int happened = compute_revents(pfd[i].fd, pfd[i].events, &rfds, &wfds, &efds);
      if (happened) {
        pfd[i].revents = happened;
        rc++;
      }
    }
  return rc;
}
```