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

```asm
<append_str>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L135
  mov    %rdi,%rbp
  mov    %esi,%ebx
  mov    %edx,%r13d
  mov    %ecx,%r12d
  test   %esi,%esi
  jle    L133
L150:
  movslq D55(%rip),%rsi
  movslq %ebx,%rcx
  mov    D71(%rip),%rax
  mov    %rsi,%rdx
  lea    0x50(%rsi,%rcx,1),%rsi
  movslq D110(%rip),%rcx
  cmp    %rcx,%rsi
  jae    L156
  test   %rax,%rax
  je     L75
L26:
  lea    -0x1(%rbx),%ecx
  test   %ebx,%ebx
  jle    L132
  lea    D66(%rip),%r14
  jmp    L142
  nopl   0x0(%rax)
L125:
  movslq D55(%rip),%rax
  mov    %ecx,%ebx
  mov    %rsi,%rbp
  lea    -0x1(%rbx),%ecx
  lea    0x1(%rax),%edi
  mov    %edi,D39(%rip)
  mov    D71(%rip),%rdi
  mov    %dl,(%rdi,%rax,1)
  test   %ebx,%ebx
  jle    L50
L142:
  movzbl 0x0(%rbp),%edx
  lea    0x1(%rbp),%rsi
  cmp    $0x25,%dl
  jne    L125
  cmpb   $0x64,0x1(%rbp)
  jne    L125
  mov    %rsp,%r15
  mov    %r13d,%edx
  mov    %r14,%rsi
  sub    $0x2,%ebx
  mov    %r15,%rdi
  add    $0x2,%rbp
  mov    %r12d,%r13d
  call   <sprintf@plt>
  movslq D39(%rip),%rdi
  mov    %r15,%rsi
  add    D71(%rip),%rdi
  call   <strcpy@plt>
  movslq D39(%rip),%rdi
  add    D71(%rip),%rdi
  call   <strlen@plt>
  lea    -0x1(%rbx),%ecx
  add    %eax,D39(%rip)
  test   %ebx,%ebx
  jg     L142
  nopw   0x0(%rax,%rax,1)
L50:
  mov    D71(%rip),%rax
L132:
  movslq D39(%rip),%rdx
  movb   $0x0,(%rax,%rdx,1)
L42:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L21
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L133:
  je     L127
  add    %esi,D39(%rip)
  js     L115
L127:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  jmp    L150
  nopl   0x0(%rax)
L156:
  lea    0x118(%rdx,%rbx,1),%esi
  mov    %rax,%rdi
  mov    %esi,D39(%rip)
  call   <realloc@plt>
  mov    %rax,D39(%rip)
  test   %rax,%rax
  jne    L26
L75:
  lea    D39(%rip),%rax
  jmp    L42
  xchg   %ax,%ax
L135:
  movl   $0x0,D39(%rip)
  mov    D39(%rip),%rax
  jmp    L42
L115:
  mov    $0xbd6,%esi
  lea    D144(%rip),%rdi
  call   <myassert@plt>
  jmp    L127
L21:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D66
data_type: string
name: unpack_data
arguments: data_label: D39
data_type: string
name: unpack_data
arguments: data_label: D144
data_type: string

tool: D66: %d

tool: 

tool: D144: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Mitali-Sodhi/CodeLingo/refs/heads/2.0/Dataset/c/lemon.c

assistant: ```c
char *append_str(char *zText, int n, int p1, int p2) {
  static char *z = 0;
  static int alloced = 0;
  static int used = 0;
  int i, c;
  char zInt[40];
  if (zText == 0) {
    used = 0;
    return z;
  }
  if (n <= 0) {
    if (n < 0) {
      used += n;
      if (!(used >= 0))
        myassert("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Mitali-Sodhi/CodeLingo/refs/heads/2.0/Dataset/c/lemon.c", 3030);
    }
    n = strlen(zText);
  }
  if (n + sizeof(zInt) * 2 + used >= alloced) {
    alloced = n + sizeof(zInt) * 2 + used + 200;
    z = realloc(z, alloced);
  }
  if (z == 0)
    return "";
  while (n-- > 0) {
    c = *(zText++);
    if (c == '%' && zText[0] == 'd') {
      sprintf(zInt, "%d", p1);
      p1 = p2;
      strcpy(&z[used], zInt);
      used += strlen(&z[used]);
      zText++;
      n--;
    } else {
      z[used++] = c;
    }
  }
  z[used] = 0;
  return z;
}
```