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

```asm
<escape>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  movl   $0x0,-0x24(%rbp)
  movq   $0x0,-0x20(%rbp)
  jmp    L93
L86:
  mov    -0x38(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x5c,%eax
  je     L30
  cmp    $0x5c,%eax
  jg     L87
  cmp    $0x22,%eax
  je     L30
  cmp    $0x22,%eax
  jg     L87
  cmp    $0xa,%eax
  jg     L42
  cmp    $0x8,%eax
  jge    L30
  jmp    L87
L42:
  cmp    $0xd,%eax
  jne    L87
L30:
  addl   $0x1,-0x24(%rbp)
L87:
  nop
  addq   $0x1,-0x20(%rbp)
L93:
  mov    -0x38(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L86
  cmpl   $0x0,-0x24(%rbp)
  jne    L8
  mov    $0x0,%eax
  jmp    L247
L8:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  jmp    L201
L33:
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x22,%eax
  jg     L184
  cmp    $0x8,%eax
  jl     L242
  sub    $0x8,%eax
  cmp    $0x1a,%eax
  ja     L242
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D4(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D4(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
L184:
  cmp    $0x5c,%eax
  je     L3
  jmp    L242
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x6e,(%rax)
  jmp    L208
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x74,(%rax)
  jmp    L208
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x72,(%rax)
  jmp    L208
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x62,(%rax)
  jmp    L208
L3:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  jmp    L208
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x22,(%rax)
  jmp    L208
L242:
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rcx),%edx
  mov    %dl,(%rax)
L208:
  addq   $0x1,-0x10(%rbp)
L201:
  mov    -0x10(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jb     L33
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L247:
  leave
  ret
```

assistant: ```c
char *escape(const char *input) {
  size_t len;
  int escapes = 0;
  for (len = 0; input[len]; ++len) {
    switch (input[len]) {
    case '\n':
    case '\t':
    case '\r':
    case '\b':
    case '\\':
    case '"':
      escapes++;
    default:
      break;
    }
  }
  if (!escapes)
    return NULL;
  char *rv = (char *)malloc(len + escapes + 1);
  char *ptr = rv;
  for (size_t i = 0; i < len; ++i) {
    switch (input[i]) {
    case '\n':
      *(ptr++) = '\\';
      *(ptr++) = 'n';
      break;
    case '\t':
      *(ptr++) = '\\';
      *(ptr++) = 't';
      break;
    case '\r':
      *(ptr++) = '\\';
      *(ptr++) = 'r';
      break;
    case '\b':
      *(ptr++) = '\\';
      *(ptr++) = 'b';
      break;
    case '\\':
      *(ptr++) = '\\';
      *(ptr++) = '\\';
      break;
    case '"':
      *(ptr++) = '\\';
      *(ptr++) = '"';
      break;
    default:
      *(ptr++) = input[i];
    }
  }
  *ptr = 0;
  return rv;
}
```