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

```asm
<json_serialize_string>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    D103(%rip),%rsi
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <append_string@plt>
  test   %eax,%eax
  js     L123
  mov    %eax,%ebx
  cltq
  add    %r13,%rax
  test   %r13,%r13
  cmovne %rax,%r13
  test   %r12,%r12
  je     L181
  add    %r14,%r12
  lea    D14(%rip),%r15
  lea    D77(%rip),%rbp
  nopl   0x0(%rax,%rax,1)
L162:
  movzbl (%r14),%eax
  cmp    $0x2f,%al
  jg     L94
  cmp    $0x7,%al
  jle    L59
  lea    -0x8(%rax),%ecx
  cmp    $0x27,%cl
  ja     L59
  movzbl %cl,%ecx
  movslq 0x0(%rbp,%rcx,4),%rcx
  add    %rbp,%rcx
  notrack jmp *%rcx
  cs nopw 0x0(%rax,%rax,1)
L59:
  test   %r13,%r13
  je     L28
  mov    %al,0x0(%r13)
  add    $0x1,%r13
L28:
  add    $0x1,%ebx
L51:
  add    $0x1,%r14
  cmp    %r14,%r12
  jne    L162
L181:
  lea    D103(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  js     L123
  add    $0x8,%rsp
  add    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
  lea    D76(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  js     L123
  nopl   0x0(%rax,%rax,1)
L200:
  movslq %eax,%rcx
  add    %r13,%rcx
  test   %r13,%r13
  cmovne %rcx,%r13
  add    %eax,%ebx
  jmp    L51
  nopl   0x0(%rax)
  lea    D3(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
L123:
  add    $0x8,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
  lea    D2(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
  jmp    L123
  nopl   (%rax)
  lea    D47(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
  jmp    L123
  nopl   (%rax)
  lea    D38(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
  jmp    L123
  nopl   0x0(%rax)
  lea    D95(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
  jmp    L123
  nopl   0x0(%rax)
  lea    D25(%rip),%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
  jmp    L123
  nopl   0x0(%rax)
L94:
  cmp    $0x5c,%al
  jne    L59
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <append_string@plt>
  test   %eax,%eax
  jns    L200
  jmp    L123
```

tool_calls: name: unpack_data
arguments: tag: D103
type_guessed: string
name: unpack_data
arguments: tag: D14
type_guessed: string
name: unpack_data
arguments: tag: D76
type_guessed: string
name: unpack_data
arguments: tag: D3
type_guessed: string
name: unpack_data
arguments: tag: D2
type_guessed: string
name: unpack_data
arguments: tag: D47
type_guessed: string
name: unpack_data
arguments: tag: D38
type_guessed: string
name: unpack_data
arguments: tag: D95
type_guessed: string
name: unpack_data
arguments: tag: D25
type_guessed: string

tool: D103: "

tool: D14: \\

tool: D76: \/

tool: D3: \"

tool: D2: \r

tool: D47: \f

tool: D38: \n

tool: D95: \t

tool: D25: \b

assistant: ```c
int json_serialize_string(const char *string, char *buf) {
  size_t i = 0, len = strlen(string);
  char c = '\0';
  int written = -1, written_total = 0;
  do {
    written = append_string(buf, ("\""));
    if (written < 0) {
      return -1;
    }
    if (buf != NULL) {
      buf += written;
    }
    written_total += written;
  } while (0);
  for (i = 0; i < len; i++) {
    c = string[i];
    switch (c) {
    case '\"':
      do {
        written = append_string(buf, ("\\\""));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '\\':
      do {
        written = append_string(buf, ("\\\\"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '/':
      do {
        written = append_string(buf, ("\\/"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '\b':
      do {
        written = append_string(buf, ("\\b"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '\f':
      do {
        written = append_string(buf, ("\\f"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '\n':
      do {
        written = append_string(buf, ("\\n"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '\r':
      do {
        written = append_string(buf, ("\\r"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    case '\t':
      do {
        written = append_string(buf, ("\\t"));
        if (written < 0) {
          return -1;
        }
        if (buf != NULL) {
          buf += written;
        }
        written_total += written;
      } while (0);
      break;
    default:
      if (buf != NULL) {
        buf[0] = c;
        buf += 1;
      }
      written_total += 1;
      break;
    }
  }
  do {
    written = append_string(buf, ("\""));
    if (written < 0) {
      return -1;
    }
    if (buf != NULL) {
      buf += written;
    }
    written_total += written;
  } while (0);
  return written_total;
}
```