user: 请将以下的汇编代码转换成C语言代码:

```asm
<append_file>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  mov    %rdx,%rdi
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  sub    $0x138,%rsp
  mov    %rsi,0x8(%rsp)
  lea    D19(%rip),%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x128(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  test   %rax,%rax
  je     L269
  mov    0x0(%r13),%rbx
  mov    %rax,%rbp
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    0x8(%rsp),%rsi
  mov    $0x1,%ecx
  mov    %r13,%rdi
  cltq
  lea    (%rbx,%rax,1),%rdx
  call   <expand_string@plt>
  test   %rax,%rax
  je     L20
  lea    0x1(%rax),%rbx
  movb   $0x28,(%rax)
  lea    0x20(%rsp),%r15
  movabs $0xfffffffeffffd9ff,%r14
  mov    %rbx,(%rsp)
  lea    D3(%rip),%r12
L183:
  lea    0x18(%rsp),%rbx
  nopl   0x0(%rax)
L221:
  mov    %rbp,%rdx
  mov    $0x100,%esi
  mov    %r15,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L96
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    %r15,0x18(%rsp)
  call   <strsep@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%r15,%rax,1),%rax
  mov    %rax,0x18(%rsp)
  cmp    %r15,%rax
  jae    L106
  jmp    L221
  nopl   0x0(%rax)
L25:
  lea    -0x1(%rax),%rdx
  mov    %rdx,0x18(%rsp)
  movb   $0x0,(%rax)
  mov    0x18(%rsp),%rax
  cmp    %r15,%rax
  jb     L221
L106:
  movzbl (%rax),%edx
  mov    %edx,%ecx
  and    $0xfffffffb,%ecx
  cmp    $0x9,%cl
  je     L25
  cmp    $0x20,%dl
  je     L25
  cmp    %r15,%rax
  jb     L221
  movzbl 0x20(%rsp),%edx
  mov    %r15,0x18(%rsp)
  cmp    $0x20,%dl
  ja     L67
  bt     %rdx,%r14
  jb     L223
  lea    0x21(%rsp),%rax
  nopl   0x0(%rax,%rax,1)
L175:
  movzbl (%rax),%edx
  mov    %rax,%rdi
  cmp    $0x20,%dl
  jbe    L24
L157:
  mov    %rdi,0x18(%rsp)
L18:
  test   %dl,%dl
  je     L221
  jmp    L36
  nopw   0x0(%rax,%rax,1)
L24:
  add    $0x1,%rax
  bt     %rdx,%r14
  jae    L175
  jmp    L157
  nopl   0x0(%rax)
L67:
  mov    %r15,%rdi
L36:
  call   <strlen@plt>
  mov    (%rsp),%rdx
  mov    0x8(%rsp),%rsi
  mov    %r13,%rdi
  lea    0x1(%rax,%rax,1),%ecx
  call   <expand_string@plt>
  test   %rax,%rax
  je     L20
  mov    0x18(%rsp),%rdx
  movzbl (%rdx),%edx
  test   %dl,%dl
  jne    L121
  jmp    L113
  nopl   0x0(%rax)
L39:
  lea    0x1(%rax),%rcx
  cmp    $0x3f,%dl
  je     L50
  mov    %dl,(%rax)
  mov    %rcx,%rax
L196:
  mov    0x18(%rsp),%rdx
  lea    0x1(%rdx),%rcx
  mov    %rcx,0x18(%rsp)
  movzbl 0x1(%rdx),%edx
  test   %dl,%dl
  je     L113
L121:
  cmp    $0x2e,%dl
  jne    L39
  mov    $0x2e5c,%ecx
  add    $0x2,%rax
  mov    %cx,-0x2(%rax)
  jmp    L196
L50:
  movb   $0x2e,(%rax)
  mov    %rcx,%rax
  jmp    L196
L113:
  lea    0x1(%rax),%rbx
  mov    $0x7c,%edx
  mov    %rbx,(%rsp)
  mov    %dx,(%rax)
  jmp    L183
L96:
  mov    (%rsp),%rax
  movzbl -0x1(%rax),%eax
  cmp    $0x28,%al
  jne    L262
  mov    (%rsp),%rax
  movb   $0x0,-0x1(%rax)
L303:
  mov    %rbp,%rdi
  call   <fclose@plt>
L20:
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L262:
  cmp    $0x7c,%al
  jne    L303
  mov    (%rsp),%rax
  movb   $0x29,-0x1(%rax)
  jmp    L303
L269:
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x138,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1130 <perror@plt>
L223:
  mov    %r15,%rdi
  jmp    L18
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D19
type_infered: string
name: read_data
arguments: tag: D3
type_infered: string

tool: D19: r

tool: D3: #


assistant: ```c
void append_file(char **dst, int *len, char *filename) {
  FILE *fd;
  char line[256], *p, *tail;
  fd = fopen(filename, "r");
  if (!fd) {
    perror(filename);
    return;
  }
  tail = expand_string(dst, len, *dst + strlen(*dst), 1);
  if (!tail)
    return;
  *tail++ = '(';
  while (fgets(line, sizeof(line), fd)) {
    p = line;
    strsep(&p, "#\n");
    p = line + strlen(line) - 1;
    while (p >= line && (*p == ' ' || *p == '\t' || *p == '\r'))
      *p-- = 0;
    if (p < line)
      continue;
    p = line;
    while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')
      ++p;
    if (*p == 0)
      continue;
    tail = expand_string(dst, len, tail, 2 * strlen(p) + 1);
    if (!tail)
      return;
    for (; *p; ++p) {
      if (*p == '.') {
        *tail++ = '\\';
        *tail++ = '.';
      } else if (*p == '?')
        *tail++ = '.';
      else
        *tail++ = *p;
    }
    *tail++ = '|';
    *tail = 0;
  }
  if (*(tail - 1) == '(')
    *--tail = 0;
  else if (*(tail - 1) == '|')
    *(tail - 1) = ')';
  fclose(fd);
}
```