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     L34
  mov    %rdi,%rbp
  mov    %esi,%ebx
  mov    %edx,%r14d
  mov    %ecx,%r12d
  test   %esi,%esi
  jle    L156
L82:
  movslq D145(%rip),%rcx
  movslq %ebx,%rdx
  mov    D148(%rip),%r8
  mov    %rcx,%rax
  lea    0x50(%rcx,%rdx,1),%rcx
  movslq D99(%rip),%rdx
  cmp    %rdx,%rcx
  jae    L8
  test   %r8,%r8
  je     L128
L70:
  lea    -0x1(%rbx),%esi
  test   %ebx,%ebx
  jle    L101
  lea    D180(%rip),%r13
  nopw   0x0(%rax,%rax,1)
L54:
  movzbl 0x0(%rbp),%ecx
  lea    0x1(%rbp),%rdi
  cmp    $0x25,%cl
  jne    L38
  test   %esi,%esi
  jle    L38
  cmpb   $0x64,0x1(%rbp)
  je     L69
L38:
  movslq D145(%rip),%rdx
  mov    D148(%rip),%r8
  mov    %esi,%ebx
  mov    %rdi,%rbp
  lea    0x1(%rdx),%eax
  mov    %cl,(%r8,%rdx,1)
  mov    %eax,D172(%rip)
L41:
  lea    -0x1(%rbx),%esi
  test   %ebx,%ebx
  jg     L54
  mov    D148(%rip),%r8
L118:
  cltq
  movb   $0x0,(%r8,%rax,1)
L189:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L180
  add    $0x38,%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L69:
  mov    %rsp,%r15
  mov    %r14d,%edx
  mov    %r13,%rsi
  add    $0x2,%rbp
  mov    %r15,%rdi
  sub    $0x2,%ebx
  mov    %r12d,%r14d
  call   <sprintf@plt>
  movslq D172(%rip),%rdi
  mov    %r15,%rsi
  add    D148(%rip),%rdi
  call   <strcpy@plt>
  movslq D172(%rip),%rdi
  add    D148(%rip),%rdi
  call   <strlen@plt>
  add    D172(%rip),%eax
  mov    %eax,D172(%rip)
  jmp    L41
  nopl   (%rax)
L156:
  je     L0
  add    %esi,D172(%rip)
  js     L125
L0:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  jmp    L82
  nopl   0x0(%rax)
L8:
  lea    0x118(%rax,%rbx,1),%esi
  mov    %r8,%rdi
  mov    %esi,D172(%rip)
  call   <realloc@plt>
  mov    %rax,%r8
  mov    %rax,D172(%rip)
  test   %r8,%r8
  jne    L70
L128:
  lea    D172(%rip),%r8
  jmp    L189
  nopl   0x0(%rax)
L34:
  movl   $0x0,D172(%rip)
  mov    D172(%rip),%r8
  jmp    L189
  cs nopw 0x0(%rax,%rax,1)
L101:
  mov    D172(%rip),%eax
  jmp    L118
L125:
  mov    $0xc56,%esi
  lea    D134(%rip),%rdi
  call   <myassert@plt>
  jmp    L0
L180:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D180
type: string
name: extract_symbolic_data
arguments: data_tag: D172
type: string
name: extract_symbolic_data
arguments: data_tag: D134
type: string

tool: D180: %d

tool: 

tool: D134: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ballju/SpaceTrader-GPL-1.1.14/refs/heads/master/tools/Lemon/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 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/ballju/SpaceTrader-GPL-1.1.14/refs/heads/master/tools/Lemon/lemon.c", 3158);
    }
    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 == '%' && n > 0 && 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;
}
```