user: Converte this assembly snippet into its equivalent C code:

```asm
<preproc_escape_string>:
  endbr64
  push   %r15
  lea    (%rcx,%r8,2),%rax
  push   %r14
  push   %r13
  push   %r12
  mov    $0xfffffffffffffffe,%r12
  push   %rbp
  sub    %rax,%r12
  mov    %rcx,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    (%rdi),%r13
  mov    (%rsi),%r15
  mov    %rdi,0x8(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %rdx,0x18(%rsp)
  add    (%rdx),%r12
  jne    L235
  cmp    $0x1,%rcx
  jbe    L243
  cmpb   $0x22,-0x1(%r13,%rcx,1)
  lea    -0x1(%rcx),%rdx
  jne    L243
  lea    -0x2(%r13,%rcx,1),%rax
  cmpb   $0x52,(%rax)
  jne    L243
  movq   $0x0,(%rsp)
  mov    %rdx,%rbp
L109:
  movb   $0x22,(%rax)
  test   %r12,%r12
  je     L19
L157:
  xor    %r14d,%r14d
L90:
  lea    0x4(%rbp),%rbx
  jmp    L22
  nopl   0x0(%rax)
L74:
  add    %r15,%r15
  mov    %r13,%rdi
  mov    %r15,%rsi
  call   <realloc@plt>
  test   %rax,%rax
  je     L55
  mov    %rax,%r13
L22:
  cmp    %rbx,%r15
  jb     L74
  mov    (%rsp),%rax
  lea    0x0(%r13,%rbp,1),%rdi
  movzbl (%rax,%r14,1),%eax
  lea    -0x20(%rax),%edx
  cmp    $0x5e,%dl
  jbe    L165
  test   %al,%al
  js     L165
  cmp    $0x27,%al
  jg     L116
  cmp    $0x6,%al
  jle    L116
  lea    -0x7(%rax),%edx
  cmp    $0x20,%dl
  ja     L116
  lea    D8(%rip),%rcx
  movzbl %dl,%edx
  movslq (%rcx,%rdx,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
  nopl   (%rax)
L55:
  mov    (%rsp),%rdi
  mov    $0xffffffffffffffff,%r15
  xor    %ebp,%ebp
  call   <free@plt>
  mov    %r13,%rdi
  xor    %r13d,%r13d
  call   <free@plt>
L42:
  mov    0x8(%rsp),%rax
  mov    %r13,(%rax)
  mov    0x10(%rsp),%rax
  mov    %r15,(%rax)
  mov    0x18(%rsp),%rax
  mov    %rbp,(%rax)
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L165:
  mov    %al,(%rdi)
  add    $0x1,%rbp
L150:
  add    $0x1,%r14
  cmp    %r14,%r12
  ja     L90
L19:
  mov    (%rsp),%rdi
  call   <free@plt>
  jmp    L42
  xchg   %ax,%ax
L235:
  mov    %r8,%rbx
  mov    %r12,%rdi
  call   <malloc@plt>
  lea    0x1(%rbp,%rbx,1),%rsi
  mov    %r12,%rdx
  add    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  call   <memcpy@plt>
  cmp    $0x1,%rbp
  jbe    L157
  cmpb   $0x22,-0x1(%r13,%rbp,1)
  lea    -0x1(%rbp),%rdx
  jne    L157
  lea    -0x2(%r13,%rbp,1),%rax
  cmpb   $0x52,(%rax)
  jne    L157
  mov    %rdx,%rbp
  jmp    L109
  nopw   0x0(%rax,%rax,1)
L243:
  movq   $0x0,(%rsp)
  jmp    L19
  nopw   0x0(%rax,%rax,1)
L116:
  movsbl %al,%edx
  lea    D0(%rip),%rsi
  mov    %rbx,%rbp
  call   <sprintf@plt>
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x61,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x62,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x74,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x6e,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x76,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x66,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x72,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x22,0x0(%r13,%rax,1)
  jmp    L150
  lea    0x1(%rbp),%rax
  movb   $0x5c,(%rdi)
  add    $0x2,%rbp
  movb   $0x27,0x0(%r13,%rax,1)
  jmp    L150
```

tool_calls: name: read_data
arguments: data_label: D0
type_infered: string

tool: D0: \%3.3o

assistant: ```c
void preproc_escape_string(char **linep, size_t *linelenp, size_t *jp, size_t d, size_t dl) {
  char *line = *linep;
  char *r = 0;
  size_t linelen = *linelenp;
  size_t l = *jp - d - 2 * dl - 2;
  size_t i;
  size_t j = d;
  if (l != 0) {
    r = (char *)malloc(l);
    memcpy(r, &line[j + dl + 1], l);
  }
  if (j >= 2 && line[j - 1] == '\"' && line[j - 2] == 'R') {
    line[j - 2] = '\"';
    j--;
  }
  for (i = 0; i < l; i++) {
    while (j + 4 > linelen) {
      char *oldline = line;
      linelen *= 2;
      line = (char *)realloc(line, linelen);
      if (!line) {
        free(r);
        free(oldline);
        *linep = NULL;
        *linelenp = -1;
        *jp = 0;
        return;
      }
    }
    if ((r[i] >= ' ' && r[i] <= '~') || (r[i] & 0x80) != 0) {
      line[j++] = r[i];
    } else
      switch (r[i]) {
      case '\a':
        line[j++] = '\\';
        line[j++] = 'a';
        break;
      case '\b':
        line[j++] = '\\';
        line[j++] = 'b';
        break;
      case '\f':
        line[j++] = '\\';
        line[j++] = 'f';
        break;
      case '\n':
        line[j++] = '\\';
        line[j++] = 'n';
        break;
      case '\r':
        line[j++] = '\\';
        line[j++] = 'r';
        break;
      case '\t':
        line[j++] = '\\';
        line[j++] = 't';
        break;
      case '\v':
        line[j++] = '\\';
        line[j++] = 'v';
        break;
      case '\\':
        line[j++] = '\\';
        line[j++] = '\\';
        break;
      case '\'':
        line[j++] = '\\';
        line[j++] = '\'';
        break;
      case '\"':
        line[j++] = '\\';
        line[j++] = '\"';
        break;
      default:
        sprintf(&line[j], "\\%3.3o", r[i]);
        j += 4;
        break;
      }
  }
  free(r);
  *linep = line;
  *linelenp = linelen;
  *jp = j;
}
```