user: 请将这段汇编代码片段转换成等效的C代码:

```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    L77
  mov    D135(%rip),%rax
  mov    (%rax),%edx
  mov    D150(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L222
L77:
  cmpl   $0x0,-0x54(%rbp)
  jne    L254
  lea    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x20(%rbp),%rax
  movl   $0x0,0x4(%rax)
  jmp    L104
L254:
  cmpl   $0x0,-0x54(%rbp)
  jle    L106
  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    L104
L106:
  cmpl   $0xffffffff,-0x54(%rbp)
  jne    L113
  movq   $0x0,-0x20(%rbp)
  jmp    L104
L113:
  mov    D68(%rip),%rax
  mov    (%rax),%edx
  mov    D150(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L222
L104:
  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    L140
L159:
  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     L58
  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    D15(%rip),%rax
  mov    (%rax),%ecx
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L195
  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>
L195:
  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    D65(%rip),%rax
  mov    (%rax),%ecx
  mov    D193(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D107(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L218
  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>
L218:
  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    D73(%rip),%rax
  mov    (%rax),%ecx
  mov    D31(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L259
  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>
L259:
  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     L74
  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    D15(%rip),%rax
  mov    (%rax),%ecx
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D73(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D31(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D193(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%ecx
  mov    D107(%rip),%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L74
  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    D165(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x2c(%rbp)
  jle    L74
  mov    D187(%rip),%rax
  mov    (%rax),%edx
  mov    D150(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L222
L58:
  nop
L74:
  addq   $0x1,-0x18(%rbp)
L140:
  mov    -0x18(%rbp),%rax
  cmp    -0x50(%rbp),%rax
  jb     L159
  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    L230
  mov    -0x28(%rbp),%eax
  jmp    L222
L230:
  movl   $0x0,-0x28(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L110
L44:
  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    L123
  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    L41
L123:
  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     L41
  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)
L41:
  addq   $0x1,-0x18(%rbp)
L110:
  mov    -0x18(%rbp),%rax
  cmp    -0x50(%rbp),%rax
  jb     L44
  mov    -0x28(%rbp),%eax
L222:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L147
  call   <__stack_chk_fail@plt>
L147:
  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) {
    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;
}
```