user: What is the c source code of the assembly code below?

```asm
<escape_for_shell>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L319
  call   <free@plt>
L319:
  test   %r12,%r12
  je     L285
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L285
  jle    L452
  lea    -0x1(%rax),%r13d
  cmp    $0xe,%r13d
  jbe    L420
  mov    %ebx,%edx
  pxor   %xmm1,%xmm1
  pxor   %xmm5,%xmm5
  mov    %r12,%rax
  shr    $0x4,%edx
  movdqa D11(%rip),%xmm7
  movdqa D28(%rip),%xmm6
  pxor   %xmm4,%xmm4
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%r12,%rdx,1),%rdx
L152:
  movdqu (%rax),%xmm0
  movdqa %xmm5,%xmm3
  add    $0x10,%rax
  pcmpeqb %xmm7,%xmm0
  pand   %xmm6,%xmm0
  pcmpgtb %xmm0,%xmm3
  movdqa %xmm0,%xmm2
  punpcklbw %xmm3,%xmm2
  punpckhbw %xmm3,%xmm0
  movdqa %xmm4,%xmm3
  pcmpgtw %xmm2,%xmm3
  movdqa %xmm2,%xmm8
  punpcklwd %xmm3,%xmm8
  punpckhwd %xmm3,%xmm2
  movdqa %xmm0,%xmm3
  paddd  %xmm8,%xmm1
  paddd  %xmm2,%xmm1
  movdqa %xmm4,%xmm2
  pcmpgtw %xmm0,%xmm2
  punpcklwd %xmm2,%xmm3
  punpckhwd %xmm2,%xmm0
  paddd  %xmm3,%xmm1
  paddd  %xmm0,%xmm1
  cmp    %rdx,%rax
  jne    L152
  movdqa %xmm1,%xmm0
  mov    %ebx,%edx
  psrldq $0x8,%xmm0
  and    $0xfffffff0,%edx
  paddd  %xmm0,%xmm1
  movdqa %xmm1,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm1
  movd   %xmm1,%eax
  test   $0xf,%bl
  je     L558
L374:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L97
  add    $0x1,%edx
  cmp    %ebx,%edx
  jge    L558
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L166
L211:
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L188
L133:
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L39
L274:
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L524:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L425
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L442:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L565
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L180:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L466
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L172:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L358
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L532:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L312
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L335:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L325
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L632:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L482
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L692:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L595
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L514:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L590
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L567:
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  je     L535
  add    $0x1,%edx
  cmp    %edx,%ebx
  jle    L558
L548:
  movslq %edx,%rdx
  cmpb   $0x27,(%r12,%rdx,1)
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
L558:
  test   %eax,%eax
  je     L452
L657:
  lea    (%rax,%rax,2),%eax
  lea    0x3(%rbx,%rax,1),%edi
  call   <malloc@plt>
  xor    %edx,%edx
  mov    %rax,0x0(%rbp)
  cmpb   $0x27,(%r12)
  je     L597
  movb   $0x27,(%rax)
  mov    0x0(%rbp),%rax
  mov    $0x1,%edx
L597:
  mov    %ebx,%r10d
  xor    %ecx,%ecx
  jmp    L52
  nopw   0x0(%rax,%rax,1)
L280:
  mov    %dil,(%r9)
  mov    %esi,%edx
L682:
  mov    0x0(%rbp),%rsi
  add    $0x1,%rcx
  mov    %rsi,%rax
  cmp    %rcx,%r10
  je     L651
L52:
  movzbl (%r12,%rcx,1),%edi
  movslq %edx,%r8
  lea    0x1(%rdx),%esi
  lea    (%rax,%r8,1),%r9
  cmp    $0x27,%dil
  jne    L280
  mov    %ecx,%edi
  test   %rcx,%rcx
  je     L84
  movslq %esi,%r8
  movb   $0x27,(%r9)
  mov    0x0(%rbp),%rax
  mov    %r8,%rdx
  lea    0x1(%r8),%esi
L84:
  movb   $0x5c,(%rax,%r8,1)
  mov    0x0(%rbp),%r8
  movslq %esi,%rsi
  lea    0x2(%rdx),%eax
  movb   $0x27,(%r8,%rsi,1)
  cmp    %edi,%r13d
  je     L480
  mov    0x0(%rbp),%rsi
  cltq
  add    $0x1,%rcx
  add    $0x3,%edx
  movb   $0x27,(%rsi,%rax,1)
  mov    0x0(%rbp),%rsi
  mov    %rsi,%rax
  cmp    %rcx,%r10
  jne    L52
L651:
  movslq %ebx,%rbx
  cmpb   $0x27,-0x1(%r12,%rbx,1)
  je     L238
  movslq %edx,%rax
  add    $0x1,%edx
  movb   $0x27,(%rsi,%rax,1)
  mov    0x0(%rbp),%rsi
L238:
  movslq %edx,%rdx
  movb   $0x0,(%rsi,%rdx,1)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L285:
  lea    D21(%rip),%rdi
  call   <strdup@plt>
  mov    %rax,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L480:
  mov    %eax,%edx
  jmp    L682
  nop
L425:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L442
  jmp    L657
  nopl   0x0(%rax,%rax,1)
L452:
  lea    0x3(%rbx),%edi
  call   <malloc@plt>
  mov    %r12,%rdx
  lea    D27(%rip),%rsi
  mov    %rax,0x0(%rbp)
  add    $0x8,%rsp
  mov    %rax,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10c0 <sprintf@plt>
L97:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jle    L657
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  jne    L211
L166:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jle    L657
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  jne    L133
L188:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jle    L657
  movslq %edx,%rcx
  cmpb   $0x27,(%r12,%rcx,1)
  jne    L274
L39:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L524
  jmp    L657
  nopw   0x0(%rax,%rax,1)
L565:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L180
  jmp    L657
  nopl   0x0(%rax,%rax,1)
L466:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L172
  jmp    L657
  nopl   0x0(%rax,%rax,1)
L358:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L532
  jmp    L657
  nopl   0x0(%rax,%rax,1)
L312:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L335
  jmp    L657
  nopl   0x0(%rax,%rax,1)
L325:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L632
  jmp    L657
L482:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L692
  jmp    L657
L420:
  xor    %eax,%eax
  xor    %edx,%edx
  jmp    L374
L595:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %ebx,%edx
  jl     L514
  jmp    L657
L590:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L567
  jmp    L657
L535:
  add    $0x1,%edx
  add    $0x1,%eax
  cmp    %edx,%ebx
  jg     L548
  jmp    L657
```

tool_calls: name: unpack_data
arguments: label: D11
type_guessed: byte[16]
name: unpack_data
arguments: label: D28
type_guessed: byte[16]
name: unpack_data
arguments: label: D21
type_guessed: string
name: unpack_data
arguments: label: D27
type_guessed: string

tool: {"D11": [0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27]}

tool: {"D28": [0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01]}

tool: D21: ''

tool: D27: '%s'

assistant: ```c
void escape_for_shell(char **p, const char *text) {
  int len, i, c;
  if (*p)
    free(*p);
  if (!text || (len = strlen(text)) == 0) {
    *p = strdup("''");
    return;
  }
  for (i = 0, c = 0; i < len; i++)
    if (text[i] == '\'')
      c++;
  if (c == 0) {
    *p = (char *)malloc(len + 3);
    sprintf(*p, "'%s'", text);
    return;
  }
  *p = (char *)malloc(len + c * 3 + 3);
  c = 0;
  if (text[0] != '\'') {
    (*p)[c++] = '\'';
  }
  for (i = 0; i < len; i++) {
    if (text[i] == '\'') {
      if (i != 0)
        (*p)[c++] = '\'';
      (*p)[c++] = '\\';
      (*p)[c++] = '\'';
      if (i != len - 1)
        (*p)[c++] = '\'';
    } else {
      (*p)[c++] = text[i];
    }
  }
  if (text[len - 1] != '\'') {
    (*p)[c++] = '\'';
  }
  (*p)[c++] = '\0';
}
```