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

```asm
<confctl_save_atomic>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  mov    -0x40(%rbp),%rdx
  lea    -0x18(%rbp),%rax
  lea    D63(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <asprintf@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jns    L73
  lea    D84(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L73:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <mkstemp@plt>
  mov    %eax,-0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  jns    L66
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdx
  lea    D7(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L66:
  mov    -0x20(%rbp),%eax
  lea    D57(%rip),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <fdopen@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L38
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_tmpfile@plt>
  lea    D23(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L38:
  mov    -0x10(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <confctl_write@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fflush@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L20
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_tmpfile@plt>
  lea    D16(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L20:
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <fsync@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L19
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_tmpfile@plt>
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L19:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L25
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_tmpfile@plt>
  lea    D74(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L25:
  mov    -0x18(%rbp),%rax
  mov    -0x40(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <rename@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L2
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_tmpfile@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdx
  lea    D34(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <err@plt>
L2:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L31
  call   <__stack_chk_fail@plt>
L31:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D63
type_infered: string
name: disassemble_data
arguments: label: D84
type_infered: string
name: disassemble_data
arguments: label: D7
type_infered: string
name: disassemble_data
arguments: label: D57
type_infered: string
name: disassemble_data
arguments: label: D23
type_infered: string
name: disassemble_data
arguments: label: D16
type_infered: string
name: disassemble_data
arguments: label: D33
type_infered: string
name: disassemble_data
arguments: label: D74
type_infered: string
name: disassemble_data
arguments: label: D34
type_infered: string

tool: D63: %s.XXXXXXXXX

tool: D84: asprintf

tool: D7: cannot create temporary file %s; use -I to rewrite file in place

tool: D57: w

tool: D23: fdopen

tool: D16: fflush

tool: D33: fsync

tool: D74: fclose

tool: D34: cannot replace %s; use -I to rewrite file in place

assistant: ```c
void confctl_save_atomic(struct confctl *cc, const char *path) {
  FILE *fp;
  int error, fd, written;
  char *tmppath = NULL;
  written = asprintf(&tmppath, "%s.XXXXXXXXX", path);
  if (written < 0)
    err(1, "asprintf");
  fd = mkstemp(tmppath);
  if (fd < 0)
    err(1, "cannot create temporary file %s; use -I to rewrite file in place", tmppath);
  fp = fdopen(fd, "w");
  if (fp == NULL) {
    remove_tmpfile(tmppath);
    err(1, "fdopen");
  }
  confctl_write(cc, fp);
  error = fflush(fp);
  if (error != 0) {
    remove_tmpfile(tmppath);
    err(1, "fflush");
  }
  error = fsync(fd);
  if (error != 0) {
    remove_tmpfile(tmppath);
    err(1, "fsync");
  }
  error = fclose(fp);
  if (error != 0) {
    remove_tmpfile(tmppath);
    err(1, "fclose");
  }
  error = rename(tmppath, path);
  if (error != 0) {
    remove_tmpfile(tmppath);
    err(1, "cannot replace %s; use -I to rewrite file in place", path);
  }
}
```