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

```asm
<smm_config_path>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  lea    D60(%rip),%rdi
  sub    $0x18,%rsp
  mov    %rcx,0x8(%rsp)
  mov    %r8d,0x4(%rsp)
  call   <getenv@plt>
  cmp    $0x1,%ebx
  je     L103
  cmp    $0x2,%ebx
  je     L125
  test   %ebx,%ebx
  je     L64
  test   %r12,%r12
  je     L112
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D164(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <mem_copy@plt>
  add    %eax,%r12d
L34:
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%ebx
  call   <mem_copy@plt>
  add    %r12d,%ebx
  add    %eax,%ebx
  jmp    L28
  nopw   0x0(%rax,%rax,1)
L103:
  test   %rax,%rax
  je     L176
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  mov    %rax,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D164(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  add    %eax,%r14d
  test   %r12,%r12
  je     L25
L5:
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D164(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%ebx
  lea    (%rbx,%r14,1),%eax
  mov    %eax,(%rsp)
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  lea    D18(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <mem_copy@plt>
  mov    (%rsp),%ecx
  lea    (%rcx,%rbx,1),%r12d
  add    %r14d,%r12d
  add    %r13d,%r12d
  add    %eax,%r12d
  jmp    L58
  nopw   0x0(%rax,%rax,1)
L64:
  test   %rax,%rax
  je     L120
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  mov    %rax,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D164(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  add    %eax,%r14d
L24:
  lea    D90(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  add    %eax,%r14d
  test   %r12,%r12
  je     L166
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D164(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%ebx
  lea    (%rbx,%r14,1),%eax
  mov    %eax,(%rsp)
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  lea    D14(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <mem_copy@plt>
  add    (%rsp),%ebx
  add    %r14d,%ebx
  add    %r13d,%ebx
  lea    (%rbx,%rax,1),%r12d
L58:
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D104(%rip),%rdx
  mov    %rax,%rbx
  jmp    L150
L125:
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  lea    D109(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  mov    %rax,%r14
  test   %r12,%r12
  je     L44
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D164(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%ebx
  lea    (%rbx,%r14,1),%eax
  mov    %eax,(%rsp)
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <mem_copy@plt>
  lea    D14(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <mem_copy@plt>
  mov    (%rsp),%ecx
  lea    (%rcx,%rbx,1),%r12d
  add    %r14d,%r12d
  add    %r13d,%r12d
  add    %eax,%r12d
L29:
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D55(%rip),%rdx
  mov    %rax,%rbx
L150:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  add    %eax,%ebx
  add    %r12d,%ebx
L28:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  xor    %edx,%edx
  call   <mem_copy@plt>
  mov    %r15,%rsi
  mov    %rbp,%rdi
  xor    %edx,%edx
  add    %eax,%ebx
  call   <mem_copy@plt>
  add    $0x18,%rsp
  add    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L120:
  xor    %r14d,%r14d
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L176:
  xor    %r14d,%r14d
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  test   %r12,%r12
  jne    L5
L25:
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <mem_copy@plt>
  lea    D18(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%r12d
  call   <mem_copy@plt>
  add    %r14d,%r12d
  add    %eax,%r12d
  jmp    L58
  nopl   0x0(%rax)
L112:
  xor    %r12d,%r12d
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  jmp    L34
  nopw   0x0(%rax,%rax,1)
L44:
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <mem_copy@plt>
  lea    D14(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%r12d
  call   <mem_copy@plt>
  add    %r14d,%r12d
  add    %eax,%r12d
  jmp    L29
  cs nopw 0x0(%rax,%rax,1)
L166:
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <mem_copy@plt>
  lea    D14(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%r12d
  call   <mem_copy@plt>
  add    %r14d,%r12d
  add    %eax,%r12d
  jmp    L58
```

tool_calls: name: unpack_data
arguments: data_tag: D60
data_type: string
name: unpack_data
arguments: data_tag: D164
data_type: string
name: unpack_data
arguments: data_tag: D18
data_type: string
name: unpack_data
arguments: data_tag: D90
data_type: string
name: unpack_data
arguments: data_tag: D14
data_type: string
name: unpack_data
arguments: data_tag: D104
data_type: string
name: unpack_data
arguments: data_tag: D109
data_type: string
name: unpack_data
arguments: data_tag: D55
data_type: string

tool: D60: HOME

tool: D164: /

tool: D18: CONSOLE\

tool: D90: .config/

tool: D14: SOFTWARE\

tool: D104: HKEY_CURRENT_USER

tool: D109: /etc/

tool: D55: HKEY_LOCAL_MACHINE

assistant: ```c
int smm_config_path(int sysdir, char *path, char *fname, char *buf, int blen) {
  char *home;
  int len = 0;
  home = getenv("HOME");
  switch (sysdir) {
  case 1:
    if (home) {
      len += mem_copy(&buf, &blen, home);
      len += mem_copy(&buf, &blen, "/");
    }
    if (path) {
      len += mem_copy(&buf, &blen, path);
      len += mem_copy(&buf, &blen, "/");
    }
    len += mem_copy(&buf, &blen, fname);
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, "CONSOLE\\");
    if (path) {
      len += mem_copy(&buf, &blen, path);
    }
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, "HKEY_CURRENT_USER");
    len += mem_copy(&buf, &blen, NULL);
    break;
  case 2:
    len += mem_copy(&buf, &blen, "/etc/");
    if (path) {
      len += mem_copy(&buf, &blen, path);
      len += mem_copy(&buf, &blen, "/");
    }
    len += mem_copy(&buf, &blen, fname);
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, "SOFTWARE\\");
    if (path) {
      len += mem_copy(&buf, &blen, path);
    }
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, "HKEY_LOCAL_MACHINE");
    len += mem_copy(&buf, &blen, NULL);
    break;
  case 0:
    if (home) {
      len += mem_copy(&buf, &blen, home);
      len += mem_copy(&buf, &blen, "/");
    }
    len += mem_copy(&buf, &blen, ".config/");
    if (path) {
      len += mem_copy(&buf, &blen, path);
      len += mem_copy(&buf, &blen, "/");
    }
    len += mem_copy(&buf, &blen, fname);
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, "SOFTWARE\\");
    if (path) {
      len += mem_copy(&buf, &blen, path);
    }
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, "HKEY_CURRENT_USER");
    len += mem_copy(&buf, &blen, NULL);
    break;
  case 3:
  default:
    if (path) {
      len += mem_copy(&buf, &blen, path);
      len += mem_copy(&buf, &blen, "/");
    }
    len += mem_copy(&buf, &blen, fname);
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, NULL);
    len += mem_copy(&buf, &blen, NULL);
    break;
  }
  len += mem_copy(&buf, &blen, NULL);
  return len;
}
```