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

```asm
<appendStr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,%r14
  mov    %rsi,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  movq   $0x0,0x30(%rsp)
  movq   $0x0,0x38(%rsp)
  mov    $0x0,%ebx
  mov    %ebx,%edi
  call   <va_start@plt>
  mov    %ebx,%esi
  mov    $0x0,%edi
  call   <va_copy@plt>
  mov    %rsp,%rdi
  mov    %ebx,%ecx
  mov    %r13,%rdx
  mov    $0x40,%esi
  call   <vsnprintf@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  js     L25
  mov    %rsp,%r15
  mov    $0x0,%r12d
  cmp    $0x40,%eax
  ja     L88
L89:
  mov    $0x0,%r13d
  test   %r14,%r14
  je     L11
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
L11:
  lea    0x1(%r13,%rbx,1),%esi
  mov    %r14,%rdi
  call   <realloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L28
  movslq %r13d,%r13
  lea    (%rax,%r13,1),%rdi
  mov    %ebx,%edx
  mov    %r15,%rsi
  call   <memcpy@plt>
  movslq %ebx,%rdi
  add    %r13,%rdi
  add    %rbp,%rdi
  mov    $0x1,%edx
  mov    $0x0,%esi
  call   <memset@plt>
L72:
  test   %r12,%r12
  je     L57
L53:
  mov    %r12,%rdi
  call   <free@plt>
L57:
  mov    $0x0,%ebx
  mov    %ebx,%edi
  call   <va_end@plt>
  mov    $0x0,%edi
  call   <va_end@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L65
  mov    %rbp,%rax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L25:
  mov    %eax,%esi
  lea    D38(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L57
L88:
  lea    0x1(%rax),%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L98
  mov    $0x0,%edi
  mov    %edi,%ecx
  mov    %r13,%rdx
  mov    %r15d,%esi
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    %r12,%r15
  cmp    %eax,%ebx
  je     L89
  mov    %ebx,%edx
  mov    %eax,%esi
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L53
L98:
  mov    %r15d,%esi
  lea    D16(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L57
L28:
  lea    D34(%rip),%rdi
  call   <puts@plt>
  jmp    L72
L65:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D38
type_infered: string
name: retrieve_data
arguments: data_tag: D24
type_infered: string
name: retrieve_data
arguments: data_tag: D16
type_infered: string
name: retrieve_data
arguments: data_tag: D34
type_infered: string

tool: D38: appendStr(): vsnprintf() return < 0: %d


tool: D24: appendStr() error: vsnprintf() nBytes(%d) != n(%d)


tool: D16: appendStr() error: tmpBuf = malloc(%d) failed.


tool: D34: appendStr() error: realloc() failed.

assistant: ```c
char *appendStr(char *buf, char *fmt, ...) {
  int n, nBytes, l = 0;
  char *newBuf, *tmpBuf = NULL;
  va_list args1, args2;
  char fixedBuf[64] = {0};
  char *inputStr = fixedBuf;
  va_start(args1, fmt);
  va_copy(args2, args1);
  n = vsnprintf(fixedBuf, sizeof(fixedBuf), fmt, args1);
  if (n < 0) {
    printf("appendStr(): vsnprintf() return < 0: %d\n", n);
    goto end;
  }
  if (n > sizeof(fixedBuf)) {
    tmpBuf = malloc(sizeof(char) * (n + 1));
    if (tmpBuf == NULL) {
      printf("appendStr() error: tmpBuf = malloc(%d) failed.\n", n + 1);
      goto end;
    }
    nBytes = vsnprintf(tmpBuf, n + 1, fmt, args2);
    if (nBytes != n) {
      printf("appendStr() error: vsnprintf() nBytes(%d) != n(%d)\n", nBytes, n);
      goto end;
    }
    inputStr = tmpBuf;
  }
  if (buf == NULL) {
    l = 0;
  } else {
    l = strlen(buf);
  }
  newBuf = realloc(buf, l + n + 1);
  if (newBuf == NULL) {
    printf("appendStr() error: realloc() failed.\n");
    goto end;
  }
  memcpy((void *)(newBuf + l), (void *)inputStr, n);
  memset((void *)(newBuf + l + n), 0, 1);
end:
  if (tmpBuf != NULL) {
    free(tmpBuf);
    tmpBuf = NULL;
  }
  va_end(args1);
  va_end(args2);
  return newBuf;
}
```