user: Please show me the C implementation that matches the assembly code listed below:

```asm
<store_cluster_attr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  lea    0x2(%rax),%edi
  call   <malloc@plt>
  mov    %rbx,%rdx
  lea    D50(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%r12
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    0x0(%rbp),%r10
  test   %r10,%r10
  je     L33
  mov    %r10,%rdi
  mov    %r12,%rsi
  mov    %r10,0x8(%rsp)
  call   <strstr@plt>
  mov    0x8(%rsp),%r10
  test   %rax,%rax
  mov    %rax,%r14
  je     L32
  mov    $0x3b,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  movb   $0x0,(%r14)
  mov    0x0(%rbp),%rdi
  test   %rax,%rax
  mov    %rax,%r15
  lea    D67(%rip),%rax
  cmove  %rax,%r15
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%r14d
  call   <strlen@plt>
  lea    0x1(%r14,%rax,1),%edi
  call   <malloc@plt>
  mov    0x0(%rbp),%rdx
  mov    %r15,%rcx
  lea    D85(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    0x0(%rbp),%rdi
  call   <free@plt>
  mov    0x8(%rsp),%r10
  test   %r10,%r10
  je     L33
L32:
  mov    %r10,%rdi
  mov    %r10,0x8(%rsp)
  call   <strlen@plt>
  lea    D38(%rip),%rcx
  mov    %rcx,%rdi
  mov    %eax,%r15d
  call   <strlen@plt>
  mov    %rbx,%rdi
  add    %eax,%r15d
  call   <strlen@plt>
  lea    D7(%rip),%rdi
  mov    %eax,%r14d
  call   <strlen@plt>
  mov    %r13,%rdi
  add    %eax,%r14d
  call   <strlen@plt>
  add    %eax,%r14d
  lea    0x1(%r15,%r14,1),%edi
  call   <malloc@plt>
  mov    0x8(%rsp),%r10
  lea    D38(%rip),%rcx
  mov    %rax,%rdi
  mov    %r10,%r14
L18:
  mov    %rdi,0x0(%rbp)
  mov    %r13,%r9
  mov    %rbx,%r8
  mov    %r10,%rdx
  lea    D82(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r14,%rdi
  call   <free@plt>
  add    $0x18,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10a0 <free@plt>
  nopl   0x0(%rax)
L33:
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    D7(%rip),%rdi
  mov    %eax,%r14d
  call   <strlen@plt>
  mov    %r13,%rdi
  add    %eax,%r14d
  call   <strlen@plt>
  lea    0x1(%r14,%rax,1),%edi
  xor    %r14d,%r14d
  call   <malloc@plt>
  lea    D67(%rip),%rcx
  mov    %rax,%rdi
  mov    %rcx,%r10
  jmp    L18
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D50
data_type: string
name: extract_symbolic_data
arguments: data_label: D67
data_type: string
name: extract_symbolic_data
arguments: data_label: D85
data_type: string
name: extract_symbolic_data
arguments: data_label: D38
data_type: string
name: extract_symbolic_data
arguments: data_label: D7
data_type: string
name: extract_symbolic_data
arguments: data_label: D82
data_type: string

tool: D50: %s=

tool: 

tool: D85: %s%s

tool: D38: ;

tool: D7: =

tool: D82: %s%s%s=%s

assistant: ```c
void store_cluster_attr(char **metric, char *name, char *value) {
  char *pos = NULL, *rest;
  char *pattern;
  char *new_metric = NULL;
  int len;
  pattern = malloc(strlen(name) + 2);
  sprintf(pattern, "%s=", name);
  if (*metric)
    pos = strstr(*metric, pattern);
  if (pos) {
    rest = strchr(pos, ';');
    pos[0] = 0;
    if (rest == NULL)
      rest = "";
    new_metric = malloc(strlen(*metric) + strlen(rest) + 1);
    sprintf(new_metric, "%s%s", *metric, rest);
    free(*metric);
  } else
    (new_metric = *metric);
  len = new_metric ? (strlen(new_metric) + strlen(";")) : 0;
  len += strlen(name) + strlen("=") + strlen(value);
  *metric = malloc(len + 1);
  sprintf(*metric, "%s%s%s=%s", new_metric ? new_metric : "", new_metric ? ";" : "", name, value);
  free(new_metric);
  free(pattern);
}
```