user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<get_user_config_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    D14(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L46
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L45
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L16
L45:
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
L46:
  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    L3
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L16
L3:
  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     L22
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D18(%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>
L22:
  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)
L16:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D14
type_guessed: string
name: disassemble_data
arguments: tag: D25
type_guessed: string
name: disassemble_data
arguments: tag: D18
type_guessed: string

tool: D14: XDG_CONFIG_HOME

tool: D25: HOME

tool: D18: .config/

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