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

```asm
<write_escaped_string>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x1,-0x1c(%rbp)
  jmp    L135
L184:
  mov    -0x10(%rbp),%rax
  sub    -0x30(%rbp),%rax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rcx
  lea    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <u8_mbtouc@plt>
  cltq
  add    %rax,-0x30(%rbp)
  mov    -0x20(%rbp),%eax
  cmp    $0x20,%eax
  jne    L222
  cmpl   $0x0,-0x1c(%rbp)
  jne    L160
  cmpl   $0x0,-0x34(%rbp)
  je     L222
L160:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x20,%edi
  call   <putc@plt>
  jmp    L205
L222:
  mov    -0x20(%rbp),%eax
  cmp    $0x9,%eax
  jne    L8
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x74,%edi
  call   <putc@plt>
  jmp    L205
L8:
  mov    -0x20(%rbp),%eax
  cmp    $0xa,%eax
  jne    L26
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x6e,%edi
  call   <putc@plt>
  jmp    L205
L26:
  mov    -0x20(%rbp),%eax
  cmp    $0xd,%eax
  jne    L118
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x72,%edi
  call   <putc@plt>
  jmp    L205
L118:
  mov    -0x20(%rbp),%eax
  cmp    $0xc,%eax
  jne    L89
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x66,%edi
  call   <putc@plt>
  jmp    L205
L89:
  mov    -0x20(%rbp),%eax
  cmp    $0x5c,%eax
  je     L151
  mov    -0x20(%rbp),%eax
  cmp    $0x23,%eax
  je     L151
  mov    -0x20(%rbp),%eax
  cmp    $0x21,%eax
  je     L151
  mov    -0x20(%rbp),%eax
  cmp    $0x3d,%eax
  je     L151
  mov    -0x20(%rbp),%eax
  cmp    $0x3a,%eax
  jne    L144
L151:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  mov    -0x20(%rbp),%eax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <putc@plt>
  jmp    L205
L144:
  mov    -0x20(%rbp),%eax
  cmp    $0x1f,%eax
  jbe    L49
  mov    -0x20(%rbp),%eax
  cmp    $0x7e,%eax
  ja     L49
  mov    -0x20(%rbp),%eax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <putc@plt>
  jmp    L205
L49:
  mov    -0x20(%rbp),%eax
  cmp    $0xffff,%eax
  ja     L3
  mov    -0x20(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%edi
  mov    -0x20(%rbp),%eax
  shr    $0x4,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%esi
  mov    -0x20(%rbp),%eax
  shr    $0x8,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%ecx
  mov    -0x20(%rbp),%eax
  shr    $0xc,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edi,%r9d
  mov    %esi,%r8d
  lea    D95(%rip),%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  jmp    L205
L3:
  mov    -0x20(%rbp),%eax
  sub    $0x10000,%eax
  shr    $0xa,%eax
  add    $0xd800,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x20(%rbp),%eax
  and    $0x3ff,%eax
  add    $0xdc00,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%edi
  mov    -0x18(%rbp),%eax
  shr    $0x4,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%esi
  mov    -0x18(%rbp),%eax
  shr    $0x8,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%ecx
  mov    -0x18(%rbp),%eax
  shr    $0xc,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edi,%r9d
  mov    %esi,%r8d
  lea    D95(%rip),%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    -0x14(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%edi
  mov    -0x14(%rbp),%eax
  shr    $0x4,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%esi
  mov    -0x14(%rbp),%eax
  shr    $0x8,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%ecx
  mov    -0x14(%rbp),%eax
  shr    $0xc,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  lea    D45(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edi,%r9d
  mov    %esi,%r8d
  lea    D95(%rip),%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
L205:
  movl   $0x0,-0x1c(%rbp)
L135:
  mov    -0x30(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L184
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L243
  call   <__stack_chk_fail@plt>
L243:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D45
data_type: string
name: retrieve_data
arguments: data_label: D95
data_type: string

tool: D45: 0123456789abcdef

tool: D95: \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;
  }
}
```