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

```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    D89(%rip),%rdi
  sub    $0x18,%rsp
  mov    %rcx,0x8(%rsp)
  mov    %r8d,0x4(%rsp)
  call   <getenv@plt>
  cmp    $0x1,%ebx
  je     L171
  cmp    $0x2,%ebx
  je     L170
  test   %ebx,%ebx
  je     L86
  test   %r12,%r12
  je     L43
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D167(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <mem_copy@plt>
  add    %eax,%r12d
L91:
  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    L42
  nopw   0x0(%rax,%rax,1)
L171:
  test   %rax,%rax
  je     L112
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  mov    %rax,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D167(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  add    %eax,%r14d
  test   %r12,%r12
  je     L101
L45:
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D167(%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    D75(%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    L144
  nopw   0x0(%rax,%rax,1)
L86:
  test   %rax,%rax
  je     L19
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  mov    %rax,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D167(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r14
  call   <mem_copy@plt>
  add    %eax,%r14d
L15:
  lea    D133(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  add    %eax,%r14d
  test   %r12,%r12
  je     L47
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D167(%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    D152(%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
L144:
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D73(%rip),%rdx
  mov    %rax,%rbx
  jmp    L153
L170:
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  lea    D129(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  mov    %rax,%r14
  test   %r12,%r12
  je     L164
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D167(%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    D152(%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
L16:
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  lea    D85(%rip),%rdx
  mov    %rax,%rbx
L153:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <mem_copy@plt>
  add    %eax,%ebx
  add    %r12d,%ebx
L42:
  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)
L19:
  xor    %r14d,%r14d
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  jmp    L15
  nopw   0x0(%rax,%rax,1)
L112:
  xor    %r14d,%r14d
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  test   %r12,%r12
  jne    L45
L101:
  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    D75(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%r12d
  call   <mem_copy@plt>
  add    %r14d,%r12d
  add    %eax,%r12d
  jmp    L144
  nopl   0x0(%rax)
L43:
  xor    %r12d,%r12d
  lea    0x4(%rsp),%r15
  lea    0x8(%rsp),%rbp
  jmp    L91
  nopw   0x0(%rax,%rax,1)
L164:
  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    D152(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%r12d
  call   <mem_copy@plt>
  add    %r14d,%r12d
  add    %eax,%r12d
  jmp    L16
  cs nopw 0x0(%rax,%rax,1)
L47:
  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    D152(%rip),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  add    %eax,%r12d
  call   <mem_copy@plt>
  add    %r14d,%r12d
  add    %eax,%r12d
  jmp    L144
```

tool_calls: name: parse_data
arguments: label: D89
type_guessed: string
name: parse_data
arguments: label: D167
type_guessed: string
name: parse_data
arguments: label: D75
type_guessed: string
name: parse_data
arguments: label: D133
type_guessed: string
name: parse_data
arguments: label: D152
type_guessed: string
name: parse_data
arguments: label: D73
type_guessed: string
name: parse_data
arguments: label: D129
type_guessed: string
name: parse_data
arguments: label: D85
type_guessed: string

tool: D89: HOME

tool: D167: /

tool: D75: CONSOLE\

tool: D133: .config/

tool: D152: SOFTWARE\

tool: D73: HKEY_CURRENT_USER

tool: D129: /etc/

tool: D85: 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;
}
```