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

```asm
<append_cpus>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jne    L12
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%r8d
  mov    %rax,%rcx
  lea    D38(%rip),%rax
  mov    %rax,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%r8d
  mov    %rax,%rcx
  lea    D38(%rip),%rax
  mov    %rax,%rdx
  mov    $0x0,%eax
  call   <snprintf@plt>
  jmp    L4
L12:
  mov    -0x20(%rbp),%ecx
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r9d
  mov    %edx,%r8d
  mov    %rax,%rcx
  lea    D10(%rip),%rax
  mov    %rax,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x20(%rbp),%ecx
  mov    -0x1c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r9d
  mov    %edx,%r8d
  mov    %rax,%rcx
  lea    D10(%rip),%rax
  mov    %rax,%rdx
  mov    $0x0,%eax
  call   <snprintf@plt>
L4:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  add    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%rax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D38
datatype: string
name: disassemble_data
arguments: data_tag: D10
datatype: string

tool: D38: %s%d

tool: D10: %s%d-%d

assistant: ```c
char *append_cpus(char *buf, int start, int end, const char *comma, int *total) {
  int len;
  if (start == end) {
    len = snprintf(NULL, 0, "%s%d", comma, start);
    buf = realloc(buf, *total + len + 1);
    buf[*total] = 0;
    snprintf(buf + *total, len + 1, "%s%d", comma, start);
  } else {
    len = snprintf(NULL, 0, "%s%d-%d", comma, start, end);
    buf = realloc(buf, *total + len + 1);
    buf[*total] = 0;
    snprintf(buf + *total, len + 1, "%s%d-%d", comma, start, end);
  }
  *total += len;
  return buf;
}
```