user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<vsnprintf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x48(%rbp)
  movl   $0x0,-0x54(%rbp)
  mov    -0x78(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  jmp    L37
L91:
  mov    -0x50(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x25,%al
  je     L125
  cmpl   $0x0,-0x54(%rbp)
  jne    L66
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  cmp    %rax,-0x70(%rbp)
  ja     L36
  movl   $0x1,-0x54(%rbp)
  mov    -0x68(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L66
L36:
  mov    -0x68(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x50(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%rdx)
L66:
  addq   $0x1,-0x48(%rbp)
  jmp    L97
L125:
  nop
  addq   $0x1,-0x50(%rbp)
  mov    -0x50(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x25,%eax
  je     L131
  cmp    $0x25,%eax
  jl     L60
  cmp    $0x78,%eax
  jg     L60
  cmp    $0x63,%eax
  jl     L60
  sub    $0x63,%eax
  cmp    $0x15,%eax
  ja     L60
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D26(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D26(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  lea    -0x30(%rbp),%rax
  add    $0x1f,%rax
  mov    %eax,%edx
  addq   $0x1,-0x80(%rbp)
  mov    -0x80(%rbp),%rax
  mov    (%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <stringify_int@plt>
  mov    %rax,-0x40(%rbp)
  jmp    L185
  lea    -0x30(%rbp),%rax
  add    $0x1f,%rax
  mov    %eax,%edx
  addq   $0x1,-0x80(%rbp)
  mov    -0x80(%rbp),%rax
  mov    (%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <stringify_hex@plt>
  mov    %rax,-0x40(%rbp)
  jmp    L185
  addq   $0x1,-0x80(%rbp)
  mov    -0x80(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L185
  addq   $0x1,-0x80(%rbp)
  mov    -0x80(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x30(%rbp)
  movb   $0x0,-0x2f(%rbp)
  lea    -0x30(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L185
L131:
  movb   $0x25,-0x30(%rbp)
  movb   $0x0,-0x2f(%rbp)
  lea    -0x30(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L185
L60:
  mov    -0x50(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <print_int@plt>
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  call   <print_str@plt>
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <print_str@plt>
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <print_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L185:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x38(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jne    L54
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x70(%rbp)
  ja     L70
  movl   $0x1,-0x54(%rbp)
  mov    -0x68(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L54
L70:
  mov    -0x68(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
L54:
  mov    -0x38(%rbp),%rax
  add    %rax,-0x48(%rbp)
L97:
  addq   $0x1,-0x50(%rbp)
L37:
  mov    -0x50(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L91
  mov    -0x68(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x48(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L161
  call   <__stack_chk_fail@plt>
L161:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D37
datatype: string
name: unpack_data
arguments: data_label: D4
datatype: string

tool: D37:  in 

tool: D4: : unknown format!


assistant: ```c
int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) {
  const char *inp;
  size_t off = 0;
  int is_overlow = 0;
  for (inp = fmt; *inp; inp++) {
    if (*inp != '%') {
      if (!is_overlow) {
        if (off + 1 >= size) {
          is_overlow = 1;
          buf[off] = 0;
        } else {
          buf[off] = *inp;
        }
      }
      off++;
      continue;
    }
    char cur_buf[32];
    char *cur_p;
  retry:
    switch (*++inp) {
    case 'l':
      goto retry;
    case 'd':
    case 'u':
      cur_p = stringify_int(*(long *)++ap, cur_buf + sizeof(cur_buf) - 1);
      break;
    case 'x':
      cur_p = stringify_hex(*(long *)++ap, cur_buf + sizeof(cur_buf) - 1);
      break;
    case 's':
      cur_p = *(char **)++ap;
      break;
    case 'c':
      cur_buf[0] = *(char *)++ap;
      cur_buf[1] = 0;
      cur_p = cur_buf;
      break;
    case '%':
      cur_buf[0] = '%';
      cur_buf[1] = 0;
      cur_p = cur_buf;
      break;
    default:
      print_int(*inp);
      print_str(" in ");
      print_str(fmt);
      print_str(": unknown format!\n");
      exit(1);
    }
    size_t len = strlen(cur_p);
    if (!is_overlow) {
      if (off + len >= size) {
        is_overlow = 1;
        buf[off] = 0;
      } else {
        strcpy(buf + off, cur_p);
      }
    }
    off += len;
  }
  buf[off] = 0;
  return off;
}
```