user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<sym_expand_string_value>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x168,%rsp
  mov    %rdi,-0x168(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0x168(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  cltq
  mov    %rax,-0x148(%rbp)
  mov    -0x148(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x150(%rbp)
  mov    -0x150(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L8
L7:
  lea    D1(%rip),%rax
  mov    %rax,-0x138(%rbp)
  mov    -0x158(%rbp),%rax
  sub    -0x168(%rbp),%rax
  mov    %eax,%edx
  mov    -0x168(%rbp),%rcx
  mov    -0x150(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  addq   $0x1,-0x158(%rbp)
  lea    -0x120(%rbp),%rax
  mov    %rax,-0x140(%rbp)
  jmp    L78
L16:
  mov    -0x158(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x158(%rbp)
  mov    -0x140(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x140(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L78:
  mov    -0x158(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalnum@plt>
  test   %rax,%rax
  jne    L16
  mov    -0x158(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  je     L16
  mov    -0x140(%rbp),%rax
  movb   $0x0,(%rax)
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdi
  call   <sym_find@plt>
  mov    %rax,-0x130(%rbp)
  cmpq   $0x0,-0x130(%rbp)
  je     L52
  mov    -0x130(%rbp),%rax
  mov    %rax,%rdi
  call   <sym_calc_value@plt>
  mov    -0x130(%rbp),%rax
  mov    %rax,%rdi
  call   <sym_get_string_value@plt>
  mov    %rax,-0x138(%rbp)
L52:
  mov    -0x150(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x138(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,%ebx
  mov    -0x158(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x1,%eax
  cltq
  mov    %rax,-0x128(%rbp)
  mov    -0x128(%rbp),%rax
  cmp    -0x148(%rbp),%rax
  jbe    L18
  mov    -0x128(%rbp),%rax
  mov    %rax,-0x148(%rbp)
  mov    -0x148(%rbp),%rdx
  mov    -0x150(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x150(%rbp)
L18:
  mov    -0x138(%rbp),%rdx
  mov    -0x150(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x158(%rbp),%rax
  mov    %rax,-0x168(%rbp)
L8:
  mov    -0x168(%rbp),%rax
  mov    $0x24,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x158(%rbp)
  cmpq   $0x0,-0x158(%rbp)
  jne    L7
  mov    -0x168(%rbp),%rdx
  mov    -0x150(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x150(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L47
  call   <__stack_chk_fail@plt>
L47:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D1
type: string

tool: 

assistant: ```c
const char *sym_expand_string_value(const char *in) {
  const char *src;
  char *res;
  size_t reslen;
  reslen = strlen(in) + 1;
  res = malloc(reslen);
  res[0] = '\0';
  while ((src = strchr(in, '$'))) {
    char *p, name[256];
    const char *symval = "";
    struct symbol *sym;
    size_t newlen;
    strncat(res, in, src - in);
    src++;
    p = name;
    while (isalnum(*src) || *src == '_')
      *p++ = *src++;
    *p = '\0';
    sym = sym_find(name);
    if (sym != NULL) {
      sym_calc_value(sym);
      symval = sym_get_string_value(sym);
    }
    newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
    if (newlen > reslen) {
      reslen = newlen;
      res = realloc(res, reslen);
    }
    strcat(res, symval);
    in = src;
  }
  strcat(res, in);
  return res;
}
```