user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<cp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1028(%rsp)
  mov    D35(%rip),%rax
  mov    %rsi,%rbp
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <open@plt>
  test   %eax,%eax
  js     L56
  mov    %eax,%edi
  lea    0x1c(%rsp),%rsi
  mov    %eax,%r12d
  call   <fstat@plt>
  mov    0x1c(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  jne    L11
  mov    D2(%rip),%rax
  mov    0x1c(%rsp),%edx
  mov    %rbp,%rdi
  mov    (%rax),%esi
  mov    D3(%rip),%rax
  or     (%rax),%esi
  mov    D79(%rip),%rax
  or     (%rax),%esi
  xor    %eax,%eax
  call   <open@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  js     L11
  lea    0x20(%rsp),%rbx
L45:
  mov    $0x1000,%edx
  mov    %rbx,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  jle    L36
  mov    %rbx,%r14
  nopl   0x0(%rax)
L147:
  mov    %r13d,%edx
  mov    %r14,%rsi
  mov    %ebp,%edi
  call   <write@plt>
  test   %eax,%eax
  js     L22
  sub    %eax,%r13d
  cltq
  add    %rax,%r14
  test   %r13d,%r13d
  jg     L147
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L22:
  mov    D21(%rip),%r15
  mov    D33(%rip),%rax
  mov    (%r15),%edx
  cmp    (%rax),%edx
  je     L147
L24:
  mov    %r12d,%edi
  mov    %edx,0xc(%rsp)
  call   <close@plt>
  mov    %ebp,%edi
  call   <close@plt>
  mov    0xc(%rsp),%edx
L30:
  mov    %edx,(%r15)
  mov    $0xffffffff,%r13d
L88:
  mov    0x1028(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L52
  add    $0x1038,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L36:
  jne    L129
  mov    %ebp,%edi
  call   <close@plt>
  test   %eax,%eax
  js     L11
  mov    %ebp,%edi
  call   <fsync@plt>
  mov    %r12d,%edi
  call   <close@plt>
  jmp    L88
L11:
  mov    D21(%rip),%r15
  mov    %r12d,%edi
  mov    (%r15),%edx
  mov    %edx,0xc(%rsp)
  call   <close@plt>
  mov    0xc(%rsp),%edx
  jmp    L30
L56:
  mov    $0xffffffff,%r13d
  jmp    L88
L129:
  mov    D21(%rip),%r15
  mov    (%r15),%edx
  jmp    L24
L52:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cp(const char *from, const char *to) {
  int fd_to, fd_from;
  char buf[4096];
  ssize_t nread;
  int saved_errno;
  struct stat sb;
  fd_from = open(from, O_RDONLY);
  if (fd_from < 0)
    return -1;
  fstat(fd_from, &sb);
  if (S_ISDIR(sb.st_mode)) {
    fd_to = -1;
    goto out_error;
  }
  fd_to = open(to, O_WRONLY | O_CREAT | O_EXCL, sb.st_mode);
  if (fd_to < 0)
    goto out_error;
  while (nread = read(fd_from, buf, sizeof buf), nread > 0) {
    char *out_ptr = buf;
    ssize_t nwritten;
    do {
      nwritten = write(fd_to, out_ptr, nread);
      if (nwritten >= 0) {
        nread -= nwritten;
        out_ptr += nwritten;
      } else if (errno != EINTR) {
        goto out_error;
      }
    } while (nread > 0);
  }
  if (nread == 0) {
    if (close(fd_to) < 0) {
      fd_to = -1;
      goto out_error;
    } else {
      fsync(fd_to);
    }
    close(fd_from);
    return 0;
  }
out_error:
  saved_errno = errno;
  close(fd_from);
  if (fd_to >= 0)
    close(fd_to);
  errno = saved_errno;
  return -1;
}
```