user: Converte this assembly snippet into its equivalent C code:

```asm
<copyLoop>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x840,%rsp
  mov    %edi,-0x834(%rbp)
  mov    %rsi,-0x840(%rbp)
  mov    %edx,-0x838(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D34(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x81c(%rbp)
  movl   $0x0,-0x830(%rbp)
  movl   $0x0,-0x82c(%rbp)
  movq   $0x0,-0x810(%rbp)
  movq   $0x0,-0x808(%rbp)
  lea    -0x800(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7e,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  movq   $0x0,-0x410(%rbp)
  movq   $0x0,-0x408(%rbp)
  lea    -0x400(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7e,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  cmpq   $0x0,-0x840(%rbp)
  je     L68
  cmpl   $0x0,-0x838(%rbp)
  je     L68
  mov    -0x840(%rbp),%rdx
  mov    -0x838(%rbp),%ecx
  lea    -0x830(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <RC4_set_key@plt>
  mov    -0x840(%rbp),%rdx
  mov    -0x838(%rbp),%ecx
  lea    -0x82c(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <RC4_set_key@plt>
L19:
  movl   $0x0,-0x828(%rbp)
  movl   $0xffffffff,-0x824(%rbp)
  movl   $0xffffffff,-0x820(%rbp)
  lea    -0x828(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  mov    D39(%rip),%rax
  mov    (%rax),%eax
  lea    -0x828(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  lea    -0x828(%rbp),%rdx
  mov    -0x834(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  mov    -0x834(%rbp),%eax
  lea    0x1(%rax),%edi
  lea    -0x828(%rbp),%rax
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  call   <select@plt>
  test   %rax,%rax
  jle    L84
  mov    D39(%rip),%rax
  mov    (%rax),%eax
  lea    -0x828(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L53
  mov    D39(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x824(%rbp)
  mov    -0x834(%rbp),%eax
  mov    %eax,-0x820(%rbp)
  jmp    L84
L53:
  lea    -0x828(%rbp),%rdx
  mov    -0x834(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L84
  mov    -0x834(%rbp),%eax
  mov    %eax,-0x824(%rbp)
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x820(%rbp)
L84:
  cmpl   $0xffffffff,-0x824(%rbp)
  je     L19
  cmpl   $0xffffffff,-0x820(%rbp)
  je     L19
  movq   $0x0,-0x818(%rbp)
  lea    -0x810(%rbp),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  call   <bzero@plt>
  lea    -0x410(%rbp),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  call   <bzero@plt>
  lea    -0x810(%rbp),%rcx
  mov    -0x824(%rbp),%eax
  mov    $0x400,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %rax,-0x818(%rbp)
  cmpq   $0x0,-0x818(%rbp)
  je     L46
  mov    -0x820(%rbp),%eax
  cmp    -0x834(%rbp),%eax
  jne    L102
  lea    -0x830(%rbp),%rax
  jmp    L91
L102:
  lea    -0x82c(%rbp),%rax
L91:
  lea    -0x410(%rbp),%rcx
  lea    -0x810(%rbp),%rdx
  mov    -0x818(%rbp),%rsi
  mov    %rax,%rdi
  call   <RC4@plt>
  mov    -0x818(%rbp),%rdx
  lea    -0x410(%rbp),%rcx
  mov    -0x820(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    -0x820(%rbp),%eax
  mov    %eax,%edi
  call   <fsync@plt>
  jmp    L19
L46:
  nop
L68:
  mov    -0x81c(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L82
  call   <__stack_chk_fail@plt>
L82:
  leave
  ret
```

assistant: ```c
int copyLoop(int s, char *pKey, int nKeyLen) {
  int nRetVal = EXIT_FAILURE;
  RC4_KEY sEKey = {0};
  RC4_KEY sDKey = {0};
  char pPlain[(1024)] = {0};
  char pCipher[(1024)] = {0};
  if (pKey && nKeyLen) {
    RC4_set_key(&sEKey, nKeyLen, pKey);
    RC4_set_key(&sDKey, nKeyLen, pKey);
    while (true) {
      fd_set set = {0};
      int from = -1, to = -1;
      FD_ZERO(&set);
      FD_SET(STDIN_FILENO, &set);
      FD_SET(s, &set);
      if (0 < select(s + 1, &set, NULL, NULL, NULL)) {
        if (FD_ISSET(STDIN_FILENO, &set)) {
          from = STDIN_FILENO;
          to = s;
        } else if (FD_ISSET(s, &set)) {
          from = s;
          to = STDOUT_FILENO;
        }
      }
      if (-1 != from && -1 != to) {
        ssize_t len = 0;
        bzero(pPlain, (1024));
        bzero(pCipher, (1024));
        len = read(from, pPlain, (1024));
        if (len) {
          RC4((to == s) ? &sEKey : &sDKey, len, pPlain, pCipher);
          write(to, pCipher, len);
          fsync(to);
        } else {
          break;
        }
      }
    }
  }
  return nRetVal;
}
```