user: 请从给定的汇编指令推导出C源代码：

```asm
<stringify_string>:
  endbr64
  push   %r15
  xor    %r15d,%r15d
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  movzbl (%rdi),%r14d
  test   %r14b,%r14b
  je     L294
L245:
  test   %r15d,%r15d
  je     L168
  mov    %r13,%rsi
  mov    %r14d,%edx
  mov    $0x1,%ecx
  jmp    L148
  nopw   0x0(%rax,%rax,1)
L158:
  cmp    $0x5c,%dl
  je     L221
  mov    %ebp,%ebx
  test   %ebp,%ebp
  jne    L182
  xor    %ebx,%ebx
  cmp    $0x27,%dl
  setne  %bl
  nopl   0x0(%rax,%rax,1)
L182:
  add    $0x1,%rsi
  mov    %dl,(%rax,%rcx,1)
  add    $0x1,%rcx
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L238
L148:
  test   %ebx,%ebx
  jne    L158
  test   %r12d,%r12d
  je     L43
  cmp    $0x22,%dl
  je     L241
  cmp    $0x5c,%dl
  je     L241
  test   %ebp,%ebp
  setne  %bpl
  movzbl %bpl,%ebp
  jmp    L182
  nopl   0x0(%rax)
L43:
  cmp    $0x22,%dl
  je     L72
  xor    %ebx,%ebx
  cmp    $0x27,%dl
  sete   %bl
  jmp    L182
  nopl   0x0(%rax,%rax,1)
L221:
  mov    %ebx,%ebp
L3:
  movb   $0x5c,(%rax,%rcx,1)
  add    $0x1,%rcx
  jmp    L182
  nopl   0x0(%rax)
L241:
  xor    %edi,%edi
  cmp    $0x5c,%dl
  cmovne %ebp,%r12d
  cmovne %edi,%ebx
  cmove  %r12d,%ebp
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L238:
  add    $0x1,%r15d
L10:
  movb   $0x22,(%rax,%rcx,1)
  movb   $0x0,0x1(%rax,%rcx,1)
  cmp    $0x2,%r15d
  jne    L283
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L286:
  mov    $0x1,%r15d
L35:
  add    $0x2,%rdi
  call   <malloc@plt>
L283:
  movb   $0x22,(%rax)
  test   %r14b,%r14b
  jne    L245
L294:
  add    $0x1,%r15d
  cmp    $0x1,%r15d
  je     L163
  mov    $0x1,%ecx
  jmp    L10
L72:
  mov    $0x1,%r12d
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L168:
  mov    %r13,%rdx
  mov    %r14d,%eax
  mov    $0x1,%edi
  jmp    L278
  nopl   (%rax)
L121:
  cmp    $0x5c,%al
  je     L113
  mov    %ebp,%ebx
  test   %ebp,%ebp
  jne    L270
  xor    %ebx,%ebx
  cmp    $0x27,%al
  setne  %bl
  nopl   0x0(%rax)
L270:
  movzbl 0x1(%rdx),%eax
  add    $0x1,%rdx
  add    $0x1,%rdi
  test   %al,%al
  je     L286
L278:
  test   %ebx,%ebx
  jne    L121
  test   %r12d,%r12d
  jne    L58
  cmp    $0x22,%al
  je     L224
  xor    %ebx,%ebx
  cmp    $0x27,%al
  sete   %bl
  jmp    L270
  xchg   %ax,%ax
L58:
  cmp    $0x5c,%al
  je     L103
  cmp    $0x22,%al
  je     L103
  test   %ebp,%ebp
  setne  %bpl
  movzbl %bpl,%ebp
  jmp    L270
  nopl   0x0(%rax)
L113:
  mov    %ebx,%ebp
L62:
  add    $0x1,%rdi
  jmp    L270
L103:
  xor    %ecx,%ecx
  cmp    $0x5c,%al
  cmovne %ebp,%r12d
  cmovne %ecx,%ebx
  cmove  %r12d,%ebp
  jmp    L62
  nopl   0x0(%rax)
L224:
  mov    $0x1,%r12d
  jmp    L62
L163:
  mov    $0x1,%edi
  jmp    L35
```

assistant: ```c
char *stringify_string(char *x) {
  size_t l;
  int i, inside_str = 0, inside_cc = 0, must_quote, has_quoted = 0;
  char *y, *d;
  for (i = 0; i < 2; i++) {
    if (i)
      d[0] = '"';
    for (l = 1, y = x; *y; y++, l++) {
      must_quote = 0;
      if (inside_cc) {
        if (*y == '\\') {
          must_quote = 1;
          has_quoted = 1;
        } else if (!has_quoted && *y == '\'')
          inside_cc = 0;
      } else if (inside_str) {
        if (*y == '"' || *y == '\\')
          must_quote = 1;
        if (*y == '\\')
          has_quoted = 1;
        else if (!has_quoted && *y == '"')
          inside_str = 0;
      } else if (*y == '"') {
        inside_str = 1;
        must_quote = 1;
      } else if (*y == '\'') {
        inside_cc = 1;
      }
      if (must_quote) {
        if (i)
          d[l] = '\\';
        l++;
      }
      if (i)
        d[l] = *y;
    }
    if (!i)
      d = malloc(l + 2);
    if (i) {
      d[l] = '"';
      d[l + 1] = 0;
    }
  }
  return d;
}
```