user: Demonstrate the C code that generates the assembly output below:

```asm
<vsnprintf>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,%r13
  mov    %rdx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movzbl (%rdx),%eax
  test   %al,%al
  je     L27
  mov    %rsi,%r15
  mov    %rcx,%r14
  mov    $0x0,%r12d
  mov    $0x0,%ebx
  lea    0x3f(%rsp),%ecx
  mov    %ecx,0x14(%rsp)
  jmp    L147
L44:
  mov    %al,0x0(%r13,%rbx,1)
L118:
  add    $0x1,%rbx
  mov    %rdx,%rbp
L50:
  lea    0x1(%rbp),%rdx
  movzbl 0x1(%rbp),%eax
  test   %al,%al
  je     L186
L147:
  cmp    $0x25,%al
  je     L79
  test   %r12d,%r12d
  jne    L118
  lea    0x1(%rbx),%rcx
  cmp    %r15,%rcx
  jb     L44
  movb   $0x0,0x0(%r13,%rbx,1)
  mov    $0x1,%r12d
  jmp    L118
  mov    %rbp,%rdx
L79:
  lea    0x1(%rdx),%rbp
  movzbl 0x1(%rdx),%edi
  cmp    $0x25,%dil
  je     L113
  lea    -0x63(%rdi),%eax
  cmp    $0x15,%al
  ja     L195
  ja     L195
  movzbl %al,%eax
  lea    D11(%rip),%rsi
  movslq (%rsi,%rax,4),%rax
  add    %rsi,%rax
  notrack jmp *%rax
  add    $0x1,%r14
  mov    0x14(%rsp),%esi
  mov    (%r14),%rdi
  call   <stringify_int@plt>
  mov    %rax,0x8(%rsp)
L43:
  mov    0x8(%rsp),%rdi
  call   <strlen@plt>
  mov    %rax,(%rsp)
  test   %r12d,%r12d
  jne    L107
  add    %rbx,%rax
  cmp    %r15,%rax
  jb     L97
  movb   $0x0,0x0(%r13,%rbx,1)
  mov    $0x1,%r12d
L107:
  add    (%rsp),%rbx
  jmp    L50
  add    $0x1,%r14
  mov    0x14(%rsp),%esi
  mov    (%r14),%rdi
  call   <stringify_hex@plt>
  mov    %rax,0x8(%rsp)
  jmp    L43
  add    $0x1,%r14
  mov    (%r14),%rax
  mov    %rax,0x8(%rsp)
  jmp    L43
  add    $0x1,%r14
  movzbl (%r14),%eax
  mov    %al,0x20(%rsp)
  movb   $0x0,0x21(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L43
L113:
  movb   $0x25,0x20(%rsp)
  movb   $0x0,0x21(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L43
L195:
  movsbl %dil,%edi
  call   <print_int@plt>
  lea    D1(%rip),%rdi
  call   <print_str@plt>
  mov    0x18(%rsp),%rdi
  call   <print_str@plt>
  lea    D7(%rip),%rdi
  call   <print_str@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L43
L97:
  lea    0x0(%r13,%rbx,1),%rdi
  mov    0x8(%rsp),%rsi
  call   <strcpy@plt>
  jmp    L107
L27:
  mov    $0x0,%ebx
L186:
  movb   $0x0,0x0(%r13,%rbx,1)
  mov    %ebx,%eax
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L193
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L193:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D1
datatype: string
name: unpack_data
arguments: label: D7
datatype: string

tool: D1:  in 

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