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

```asm
<poll>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x88,%rsp
  mov    %edx,-0x98(%rbp)
  mov    D87(%rip),%edi
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %edi,%edi
  je     L162
L135:
  mov    D68(%rip),%rax
  mov    (%rax),%esi
  call   <howmany@plt>
  mov    %eax,%r13d
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %r13d,%edi
  mov    %rax,-0x60(%rbp)
  call   <alloca@plt>
  mov    %r13d,%edi
  mov    %rax,%r12
  mov    %rax,-0x80(%rbp)
  call   <alloca@plt>
  mov    -0x60(%rbp),%rdi
  mov    %r13d,%esi
  mov    %rax,%r14
  mov    %rax,-0x88(%rbp)
  call   <bzero@plt>
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <bzero@plt>
  mov    %r14,%rdi
  mov    %r13d,%esi
  call   <bzero@plt>
  lea    (%rbx,%rbx,2),%rax
  lea    (%r15,%rax,4),%r14
  cmp    %r14,%r15
  jae    L86
  mov    %r14,-0x68(%rbp)
  mov    %r15,%r14
  movl   $0x0,-0x54(%rbp)
  mov    %r15,-0xa0(%rbp)
  jmp    L128
  nopl   0x0(%rax,%rax,1)
L139:
  mov    0x8(%r14),%eax
  mov    D215(%rip),%r15
  mov    %eax,%edx
  and    (%r15),%edx
  jne    L232
  mov    D100(%rip),%r12
  mov    %eax,%edx
  and    (%r12),%edx
  jne    L190
L348:
  mov    D99(%rip),%rbx
  and    (%rbx),%eax
  jne    L18
L311:
  mov    -0x54(%rbp),%ecx
  cmp    %edi,%ecx
  jge    L380
  mov    (%r15),%eax
  or     (%r12),%eax
  or     (%rbx),%eax
  and    0x8(%r14),%eax
  cmove  %ecx,%edi
  mov    %edi,-0x54(%rbp)
L380:
  add    $0xc,%r14
  cmp    -0x68(%rbp),%r14
  jae    L122
L128:
  mov    0x4(%r14),%edi
  movl   $0x0,(%r14)
  test   %edi,%edi
  js     L380
  cmp    D87(%rip),%edi
  jl     L139
  mov    D68(%rip),%rax
  movslq %r13d,%r12
  mov    (%rax),%esi
  call   <roundup@plt>
  mov    %eax,%edi
  mov    %eax,D181(%rip)
  mov    D68(%rip),%rax
  mov    (%rax),%esi
  call   <howmany@plt>
  mov    %eax,%ebx
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %ebx,%edi
  mov    %rax,%r15
  call   <alloca@plt>
  mov    %ebx,%edi
  mov    %rax,-0x70(%rbp)
  call   <alloca@plt>
  mov    %ebx,%esi
  lea    (%r15,%r12,1),%rdi
  sub    %r13d,%esi
  mov    %rax,-0x78(%rbp)
  mov    %esi,-0x90(%rbp)
  call   <bzero@plt>
  mov    -0x70(%rbp),%rcx
  mov    -0x90(%rbp),%esi
  lea    (%rcx,%r12,1),%rdi
  call   <bzero@plt>
  mov    -0x78(%rbp),%rax
  mov    -0x90(%rbp),%esi
  lea    (%rax,%r12,1),%rdi
  call   <bzero@plt>
  mov    -0x60(%rbp),%rsi
  mov    %r13d,%edx
  mov    %r15,%rdi
  call   <memcpy@plt>
  mov    -0x80(%rbp),%rsi
  mov    -0x70(%rbp),%rdi
  mov    %r13d,%edx
  mov    %rax,-0x60(%rbp)
  call   <memcpy@plt>
  mov    -0x78(%rbp),%rdi
  mov    -0x88(%rbp),%rsi
  mov    %r13d,%edx
  mov    %rax,-0x80(%rbp)
  mov    %ebx,%r13d
  call   <memcpy@plt>
  mov    0x4(%r14),%edi
  mov    %rax,-0x88(%rbp)
  jmp    L139
  nopw   0x0(%rax,%rax,1)
L18:
  mov    -0x88(%rbp),%rsi
  call   <FD_SET@plt>
  mov    0x4(%r14),%edi
  jmp    L311
  nopl   (%rax)
L232:
  mov    -0x60(%rbp),%rsi
  call   <FD_SET@plt>
  mov    0x8(%r14),%eax
  mov    D100(%rip),%r12
  mov    0x4(%r14),%edi
  mov    %eax,%edx
  and    (%r12),%edx
  je     L348
L190:
  mov    -0x80(%rbp),%rsi
  call   <FD_SET@plt>
  mov    0x8(%r14),%eax
  mov    0x4(%r14),%edi
  jmp    L348
  nopw   0x0(%rax,%rax,1)
L122:
  mov    -0x68(%rbp),%r14
  mov    -0xa0(%rbp),%r15
L266:
  movslq -0x98(%rbp),%rax
  mov    %r15,-0xa0(%rbp)
  mov    %rax,%rsi
  imul   $0x10624dd3,%rax,%rax
  mov    %esi,%edx
  sar    $0x1f,%edx
  sar    $0x26,%rax
  sub    %edx,%eax
  mov    %esi,%edx
  imul   $0x3e8,%eax,%ecx
  movd   %eax,%xmm0
  xor    %eax,%eax
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  cmp    $0xffffffff,%esi
  movd   %edx,%xmm1
  lea    -0x48(%rbp),%rdx
  cmovne %rdx,%rax
  punpckldq %xmm1,%xmm0
  movq   %xmm0,-0x48(%rbp)
  mov    %rax,-0x98(%rbp)
  lea    -0x40(%rbp),%rax
  mov    %rax,-0xa8(%rbp)
  cs nopw 0x0(%rax,%rax,1)
L325:
  mov    -0x54(%rbp),%edi
  mov    -0x88(%rbp),%r12
  mov    -0x80(%rbp),%r15
  mov    -0x60(%rbp),%rbx
  mov    -0x98(%rbp),%r8
  add    $0x1,%edi
  mov    %r12,%rcx
  mov    %r15,%rdx
  mov    %rbx,%rsi
  call   <select@plt>
  mov    %eax,-0x54(%rbp)
  cmp    $0xffffffff,%eax
  jne    L384
  mov    D181(%rip),%rcx
  mov    D198(%rip),%rax
  mov    (%rcx),%rcx
  cmp    %rcx,(%rax)
  jne    L473
  mov    %r13d,%edi
  call   <alloca@plt>
  mov    %r13d,%edi
  mov    %rax,-0x68(%rbp)
  call   <alloca@plt>
  mov    %r13d,%edi
  mov    %rax,-0x70(%rbp)
  call   <alloca@plt>
  mov    %r13d,%esi
  mov    %rbx,%rdi
  mov    %rax,-0x78(%rbp)
  call   <bzero@plt>
  mov    %r13d,%esi
  mov    %r15,%rdi
  call   <bzero@plt>
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <bzero@plt>
  mov    -0xa0(%rbp),%rax
  movq   $0x0,-0x40(%rbp)
  cmp    %r14,%rax
  jae    L325
  mov    %rax,%rbx
  jmp    L294
  nopw   0x0(%rax,%rax,1)
L278:
  add    $0xc,%rbx
  cmp    %r14,%rbx
  jae    L325
L294:
  cmpl   $0xffffffff,0x4(%rbx)
  je     L278
  mov    D215(%rip),%r10
  mov    D100(%rip),%r15
  mov    D99(%rip),%r12
  mov    (%r10),%eax
  or     (%r15),%eax
  or     (%r12),%eax
  and    0x8(%rbx),%eax
  je     L278
  mov    D175(%rip),%rcx
  mov    (%rbx),%eax
  and    (%rcx),%eax
  jne    L278
  mov    -0x68(%rbp),%rdi
  mov    %r13d,%esi
  mov    %r10,-0x90(%rbp)
  call   <bzero@plt>
  mov    -0x70(%rbp),%rdi
  mov    %r13d,%esi
  call   <bzero@plt>
  mov    -0x78(%rbp),%rdi
  mov    %r13d,%esi
  call   <bzero@plt>
  mov    0x8(%rbx),%eax
  mov    -0x90(%rbp),%r10
  mov    %eax,%edx
  and    (%r10),%edx
  jne    L56
L24:
  mov    %eax,%edx
  and    (%r15),%edx
  jne    L321
L424:
  and    (%r12),%eax
  jne    L172
L82:
  mov    0x4(%rbx),%eax
  mov    -0x78(%rbp),%rcx
  mov    %r10,-0x90(%rbp)
  mov    -0xa8(%rbp),%r8
  mov    -0x70(%rbp),%rdx
  mov    -0x68(%rbp),%rsi
  lea    0x1(%rax),%edi
  call   <select@plt>
  cmp    $0xffffffff,%eax
  je     L173
  mov    0x8(%rbx),%eax
  mov    -0x90(%rbp),%r10
  mov    %eax,%edx
  and    (%r10),%edx
  jne    L236
L274:
  mov    %eax,%edx
  and    (%r15),%edx
  jne    L468
L175:
  and    (%r12),%eax
  jne    L217
L263:
  mov    -0x54(%rbp),%ecx
  mov    0x4(%rbx),%eax
  cmp    %eax,%ecx
  cmovge %ecx,%eax
  mov    %eax,-0x54(%rbp)
  jmp    L278
  nopl   0x0(%rax,%rax,1)
L173:
  mov    D181(%rip),%rsi
  mov    D198(%rip),%rax
  mov    (%rsi),%rsi
  cmp    %rsi,(%rax)
  jne    L278
  mov    D175(%rip),%rax
  mov    (%rax),%eax
  or     %eax,(%rbx)
  jmp    L278
  nopw   0x0(%rax,%rax,1)
L172:
  mov    0x4(%rbx),%edi
  mov    -0x78(%rbp),%rsi
  mov    %r10,-0x90(%rbp)
  call   <FD_SET@plt>
  mov    -0x90(%rbp),%r10
  jmp    L82
  nop
L321:
  mov    0x4(%rbx),%edi
  mov    -0x70(%rbp),%rsi
  mov    %r10,-0x90(%rbp)
  call   <FD_SET@plt>
  mov    0x8(%rbx),%eax
  mov    -0x90(%rbp),%r10
  jmp    L424
  nopw   0x0(%rax,%rax,1)
L56:
  mov    0x4(%rbx),%edi
  mov    -0x68(%rbp),%rsi
  call   <FD_SET@plt>
  mov    0x8(%rbx),%eax
  mov    -0x90(%rbp),%r10
  jmp    L24
  nopl   0x0(%rax,%rax,1)
L473:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  mov    -0x54(%rbp),%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   (%rax)
L217:
  mov    0x4(%rbx),%edi
  mov    -0x88(%rbp),%rsi
  call   <FD_SET@plt>
  jmp    L263
  nopl   0x0(%rax)
L468:
  mov    0x4(%rbx),%edi
  mov    -0x80(%rbp),%rsi
  call   <FD_SET@plt>
  mov    0x8(%rbx),%eax
  jmp    L175
  nopl   0x0(%rax)
L236:
  mov    0x4(%rbx),%edi
  mov    -0x60(%rbp),%rsi
  call   <FD_SET@plt>
  mov    0x8(%rbx),%eax
  jmp    L274
L384:
  mov    -0x54(%rbp),%eax
  mov    -0xa0(%rbp),%r15
  test   %eax,%eax
  jle    L473
  cmp    %r14,%r15
  jae    L473
  mov    -0x60(%rbp),%rbx
  mov    -0x80(%rbp),%r12
  mov    -0x88(%rbp),%r13
  jmp    L108
  nopl   0x0(%rax,%rax,1)
L365:
  add    $0xc,%r15
  cmp    %r14,%r15
  jae    L473
L108:
  mov    0x4(%r15),%edi
  test   %edi,%edi
  js     L365
  mov    %rbx,%rsi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L133
  mov    D215(%rip),%rax
  mov    (%rax),%eax
  or     %eax,(%r15)
L133:
  mov    0x4(%r15),%edi
  mov    %r12,%rsi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L265
  mov    D100(%rip),%rax
  mov    (%rax),%eax
  or     %eax,(%r15)
L265:
  mov    0x4(%r15),%edi
  mov    %r13,%rsi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L365
  mov    D99(%rip),%rax
  mov    (%rax),%eax
  or     %eax,(%r15)
  jmp    L365
L162:
  call   <getdtablesize@plt>
  mov    %eax,D105(%rip)
  mov    %eax,%edi
  jmp    L135
L86:
  movl   $0x0,-0x54(%rbp)
  jmp    L266
L15:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
  static int max_fd_size;
  struct timeval tv;
  fd_set *rset, *wset, *xset;
  struct pollfd *f;
  int ready;
  int maxfd = 0;
  int bytes;
  if (!max_fd_size)
    max_fd_size = getdtablesize();
  bytes = howmany(max_fd_size, __NFDBITS);
  rset = alloca(bytes);
  wset = alloca(bytes);
  xset = alloca(bytes);
  bzero(rset, bytes);
  bzero(wset, bytes);
  bzero(xset, bytes);
  for (f = fds; f < &fds[nfds]; ++f) {
    f->revents = 0;
    if (f->fd >= 0) {
      if (f->fd >= max_fd_size) {
        fd_set *nrset, *nwset, *nxset;
        int nbytes;
        max_fd_size = roundup(f->fd, __NFDBITS);
        nbytes = howmany(max_fd_size, __NFDBITS);
        nrset = alloca(nbytes);
        nwset = alloca(nbytes);
        nxset = alloca(nbytes);
        bzero((char *)nrset + bytes, nbytes - bytes);
        bzero((char *)nwset + bytes, nbytes - bytes);
        bzero((char *)nxset + bytes, nbytes - bytes);
        rset = memcpy(nrset, rset, bytes);
        wset = memcpy(nwset, wset, bytes);
        xset = memcpy(nxset, xset, bytes);
        bytes = nbytes;
      }
      if (f->events & POLLIN)
        FD_SET(f->fd, rset);
      if (f->events & POLLOUT)
        FD_SET(f->fd, wset);
      if (f->events & POLLPRI)
        FD_SET(f->fd, xset);
      if (f->fd > maxfd && (f->events & (POLLIN | POLLOUT | POLLPRI)))
        maxfd = f->fd;
    }
  }
  tv.tv_sec = timeout / 1000;
  tv.tv_usec = (timeout % 1000) * 1000;
  while (1) {
    ready = select(maxfd + 1, rset, wset, xset, timeout == -1 ? NULL : &tv);
    if (ready == -1 && errno == EBADF) {
      fd_set *sngl_rset = alloca(bytes);
      fd_set *sngl_wset = alloca(bytes);
      fd_set *sngl_xset = alloca(bytes);
      struct timeval sngl_tv;
      bzero(rset, bytes);
      bzero(wset, bytes);
      bzero(xset, bytes);
      sngl_tv.tv_sec = 0;
      sngl_tv.tv_usec = 0;
      maxfd = -1;
      ready = 0;
      for (f = fds; f < &fds[nfds]; ++f)
        if (f->fd != -1 && (f->events & (POLLIN | POLLOUT | POLLPRI)) && (f->revents & POLLNVAL) == 0) {
          int n;
          bzero(sngl_rset, bytes);
          bzero(sngl_wset, bytes);
          bzero(sngl_xset, bytes);
          if (f->events & POLLIN)
            FD_SET(f->fd, sngl_rset);
          if (f->events & POLLOUT)
            FD_SET(f->fd, sngl_wset);
          if (f->events & POLLPRI)
            FD_SET(f->fd, sngl_xset);
          n = select(f->fd + 1, sngl_rset, sngl_wset, sngl_xset, &sngl_tv);
          if (n != -1) {
            if (f->events & POLLIN)
              FD_SET(f->fd, rset);
            if (f->events & POLLOUT)
              FD_SET(f->fd, wset);
            if (f->events & POLLPRI)
              FD_SET(f->fd, xset);
            if (f->fd > maxfd)
              maxfd = f->fd;
            if (n > 0)
              ++ready;
          } else if (errno == EBADF)
            f->revents |= POLLNVAL;
        }
      continue;
    }
    break;
  }
  if (ready > 0)
    for (f = fds; f < &fds[nfds]; ++f) {
      if (f->fd >= 0) {
        if (FD_ISSET(f->fd, rset))
          f->revents |= POLLIN;
        if (FD_ISSET(f->fd, wset))
          f->revents |= POLLOUT;
        if (FD_ISSET(f->fd, xset))
          f->revents |= POLLPRI;
      }
    }
  return ready;
}
```