user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<write_escaped_string>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %edx,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsi,%rdi
  call   <strlen@plt>
  movslq %eax,%rbp
  add    %rbx,%rbp
  cmp    %rbp,%rbx
  jae    L200
  mov    $0x1,%r13d
  lea    0x14(%rsp),%r14
  lea    D29(%rip),%r15
  jmp    L127
L164:
  or     0xc(%rsp),%r13d
  jne    L189
L116:
  lea    -0x20(%rdi),%eax
  cmp    $0x5e,%eax
  jbe    L170
  cmp    $0xffff,%edi
  ja     L101
  mov    %edi,%esi
  and    $0xf,%esi
  mov    %edi,%eax
  shr    $0x4,%eax
  and    $0xf,%eax
  mov    %edi,%edx
  shr    $0x8,%edx
  and    $0xf,%edx
  movsbl (%r15,%rdx,1),%ecx
  shr    $0xc,%edi
  mov    %edi,%edi
  movsbl (%r15,%rdi,1),%edx
  movsbl (%r15,%rsi,1),%r9d
  movsbl (%r15,%rax,1),%r8d
  lea    D36(%rip),%rsi
  mov    %r12,%rdi
  call   <fprintf@plt>
  jmp    L141
L189:
  mov    %r12,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    %r12,%rsi
  mov    $0x20,%edi
  call   <putc@plt>
  jmp    L141
L194:
  mov    %r12,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    %r12,%rsi
  mov    $0x74,%edi
  call   <putc@plt>
  jmp    L141
L179:
  mov    %r12,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    %r12,%rsi
  mov    $0x6e,%edi
  call   <putc@plt>
  jmp    L141
L17:
  mov    %r12,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    %r12,%rsi
  mov    $0x72,%edi
  call   <putc@plt>
  jmp    L141
L145:
  lea    -0x21(%rdi),%eax
  cmp    $0x3b,%eax
  ja     L116
  movabs $0x800000012000005,%rcx
  bt     %rax,%rcx
  jae    L170
  mov    %r12,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    %r12,%rsi
  mov    0x14(%rsp),%edi
  call   <putc@plt>
L141:
  mov    $0x0,%r13d
  cmp    %rbx,%rbp
  jbe    L200
L127:
  mov    %ebp,%edx
  sub    %ebx,%edx
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   <u8_mbtouc@plt>
  cltq
  add    %rax,%rbx
  mov    0x14(%rsp),%edi
  cmp    $0x20,%edi
  je     L164
  cmp    $0x9,%edi
  je     L194
  cmp    $0xa,%edi
  je     L179
  cmp    $0xd,%edi
  je     L17
  cmp    $0xc,%edi
  jne    L145
  mov    %r12,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    %r12,%rsi
  mov    $0x66,%edi
  call   <putc@plt>
  jmp    L141
L170:
  mov    %r12,%rsi
  call   <putc@plt>
  jmp    L141
L101:
  lea    -0x10000(%rdi),%edx
  shr    $0xa,%edx
  lea    0xd800(%rdx),%eax
  and    $0x3ff,%edi
  lea    0xdc00(%rdi),%r13d
  and    $0xf,%edx
  mov    %eax,%ecx
  shr    $0x4,%ecx
  and    $0xf,%ecx
  mov    %eax,%esi
  shr    $0x8,%esi
  and    $0xf,%esi
  movsbl (%r15,%rsi,1),%esi
  shr    $0xc,%eax
  and    $0xf,%eax
  movsbl (%r15,%rax,1),%eax
  movsbl (%r15,%rdx,1),%r9d
  movsbl (%r15,%rcx,1),%r8d
  mov    %esi,%ecx
  mov    %eax,%edx
  lea    D36(%rip),%rsi
  mov    %r12,%rdi
  call   <fprintf@plt>
  mov    %r13d,%edx
  and    $0xf,%edx
  mov    %r13d,%eax
  shr    $0x4,%eax
  and    $0xf,%eax
  shr    $0x8,%r13d
  and    $0xf,%r13d
  movsbl (%r15,%r13,1),%ecx
  movsbl (%r15,%rdx,1),%r9d
  movsbl (%r15,%rax,1),%r8d
  mov    $0x64,%edx
  lea    D36(%rip),%rsi
  mov    %r12,%rdi
  call   <fprintf@plt>
  jmp    L141
L200:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L136
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L136:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D29
type: string
name: retrieve_data
arguments: data_label: D36
type: string

tool: D29: 0123456789abcdef

tool: D36: \u%c%c%c%c

assistant: ```c
void write_escaped_string(FILE *fp, const char *str, bool in_key) {
  static const char hexdigit[] = "0123456789abcdef";
  const char *str_limit = str + strlen(str);
  bool first = true;
  while (str < str_limit) {
    unsigned int uc;
    str += u8_mbtouc(&uc, (const unsigned char *)str, str_limit - str);
    if (uc == 0x0020 && (first || in_key)) {
      putc('\\', fp);
      putc(' ', fp);
    } else if (uc == 0x0009) {
      putc('\\', fp);
      putc('t', fp);
    } else if (uc == 0x000a) {
      putc('\\', fp);
      putc('n', fp);
    } else if (uc == 0x000d) {
      putc('\\', fp);
      putc('r', fp);
    } else if (uc == 0x000c) {
      putc('\\', fp);
      putc('f', fp);
    } else if (uc == '\\' || uc == '#' || uc == '!' || uc == '=' || uc == ':') {
      putc('\\', fp);
      putc(uc, fp);
    } else if (uc >= 0x0020 && uc <= 0x007e) {
      putc(uc, fp);
    } else if (uc < 0x10000) {
      fprintf(fp, "\\u%c%c%c%c", hexdigit[(uc >> 12) & 0x0f], hexdigit[(uc >> 8) & 0x0f], hexdigit[(uc >> 4) & 0x0f], hexdigit[uc & 0x0f]);
    } else {
      unsigned int uc1 = 0xd800 + ((uc - 0x10000) >> 10);
      unsigned int uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
      fprintf(fp, "\\u%c%c%c%c", hexdigit[(uc1 >> 12) & 0x0f], hexdigit[(uc1 >> 8) & 0x0f], hexdigit[(uc1 >> 4) & 0x0f], hexdigit[uc1 & 0x0f]);
      fprintf(fp, "\\u%c%c%c%c", hexdigit[(uc2 >> 12) & 0x0f], hexdigit[(uc2 >> 8) & 0x0f], hexdigit[(uc2 >> 4) & 0x0f], hexdigit[uc2 & 0x0f]);
    }
    first = false;
  }
}
```