user: What is the c source code of the assembly code below?

```asm
<appendStr>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  mov    %rdi,%r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %r12d,%edi
  push   %rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  movaps %xmm0,(%rsp)
  movaps %xmm0,0x10(%rsp)
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  call   <va_start@plt>
  mov    %r12d,%esi
  xor    %edi,%edi
  call   <va_copy@plt>
  mov    %r12d,%ecx
  mov    %r14,%rdx
  mov    $0x40,%esi
  mov    %rbx,%rdi
  call   <vsnprintf@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  js     L48
  xor    %r12d,%r12d
  cmp    $0x40,%eax
  jg     L63
L57:
  test   %r15,%r15
  je     L121
  mov    %r15,%rdi
  call   <strlen@plt>
  movslq %eax,%r14
  lea    0x0(%rbp,%r14,1),%esi
L104:
  add    $0x1,%esi
  mov    %r15,%rdi
  call   <realloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L29
  lea    (%rax,%r14,1),%rdi
  mov    %ebp,%edx
  mov    %rbx,%rsi
  call   <memcpy@plt>
  movslq %ebp,%rdi
  mov    $0x1,%edx
  xor    %esi,%esi
  add    %r14,%rdi
  add    %r13,%rdi
  call   <memset@plt>
L47:
  test   %r12,%r12
  je     L7
L123:
  mov    %r12,%rdi
  call   <free@plt>
L7:
  xor    %edi,%edi
  call   <va_end@plt>
  xor    %edi,%edi
  call   <va_end@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L50
  add    $0x58,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L121:
  mov    %ebp,%esi
  xor    %r14d,%r14d
  jmp    L104
  nopw   0x0(%rax,%rax,1)
L63:
  lea    0x1(%rax),%ebx
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L21
  mov    %ebx,%esi
  xor    %ecx,%ecx
  mov    %r14,%rdx
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    %r12,%rbx
  cmp    %eax,%ebp
  je     L57
  mov    %eax,%esi
  mov    %ebp,%edx
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L123
  nopl   0x0(%rax,%rax,1)
L48:
  mov    %eax,%esi
  lea    D19(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L7
  nopl   (%rax)
L29:
  lea    D31(%rip),%rdi
  call   <puts@plt>
  jmp    L47
  nopl   0x0(%rax)
L21:
  mov    %ebx,%esi
  lea    D17(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L7
L50:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D3
type_infered: string
name: parse_data
arguments: data_label: D19
type_infered: string
name: parse_data
arguments: data_label: D31
type_infered: string
name: parse_data
arguments: data_label: D17
type_infered: string

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


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


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

tool: D17: appendStr() error: tmpBuf = malloc(%d) 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;
}
```