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

```asm
<ll2escaped>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  test   %r8d,%r8d
  jle    L8
  mov    %rsi,%r15
  mov    %edx,%ebp
  mov    %rcx,%r13
  mov    %r8d,%r12d
  lea    -0x1(%rdx),%eax
  test   %edx,%edx
  je     L195
  mov    %rsi,%rcx
  jmp    L162
L8:
  lea    D37(%rip),%rdi
  mov    $0x0,%eax
  call   <L_DEBUG@plt>
  mov    $0xffffffff,%eax
  jmp    L32
L195:
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <L_DEBUG@plt>
  mov    $0xfffffffe,%eax
L32:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L182:
  cmpq   $0x0,0x8(%rsp)
  je     L55
  sub    $0x2,%ebp
  test   %eax,%eax
  je     L57
  lea    0x8(%rcx),%r14
  mov    %ebx,%edx
  sar    $0x1f,%edx
  shr    $0x1a,%edx
  lea    (%rbx,%rdx,1),%eax
  and    $0x3f,%eax
  sub    %edx,%eax
  shl    $0x8,%eax
  cltq
  movslq 0x4(%rcx),%rdx
  add    %rdx,%rax
  mov    0x8(%rsp),%rdi
  lea    (%rdi,%rax,4),%rsi
  movslq %ebp,%rbp
  lea    (%r14,%rbp,4),%rdx
  sub    %rsi,%rdx
  sar    $0x2,%rdx
  mov    %r12d,%r8d
  mov    %r13,%rcx
  call   <ll2escaped>
  sub    %r15,%r14
  sar    $0x2,%r14
  test   %eax,%eax
  cmovns %r14d,%eax
  jmp    L32
L57:
  lea    D1(%rip),%rdi
  call   <L_DEBUG@plt>
  mov    $0xfffffffe,%eax
  jmp    L32
L164:
  lea    D65(%rip),%rdi
  mov    $0x0,%eax
  call   <L_DEBUG@plt>
  mov    $0xfffffffe,%eax
  jmp    L32
L63:
  mov    %ebx,%esi
  sub    %eax,%esi
  mov    %ebx,%edx
  lea    D61(%rip),%rdi
  mov    $0x0,%eax
  call   <L_DEBUG@plt>
  mov    $0xfffffffe,%eax
  jmp    L32
L177:
  movslq %ebx,%rbx
  lea    (%r14,%rbx,4),%rcx
  movslq %eax,%rdx
  add    %r13,%rdx
  mov    %r12d,%esi
  sub    %eax,%esi
  lea    -0x1(%rsi),%r12d
  je     L217
  lea    0x1(%rdx),%r13
  movb   $0x2e,(%rdx)
  lea    -0x1(%rbp),%eax
  test   %ebp,%ebp
  je     L195
L162:
  lea    0x4(%rcx),%r14
  mov    (%rcx),%ebx
  test   %ebx,%ebx
  je     L208
  mov    %ebx,%edx
  and    $0xc0,%edx
  cmp    $0xc0,%edx
  je     L182
  test   %edx,%edx
  jne    L164
  mov    %eax,%ebp
  sub    %ebx,%ebp
  js     L63
  mov    %r12d,%ecx
  mov    %r13,%rdx
  mov    %ebx,%esi
  mov    %r14,%rdi
  call   <l2escaped@plt>
  test   %eax,%eax
  jns    L177
  jmp    L32
L217:
  mov    $0x2e,%esi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <L_DEBUG@plt>
  mov    $0xffffffff,%eax
  jmp    L32
L14:
  mov    $0x0,%esi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <L_DEBUG@plt>
  mov    $0xffffffff,%eax
  jmp    L32
L55:
  mov    $0xfffffffd,%eax
  jmp    L32
L208:
  test   %r12d,%r12d
  je     L14
  movb   $0x0,0x0(%r13)
  mov    %r14,%rax
  sub    %r15,%rax
  sar    $0x2,%rax
  jmp    L32
```

tool_calls: name: disassemble_data
arguments: data_tag: D37
type_infered: string
name: disassemble_data
arguments: data_tag: D1
type_infered: string
name: disassemble_data
arguments: data_tag: D65
type_infered: string
name: disassemble_data
arguments: data_tag: D61
type_infered: string
name: disassemble_data
arguments: data_tag: D31
type_infered: string

tool: D37: no output string available

tool: D1: out of input string (before last null label)

tool: D65: high-order bits set in length

tool: D61: %d/%d bytes of label body missing

tool: D31: out of space in escaped pushing %d

assistant: ```c
int ll2escaped(const uint8_t *base, const uint8_t *ll, int ll_left, char *escaped, int escaped_left) {
  const uint8_t *oll = ll;
  int r;
  if (escaped_left <= 0) {
    L_DEBUG("no output string available");
    return -1;
  }
  while (1) {
    if (!ll_left--) {
      L_DEBUG("out of input string (before last null label)");
      return -2;
    }
    uint8_t c = *(ll++);
    if (c) {
      if ((c & (64 | 128)) == (64 | 128)) {
        if (!base)
          return -3;
        if (!ll_left--) {
          L_DEBUG("out of input string (before last null label)");
          return -2;
        }
        uint8_t c2 = *(ll++);
        const uint8_t *nofs = base + ((c % 64) << 8) + c2;
        r = ll2escaped(base, nofs, ll + ll_left - nofs, escaped, escaped_left);
        if (r < 0)
          return r;
        return ll - oll;
      }
      if (c & (64 | 128)) {
        L_DEBUG("high-order bits set in length");
        return -2;
      }
      ll_left -= c;
      if (ll_left < 0) {
        L_DEBUG("%d/%d bytes of label body missing", -ll_left, c);
        return -2;
      }
      r = l2escaped(ll, c, escaped, escaped_left);
      if (r < 0)
        return r;
      ll += c;
      escaped += r;
      escaped_left -= r;
    }
    if (!c)
      break;
    do {
      if (!escaped_left--) {
        L_DEBUG("out of space in escaped pushing %d", '.');
        return -1;
      }
      *(escaped++) = '.';
    } while (0);
  }
  do {
    if (!escaped_left--) {
      L_DEBUG("out of space in escaped pushing %d", 0);
      return -1;
    }
    *(escaped++) = 0;
  } while (0);
  return ll - oll;
}
```