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

```asm
<get_user_cache_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    D0(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L45
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L50
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L2
L50:
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
L45:
  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    L37
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L2
L37:
  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     L43
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D5(%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>
L43:
  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)
L2:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D0
type_infered: string
name: read_data
arguments: data_label: D34
type_infered: string
name: read_data
arguments: data_label: D5
type_infered: string

tool: D0: XDG_CACHE_HOME

tool: D34: HOME

tool: D5: .cache/

assistant: ```c
void get_user_cache_folder(char *out, unsigned int maxlen, const char *appname) {
  const char *out_orig = out;
  char *home = getenv("XDG_CACHE_HOME");
  unsigned int config_len = 0;
  if (!home) {
    home = getenv("HOME");
    if (!home) {
      out[0] = 0;
      return;
    }
    config_len = strlen(".cache/");
  }
  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, ".cache/", 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;
}
```