user: What would the C source look like for the assembly code provided here?

```asm
<copy_file_to_file>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  mov    D46(%rip),%rax
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <open@plt>
  cmp    $0xffffffff,%eax
  je     L107
  lea    -0x3c(%rbp),%rsi
  mov    %eax,%edi
  mov    %eax,%r13d
  call   <fstat@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L146
  mov    D58(%rip),%rax
  mov    D55(%rip),%r15
  mov    %r14,%rdi
  mov    D56(%rip),%r12
  mov    -0x3c(%rbp),%edx
  mov    (%r15),%esi
  or     (%rax),%esi
  xor    %eax,%eax
  or     (%r12),%esi
  call   <open@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L96
L132:
  mov    %ebx,%esi
  mov    %r13d,%edi
  call   <copy_fd_to_fd@plt>
  mov    %r13d,%edi
  mov    %eax,%r12d
  call   <close@plt>
  mov    %ebx,%edi
  call   <close@plt>
L74:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L121
  lea    -0x28(%rbp),%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L96:
  mov    D85(%rip),%rax
  mov    D29(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L23
L20:
  mov    %r13d,%edi
  mov    $0xffffffff,%r12d
  call   <close@plt>
  jmp    L74
  cs nopw 0x0(%rax,%rax,1)
L23:
  mov    D6(%rip),%rax
  mov    %rsp,%rsi
  mov    %rsp,%rbx
  movslq (%rax),%rax
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  and    $0xfffffffffffffff0,%rdx
  sub    %rax,%rsi
L126:
  cmp    %rsi,%rsp
  je     L52
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L126
  nopl   0x0(%rax,%rax,1)
L52:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L147
  orq    $0x0,-0x8(%rsp,%rdx,1)
L147:
  mov    %rsp,%rsi
  mov    %r14,%rdi
  call   <path_dirname@plt>
  mov    D37(%rip),%rax
  mov    %rsp,%rdi
  mov    (%rax),%esi
  call   <create_dir@plt>
  test   %rax,%rax
  jne    L69
  mov    %rbx,%rsp
  jmp    L20
L69:
  mov    D58(%rip),%rax
  mov    -0x3c(%rbp),%edx
  mov    %r14,%rdi
  mov    (%r15),%esi
  or     (%rax),%esi
  xor    %eax,%eax
  or     (%r12),%esi
  call   <open@plt>
  mov    %rbx,%rsp
  cmp    $0xffffffff,%eax
  je     L20
  mov    %eax,%ebx
  jmp    L132
  nopl   (%rax)
L107:
  mov    $0xffffffff,%r12d
  jmp    L74
L146:
  mov    %r13d,%edi
  call   <close@plt>
  jmp    L74
L121:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int64_t copy_file_to_file(const char *input, const char *output) {
  int in = open(input, O_RDONLY);
  if (in == -1)
    return -1;
  struct stat info;
  if (fstat(in, &info) == -1) {
    close(in);
    return -1;
  }
  int out = open(output, O_WRONLY | O_CREAT | O_TRUNC, info.st_mode);
  if (out == -1 && errno == ENOTDIR) {
    char dir[PATH_MAX];
    path_dirname(output, dir);
    if (create_dir(dir, S_IRWXU)) {
      out = open(output, O_WRONLY | O_CREAT | O_TRUNC, info.st_mode);
    }
  }
  if (out == -1) {
    close(in);
    return -1;
  }
  int64_t total = copy_fd_to_fd(in, out);
  close(in);
  close(out);
  return total;
}
```