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

```asm
<usys_select>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  mov    %r9,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rsi,0x10(%rsp)
  lea    0x28(%rsp),%rbp
  lea    0x2c(%rsp),%rbx
  mov    %r8d,0x1c(%rsp)
  mov    %rbp,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <FD_ZERO@plt>
  mov    %rbx,%rdi
  call   <FD_ZERO@plt>
  imul   $0x3e8,%r14d,%eax
  mov    (%r12),%edi
  movq   $0x0,0x38(%rsp)
  mov    %eax,0x30(%rsp)
  movslq 0x1c(%rsp),%rax
  test   %eax,%eax
  jle    L153
  lea    (%r12,%rax,4),%r8
  mov    %edi,%r14d
  mov    %r12,%rcx
  jmp    L41
  nopl   0x0(%rax,%rax,1)
L142:
  mov    (%rcx),%edi
L41:
  test   %edi,%edi
  js     L49
  mov    %rbp,%rsi
  mov    %r8,0x8(%rsp)
  mov    %rcx,(%rsp)
  call   <FD_SET@plt>
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%r8
  mov    (%rcx),%edi
L49:
  cmp    %edi,%r14d
  cmovl  %edi,%r14d
  add    $0x4,%rcx
  cmp    %r8,%rcx
  jne    L142
L25:
  mov    0x90(%rsp),%edx
  test   %edx,%edx
  jle    L63
  movslq 0x90(%rsp),%rax
  mov    %r13,%rcx
  lea    0x0(%r13,%rax,4),%r8
  nopl   (%rax)
L46:
  mov    (%rcx),%edi
  test   %edi,%edi
  js     L110
  mov    %rbx,%rsi
  mov    %r8,0x8(%rsp)
  mov    %rcx,(%rsp)
  call   <FD_SET@plt>
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%r8
  mov    (%rcx),%edi
L110:
  cmp    %edi,%r14d
  cmovl  %edi,%r14d
  add    $0x4,%rcx
  cmp    %r8,%rcx
  jne    L46
L63:
  xor    %ecx,%ecx
  lea    0x1(%r14),%edi
  lea    0x30(%rsp),%r8
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  call   <select@plt>
  test   %eax,%eax
  js     L146
  movslq 0x1c(%rsp),%rdx
  xor    %r14d,%r14d
  mov    %rdx,(%rsp)
  test   %edx,%edx
  jle    L78
  nopl   0x0(%rax,%rax,1)
L108:
  mov    (%r12,%r14,4),%edi
  mov    %rbp,%rsi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L65
  mov    $0x1,%eax
  mov    %r14d,%ecx
  shl    %cl,%eax
  or     %eax,(%r15)
L65:
  add    $0x1,%r14
  cmp    %r14,(%rsp)
  jne    L108
L78:
  mov    0x90(%rsp),%eax
  xor    %r15d,%r15d
  movslq 0x90(%rsp),%rbp
  mov    $0x1,%r12d
  test   %eax,%eax
  jle    L146
  nopl   0x0(%rax)
L59:
  mov    0x0(%r13,%r15,4),%edi
  mov    %rbx,%rsi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L145
  mov    0x10(%rsp),%rdx
  mov    %r12d,%eax
  mov    %r15d,%ecx
  shl    %cl,%eax
  or     %eax,(%rdx)
L145:
  add    $0x1,%r15
  cmp    %r15,%rbp
  jne    L59
L146:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L88
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L153:
  mov    %edi,%r14d
  jmp    L25
L88:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint32_t usys_select(uint32_t *rmask, uint32_t *wmask, int time, int *reads, int nreads, int *writes, int nwrites) {
  int *sock_p, max_fd, err;
  fd_set readfds, writefds;
  struct timeval tv;
  FD_ZERO(&readfds);
  FD_ZERO(&writefds);
  tv.tv_sec = 0;
  tv.tv_usec = (time * 1000);
  sock_p = reads;
  max_fd = *sock_p;
  for (int i = 0; i < nreads; i++) {
    if (*sock_p >= 0)
      FD_SET(*sock_p, &readfds);
    if (*sock_p > max_fd)
      max_fd = *sock_p;
    sock_p++;
  }
  sock_p = writes;
  for (int i = 0; i < nwrites; i++) {
    if (*sock_p >= 0)
      FD_SET(*sock_p, &writefds);
    if (*sock_p > max_fd)
      max_fd = *sock_p;
    sock_p++;
  }
  err = select(max_fd + 1, &readfds, &writefds, NULL, &tv);
  if (err < 0)
    return 0;
  sock_p = reads;
  for (int i = 0; i < nreads; i++) {
    if (FD_ISSET(*sock_p, &readfds))
      *rmask |= (0x01 << i);
    sock_p++;
  }
  sock_p = writes;
  for (int i = 0; i < nwrites; i++) {
    if (FD_ISSET(*sock_p, &writefds))
      *wmask |= (0x01 << i);
    sock_p++;
  }
  return 0;
}
```