user: 请从给定的汇编指令推导出C源代码:

```asm
<fd_timed_read_n>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8d,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x44(%rbp)
  js     L73
  cmpq   $0x0,-0x50(%rbp)
  jne    L233
L73:
  mov    D62(%rip),%rax
  mov    (%rax),%rdx
  mov    D123(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L168
L233:
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x44(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    D21(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x48(%rbp)
  je     L134
  cmpq   $0x0,-0x20(%rbp)
  je     L134
  movl   $0xffffffff,-0x34(%rbp)
  jmp    L240
L266:
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <_fd_get_poll_timeout@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%edx
  lea    -0x14(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <poll@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  jns    L74
  mov    D123(%rip),%rax
  mov    (%rax),%rdx
  mov    D143(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L179
  mov    D123(%rip),%rax
  mov    (%rax),%rdx
  mov    D61(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L115
  jmp    L179
L115:
  mov    $0xffffffff,%eax
  jmp    L168
L74:
  cmpl   $0x0,-0x2c(%rbp)
  jne    L97
  mov    D71(%rip),%rax
  mov    (%rax),%rdx
  mov    D123(%rip),%rax
  mov    %rdx,(%rax)
  jmp    L106
L97:
  mov    -0xc(%rbp),%edx
  mov    D128(%rip),%rax
  mov    (%rax),%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L205
  mov    D109(%rip),%rax
  mov    (%rax),%rdx
  mov    D123(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L168
L205:
  mov    -0xc(%rbp),%edx
  mov    D88(%rip),%rax
  mov    (%rax),%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L56
  mov    D6(%rip),%rax
  mov    (%rax),%rdx
  mov    D123(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L168
L56:
  mov    -0xc(%rbp),%edx
  mov    D21(%rip),%rax
  mov    (%rax),%eax
  and    %edx,%eax
  mov    %eax,%edi
  call   <assert@plt>
L240:
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x30(%rbp)
  cmpl   $0x0,-0x30(%rbp)
  jns    L271
  mov    D123(%rip),%rax
  mov    (%rax),%rdx
  mov    D143(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L219
  mov    D123(%rip),%rax
  mov    (%rax),%rdx
  mov    D61(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L219
  mov    $0xffffffff,%eax
  jmp    L168
L271:
  cmpl   $0x0,-0x30(%rbp)
  je     L3
  mov    -0x30(%rbp),%eax
  cltq
  sub    %rax,-0x20(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  add    %rax,-0x28(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  je     L113
  jmp    L179
L134:
  nop
  jmp    L179
L219:
  nop
L179:
  cmpq   $0x0,-0x20(%rbp)
  jne    L266
  jmp    L106
L3:
  nop
  jmp    L106
L113:
  nop
L106:
  mov    -0x58(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
L168:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L187
  call   <__stack_chk_fail@plt>
L187:
  leave
  ret
```

assistant: ```c
ssize_t fd_timed_read_n(int fd, void *buf, size_t n, const struct timeval *when, int do_skip_first_poll) {
  unsigned char *p;
  int msecs;
  struct pollfd pfd;
  int nfd;
  size_t nleft;
  ssize_t nread;
  if ((fd < 0) || (buf == NULL)) {
    errno = EINVAL;
    return (-1);
  }
  p = buf;
  nleft = n;
  pfd.fd = fd;
  pfd.events = POLLIN;
  if (do_skip_first_poll && (nleft > 0)) {
    msecs = -1;
    goto read_me;
  }
  while (nleft > 0) {
    msecs = _fd_get_poll_timeout(when);
    nfd = poll(&pfd, 1, msecs);
    if (nfd < 0) {
      if ((errno == EINTR) || (errno == EAGAIN))
        continue;
      else
        return (-1);
    } else if (nfd == 0) {
      errno = ETIMEDOUT;
      break;
    } else if (pfd.revents & POLLNVAL) {
      errno = EBADF;
      return (-1);
    } else if (pfd.revents & POLLERR) {
      errno = EIO;
      return (-1);
    }
    assert(pfd.revents & POLLIN);
  read_me:
    nread = read(fd, p, nleft);
    if (nread < 0) {
      if ((errno == EINTR) || (errno == EAGAIN))
        continue;
      else
        return (-1);
    } else if (nread == 0) {
      break;
    }
    nleft -= nread;
    p += nread;
    if (msecs == 0) {
      break;
    }
  }
  return (n - nleft);
}
```