user: What would the C source look like for the assembly code provided here?

```asm
<poll>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L215
  mov    %rsi,%r13
  test   %edx,%edx
  jne    L217
  movl   $0x0,0x20(%rsp)
  movl   $0x0,0x24(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
L115:
  lea    0x14(%rsp),%rdi
  call   <FD_ZERO@plt>
  lea    0x18(%rsp),%rdi
  call   <FD_ZERO@plt>
  lea    0x1c(%rsp),%rdi
  call   <FD_ZERO@plt>
  test   %r13,%r13
  je     L13
  mov    (%rsp),%rbx
  mov    $0x0,%r12d
  mov    $0xffffffff,%r14d
  lea    0x1c(%rsp),%r15
  jmp    L177
L215:
  mov    D102(%rip),%rax
  mov    (%rax),%edx
  mov    D68(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%r12d
  jmp    L95
L217:
  jle    L27
  movslq %edx,%rax
  imul   $0x10624dd3,%rax,%rax
  sar    $0x26,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,0x20(%rsp)
  imul   $0x3e8,%eax,%eax
  sub    %eax,%edx
  imul   $0x3e8,%edx,%edx
  mov    %edx,0x24(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L115
L27:
  cmp    $0xffffffff,%edx
  jne    L296
  movq   $0x0,0x8(%rsp)
  jmp    L115
L296:
  mov    D66(%rip),%rax
  mov    (%rax),%edx
  mov    D68(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%r12d
  jmp    L95
L223:
  lea    0x14(%rsp),%rsi
  call   <FD_SET@plt>
  jmp    L204
L203:
  lea    0x18(%rsp),%rsi
  mov    0x0(%rbp),%edi
  call   <FD_SET@plt>
  jmp    L83
L208:
  mov    %r15,%rsi
  mov    0x0(%rbp),%edi
  call   <FD_SET@plt>
  jmp    L266
L268:
  mov    D167(%rip),%rax
  mov    (%rax),%edx
  mov    D68(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%r12d
L95:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  mov    %r12d,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L235:
  add    $0x1,%r12
  add    $0xc,%rbx
  cmp    %r12,%r13
  je     L264
L177:
  mov    %rbx,%rbp
  mov    (%rbx),%edi
  test   %edi,%edi
  js     L235
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  mov    D46(%rip),%rdx
  or     (%rdx),%eax
  and    0x4(%rbx),%eax
  jne    L223
L204:
  mov    D84(%rip),%rax
  mov    (%rax),%eax
  mov    D177(%rip),%rdx
  or     (%rdx),%eax
  mov    D168(%rip),%rdx
  or     (%rdx),%eax
  and    0x4(%rbp),%eax
  jne    L203
L83:
  mov    D122(%rip),%rax
  mov    (%rax),%eax
  mov    D93(%rip),%rdx
  or     (%rdx),%eax
  and    0x4(%rbp),%eax
  jne    L208
L266:
  mov    0x0(%rbp),%edx
  cmp    %r14d,%edx
  jl     L235
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  mov    D84(%rip),%rcx
  or     (%rcx),%eax
  mov    D122(%rip),%rcx
  or     (%rcx),%eax
  mov    D46(%rip),%rcx
  or     (%rcx),%eax
  mov    D93(%rip),%rcx
  or     (%rcx),%eax
  mov    D177(%rip),%rcx
  or     (%rcx),%eax
  mov    D168(%rip),%rcx
  or     (%rcx),%eax
  and    0x4(%rbp),%eax
  je     L235
  mov    D154(%rip),%rax
  cmp    (%rax),%edx
  jg     L268
  mov    %edx,%r14d
  jmp    L235
L13:
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x14(%rsp),%rsi
  mov    0x8(%rsp),%r8
  mov    $0x0,%edi
  call   <select@plt>
  test   %eax,%eax
  mov    $0x0,%edx
  cmovle %eax,%edx
  mov    %edx,%r12d
  jmp    L95
L170:
  lea    0x18(%rsp),%rcx
  lea    0x14(%rsp),%rdx
  mov    0x4(%rbx),%esi
  mov    %r15,%r8
  call   <compute_revents@plt>
  test   %eax,%eax
  je     L189
  mov    %eax,0x8(%rbx)
  add    $0x1,%r12d
L189:
  add    $0x1,%rbp
  add    $0xc,%rbx
  cmp    %rbp,%r13
  jbe    L95
L99:
  mov    (%rbx),%edi
  test   %edi,%edi
  jns    L170
  movl   $0x0,0x8(%rbx)
  jmp    L189
L264:
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x14(%rsp),%rsi
  lea    0x1(%r14),%edi
  mov    0x8(%rsp),%r8
  call   <select@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L95
  mov    (%rsp),%rbx
  mov    $0x0,%ebp
  mov    $0x0,%r12d
  lea    0x1c(%rsp),%r15
  jmp    L99
L37:
  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) {
    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;
}
```