user: Demonstrate the C code that generates the assembly output below:

```asm
<write_file>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x108,%rsp
  mov    %rdi,-0x108(%rbp)
  mov    %rsi,-0x110(%rbp)
  mov    %rdx,-0x118(%rbp)
  mov    %rcx,-0xb8(%rbp)
  mov    %r8,-0xb0(%rbp)
  mov    %r9,-0xa8(%rbp)
  test   %al,%al
  je     L85
  movaps %xmm0,-0xa0(%rbp)
  movaps %xmm1,-0x90(%rbp)
  movaps %xmm2,-0x80(%rbp)
  movaps %xmm3,-0x70(%rbp)
  movaps %xmm4,-0x60(%rbp)
  movaps %xmm5,-0x50(%rbp)
  movaps %xmm6,-0x40(%rbp)
  movaps %xmm7,-0x30(%rbp)
L85:
  mov    %fs:0x28,%rax
  mov    %rax,-0xd8(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  movl   $0x0,-0xf8(%rbp)
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0xe8(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L20:
  cmp    %rdx,%rsp
  je     L47
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L20
L47:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L29
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L29:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0xe0(%rbp)
  mov    -0x118(%rbp),%rdx
  mov    -0xf4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    D23(%rip),%rax
  mov    (%rax),%esi
  mov    -0xf4(%rbp),%ecx
  mov    -0x118(%rbp),%rdx
  mov    -0xe0(%rbp),%rax
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    %eax,-0xf0(%rbp)
  mov    -0xf4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  cmpl   $0x0,-0xf0(%rbp)
  jns    L8
  mov    $0xffffffff,%eax
  jmp    L10
L8:
  mov    D7(%rip),%rax
  mov    (%rax),%edx
  mov    -0xe0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0xec(%rbp)
  cmpl   $0x0,-0xec(%rbp)
  jns    L6
  movl   $0xffffffff,-0xf8(%rbp)
  jmp    L65
L6:
  mov    -0x110(%rbp),%rdx
  mov    -0x108(%rbp),%rcx
  mov    -0xec(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    %eax,-0xf0(%rbp)
  mov    -0xf0(%rbp),%eax
  cltq
  cmp    %rax,-0x110(%rbp)
  je     L62
  movl   $0xffffffff,-0xf8(%rbp)
  jmp    L65
L62:
  nop
L65:
  mov    -0xec(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0xf8(%rbp),%eax
L10:
  mov    %rbx,%rsp
  mov    -0xd8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L86
  call   <__stack_chk_fail@plt>
L86:
  lea    -0x18(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

assistant: ```c
int write_file(char *data, size_t data_len, char *pathfmt, ...) {
  int fd, len, ret = 0;
  char path[PATH_MAX];
  va_list ap;
  va_start(ap, pathfmt);
  len = vsnprintf(path, PATH_MAX, pathfmt, ap);
  va_end(ap);
  if (len < 0)
    return -1;
  fd = open(path, O_RDWR);
  if (fd < 0) {
    ret = -1;
    goto out;
  }
  len = write(fd, data, data_len);
  if (len != data_len) {
    ret = -1;
    goto out;
  }
out:
  close(fd);
  return ret;
}
```