user: 请将以下的汇编代码转换成C语言代码:

```asm
<poll>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  jne    L11
  test   %rsi,%rsi
  jne    L150
L11:
  test   %edx,%edx
  je     L212
  jle    L84
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0x10624dd3,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x26,%rax
  sub    %ecx,%eax
  imul   $0x3e8,%eax,%ecx
  movd   %eax,%xmm0
  lea    0x40(%rsp),%rax
  mov    %rax,0x28(%rsp)
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  movd   %edx,%xmm1
  punpckldq %xmm1,%xmm0
  movq   %xmm0,0x40(%rsp)
L109:
  lea    0x34(%rsp),%r13
  lea    0x38(%rsp),%r12
  mov    %r13,%rdi
  call   <FD_ZERO@plt>
  mov    %r12,%rdi
  call   <FD_ZERO@plt>
  lea    0x3c(%rsp),%rax
  mov    %rax,%rdi
  mov    %rax,0x8(%rsp)
  call   <FD_ZERO@plt>
  test   %r15,%r15
  je     L173
  mov    0x20(%rsp),%rbx
  xor    %ebp,%ebp
  mov    $0xffffffff,%eax
  mov    %r12,0x18(%rsp)
  mov    %rbp,%r14
  mov    %r13,0x10(%rsp)
  mov    %eax,%ebp
  mov    %rbx,%r12
  jmp    L256
  nopl   (%rax)
L24:
  mov    D4(%rip),%r13
  mov    D48(%rip),%rdx
  mov    D150(%rip),%rcx
  mov    0x0(%r13),%eax
  or     (%rdx),%eax
  or     (%rcx),%eax
  test   %esi,%eax
  jne    L203
L5:
  mov    D17(%rip),%r8
  mov    D115(%rip),%rdx
  mov    (%r8),%eax
  or     (%rdx),%eax
  test   %esi,%eax
  jne    L262
L85:
  cmp    %edi,%ebp
  jg     L242
  mov    (%rbx),%eax
  mov    D54(%rip),%rbx
  or     0x0(%r13),%eax
  mov    D115(%rip),%rcx
  or     (%r8),%eax
  mov    D48(%rip),%rdx
  or     (%rbx),%eax
  mov    D150(%rip),%rbx
  or     (%rcx),%eax
  or     (%rdx),%eax
  or     (%rbx),%eax
  and    0x4(%r12),%eax
  je     L242
  mov    D124(%rip),%rax
  cmp    %edi,(%rax)
  jl     L101
  mov    %edi,%ebp
  nopl   0x0(%rax)
L242:
  add    $0x1,%r14
  add    $0xc,%r12
  cmp    %r14,%r15
  je     L158
L256:
  mov    (%r12),%edi
  test   %edi,%edi
  js     L242
  mov    D7(%rip),%rbx
  mov    D54(%rip),%rcx
  mov    0x4(%r12),%esi
  mov    (%rbx),%eax
  or     (%rcx),%eax
  test   %esi,%eax
  je     L24
  mov    0x10(%rsp),%rsi
  call   <FD_SET@plt>
  mov    0x4(%r12),%esi
  mov    (%r12),%edi
  jmp    L24
L212:
  movq   $0x0,0x40(%rsp)
  lea    0x40(%rsp),%rax
  mov    %rax,0x28(%rsp)
  jmp    L109
  nopl   0x0(%rax,%rax,1)
L203:
  mov    0x18(%rsp),%rsi
  call   <FD_SET@plt>
  mov    0x4(%r12),%esi
  mov    (%r12),%edi
  jmp    L5
  nopl   0x0(%rax,%rax,1)
L262:
  mov    0x8(%rsp),%rsi
  call   <FD_SET@plt>
  mov    (%r12),%edi
  mov    D17(%rip),%r8
  jmp    L85
  nopw   0x0(%rax,%rax,1)
L158:
  mov    0x10(%rsp),%r13
  mov    0x18(%rsp),%r12
  mov    %ebp,%edi
  mov    0x28(%rsp),%r8
  mov    0x8(%rsp),%rcx
  add    $0x1,%edi
  mov    %r12,%rdx
  mov    %r13,%rsi
  call   <select@plt>
  mov    %eax,%r14d
  test   %eax,%eax
  js     L296
  xor    %r14d,%r14d
  mov    0x20(%rsp),%rbx
  xor    %ebp,%ebp
  mov    %r14d,0x10(%rsp)
  mov    %r15,%r14
  mov    0x8(%rsp),%r15
  jmp    L170
  nopl   0x0(%rax)
L243:
  movl   $0x0,0x8(%rbx)
L172:
  add    $0x1,%rbp
  add    $0xc,%rbx
  cmp    %rbp,%r14
  jbe    L236
L170:
  mov    (%rbx),%edi
  test   %edi,%edi
  js     L243
  mov    0x4(%rbx),%esi
  mov    %r15,%r8
  mov    %r12,%rcx
  mov    %r13,%rdx
  call   <compute_revents@plt>
  test   %eax,%eax
  je     L172
  add    $0x1,%rbp
  mov    %eax,0x8(%rbx)
  add    $0xc,%rbx
  addl   $0x1,0x10(%rsp)
  cmp    %rbp,%r14
  ja     L170
L236:
  mov    0x10(%rsp),%r14d
L296:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L120
  add    $0x58,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L84:
  cmp    $0xffffffff,%edx
  jne    L33
  movq   $0x0,0x28(%rsp)
  jmp    L109
L101:
  mov    D145(%rip),%rax
  mov    $0xffffffff,%r14d
  mov    (%rax),%edx
  mov    D141(%rip),%rax
  mov    %edx,(%rax)
  jmp    L296
L173:
  mov    0x28(%rsp),%r8
  mov    0x8(%rsp),%rcx
  mov    %r12,%rdx
  xor    %edi,%edi
  mov    %r13,%rsi
  call   <select@plt>
  xor    %edx,%edx
  test   %eax,%eax
  cmovle %eax,%edx
  mov    %edx,%r14d
  jmp    L296
L150:
  mov    D61(%rip),%rax
  mov    $0xffffffff,%r14d
  mov    (%rax),%edx
  mov    D141(%rip),%rax
  mov    %edx,(%rax)
  jmp    L296
L33:
  mov    D160(%rip),%rax
  mov    $0xffffffff,%r14d
  mov    (%rax),%edx
  mov    D141(%rip),%rax
  mov    %edx,(%rax)
  jmp    L296
L120:
  call   <__stack_chk_fail@plt>
```

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;
}
```