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     L78
  mov    %rdi,%rbp
  mov    %esi,%ebx
  mov    %edx,%r13d
  mov    %ecx,%r12d
  test   %esi,%esi
  jle    L61
L127:
  movslq D127(%rip),%rsi
  movslq %ebx,%rcx
  mov    D207(%rip),%rax
  mov    %rsi,%rdx
  lea    0x50(%rsi,%rcx,1),%rsi
  movslq D9(%rip),%rcx
  cmp    %rcx,%rsi
  jae    L159
  test   %rax,%rax
  je     L142
L37:
  lea    -0x1(%rbx),%ecx
  test   %ebx,%ebx
  jle    L74
  lea    D193(%rip),%r14
  xchg   %ax,%ax
L179:
  movzbl 0x0(%rbp),%edx
  lea    0x1(%rbp),%rsi
  cmp    $0x25,%dl
  jne    L91
  test   %ecx,%ecx
  jle    L91
  cmpb   $0x64,0x1(%rbp)
  je     L103
L91:
  movslq D127(%rip),%rax
  mov    %ecx,%ebx
  mov    %rsi,%rbp
  lea    0x1(%rax),%edi
  mov    %edi,D15(%rip)
  mov    D207(%rip),%rdi
  mov    %dl,(%rdi,%rax,1)
L34:
  lea    -0x1(%rbx),%ecx
  test   %ebx,%ebx
  jg     L179
  mov    D207(%rip),%rax
L74:
  movslq D15(%rip),%rdx
  movb   $0x0,(%rax,%rdx,1)
L121:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L140
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L103:
  mov    %rsp,%r15
  mov    %r13d,%edx
  mov    %r14,%rsi
  add    $0x2,%rbp
  mov    %r15,%rdi
  sub    $0x2,%ebx
  mov    %r12d,%r13d
  call   <sprintf@plt>
  movslq D15(%rip),%rdi
  mov    %r15,%rsi
  add    D207(%rip),%rdi
  call   <strcpy@plt>
  movslq D15(%rip),%rdi
  add    D207(%rip),%rdi
  call   <strlen@plt>
  add    %eax,D15(%rip)
  jmp    L34
  nopw   0x0(%rax,%rax,1)
L61:
  je     L53
  add    %esi,D15(%rip)
  js     L131
L53:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  jmp    L127
  nopl   0x0(%rax)
L159:
  lea    0x118(%rdx,%rbx,1),%esi
  mov    %rax,%rdi
  mov    %esi,D15(%rip)
  call   <realloc@plt>
  mov    %rax,D15(%rip)
  test   %rax,%rax
  jne    L37
L142:
  lea    D15(%rip),%rax
  jmp    L121
  nopl   0x0(%rax)
L78:
  movl   $0x0,D15(%rip)
  mov    D15(%rip),%rax
  jmp    L121
L131:
  mov    $0xc56,%esi
  lea    D138(%rip),%rdi
  call   <myassert@plt>
  jmp    L53
L140:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D193
type_guessed: string
name: extract_symbolic_data
arguments: tag: D15
type_guessed: string
name: extract_symbolic_data
arguments: tag: D138
type_guessed: string

tool: D193: %d

tool: 

tool: D138: /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;
}
```