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

```asm
<escape_string>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L198
L22:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x22,%eax
  jg     L199
  cmp    $0x7,%eax
  jl     L27
  sub    $0x7,%eax
  cmp    $0x1b,%eax
  ja     L27
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D10(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D10(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
L199:
  cmp    $0x5c,%eax
  je     L36
  jmp    L27
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x62,(%rax)
  jmp    L46
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x66,(%rax)
  jmp    L46
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x6e,(%rax)
  jmp    L46
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x72,(%rax)
  jmp    L46
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x74,(%rax)
  jmp    L46
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x76,(%rax)
  jmp    L46
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x61,(%rax)
  jmp    L46
L36:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x18(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L46
L27:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isprint@plt>
  test   %eax,%eax
  je     L173
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x18(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L71
L173:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x78,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  cmp    $0x9,%al
  jle    L138
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  add    $0x37,%eax
  mov    %eax,%ecx
  jmp    L190
L138:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  add    $0x30,%eax
  mov    %eax,%ecx
L190:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %cl,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  and    $0xf,%eax
  cmp    $0x9,%eax
  jle    L16
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  and    $0xf,%eax
  add    $0x37,%eax
  mov    %eax,%ecx
  jmp    L1
L16:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  and    $0xf,%eax
  add    $0x30,%eax
  mov    %eax,%ecx
L1:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %cl,(%rax)
L71:
  nop
L46:
  addq   $0x1,-0x18(%rbp)
L198:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L22
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *escape_string(char *s) {
  char *ss = (char *)malloc((strlen(s) + 1) * 4), *sss = ss;
  for (; *s; s++) {
    switch (*s) {
    case '\b':
      *ss++ = '\\';
      *ss++ = 'b';
      break;
      ;
    case '\f':
      *ss++ = '\\';
      *ss++ = 'f';
      break;
      ;
    case '\n':
      *ss++ = '\\';
      *ss++ = 'n';
      break;
      ;
    case '\r':
      *ss++ = '\\';
      *ss++ = 'r';
      break;
      ;
    case '\t':
      *ss++ = '\\';
      *ss++ = 't';
      break;
      ;
    case '\v':
      *ss++ = '\\';
      *ss++ = 'v';
      break;
      ;
    case '\a':
      *ss++ = '\\';
      *ss++ = 'a';
      break;
      ;
    case '\\':
    case '\"':
      *ss++ = '\\';
      *ss++ = *s;
      break;
    default:
      if (isprint(*s)) {
        *ss++ = *s;
      } else {
        *ss++ = '\\';
        *ss++ = 'x';
        *ss++ = ((((*s) >> 4) > 9) ? (((*s) >> 4) - 10 + 'A') : (((*s) >> 4) + '0'));
        *ss++ = ((((*s) & 15) > 9) ? (((*s) & 15) - 10 + 'A') : (((*s) & 15) + '0'));
      }
      break;
    }
  }
  *ss = 0;
  return sss;
}
```