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

```asm
<get_user_data_folder>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L48
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L46
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L19
L46:
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
L48:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  add    %eax,%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  add    $0x3,%eax
  cmp    %eax,-0x2c(%rbp)
  jae    L29
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L19
L29:
  mov    -0x18(%rbp),%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%eax
  add    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movb   $0x2f,(%rax)
  addq   $0x1,-0x28(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L24
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D9(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x1c(%rbp),%eax
  add    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  mov    $0x1ed,%esi
  mov    %rax,%rdi
  call   <mkdir@plt>
L24:
  mov    -0x14(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x14(%rbp),%eax
  add    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  mov    $0x1ed,%esi
  mov    %rax,%rdi
  call   <mkdir@plt>
  mov    -0x28(%rbp),%rax
  movb   $0x2f,(%rax)
  addq   $0x1,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
L19:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D8
datatype: string
name: parse_data
arguments: data_tag: D7
datatype: string
name: parse_data
arguments: data_tag: D9
datatype: string

tool: D8: XDG_DATA_HOME

tool: D7: HOME

tool: D9: .local/share/

assistant: ```c
void get_user_data_folder(char *out, unsigned int maxlen, const char *appname) {
  const char *out_orig = out;
  char *home = getenv("XDG_DATA_HOME");
  unsigned int config_len = 0;
  if (!home) {
    home = getenv("HOME");
    if (!home) {
      out[0] = 0;
      return;
    }
    config_len = strlen(".local/share/");
  }
  unsigned int home_len = strlen(home);
  unsigned int appname_len = strlen(appname);
  if (home_len + 1 + config_len + appname_len + 1 + 1 > maxlen) {
    out[0] = 0;
    return;
  }
  memcpy(out, home, home_len);
  out += home_len;
  *out = '/';
  out++;
  if (config_len) {
    memcpy(out, ".local/share/", config_len);
    out += config_len;
    *out = '\0';
    mkdir(out_orig, 0755);
  }
  memcpy(out, appname, appname_len);
  out += appname_len;
  *out = '\0';
  mkdir(out_orig, 0755);
  *out = '/';
  out++;
  *out = 0;
}
```