user: Converte this assembly snippet into its equivalent C code:

```asm
<wprintf>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x1(%rsi),%rax
  movsbl (%rsi),%esi
  mov    %rax,0x8(%rsp)
  test   %esi,%esi
  je     L28
  lea    0x10(%rsp),%r13
  mov    %rdi,%rbp
  mov    %r13,%r15
  jmp    L281
  cs nopw 0x0(%rax,%rax,1)
L147:
  mov    %rbp,%rdi
  call   <wputchar@plt>
  mov    0x8(%rsp),%rbx
L14:
  movsbl (%rbx),%esi
  lea    0x1(%rbx),%rax
  mov    %rax,0x8(%rsp)
  test   %esi,%esi
  je     L28
L281:
  cmp    $0x25,%esi
  jne    L147
  movsbl 0x1(%rbx),%esi
  lea    0x2(%rbx),%rax
  mov    $0x20,%r14d
  mov    %rax,0x8(%rsp)
  cmp    $0x30,%esi
  jne    L195
  lea    0x3(%rbx),%rax
  movsbl 0x2(%rbx),%esi
  mov    $0x30,%r14d
  mov    %rax,0x8(%rsp)
L195:
  lea    -0x30(%rsi),%edx
  xor    %ecx,%ecx
  cmp    $0x9,%edx
  jbe    L156
L263:
  lea    0x8(%r15),%r12
  cmp    $0x6c,%esi
  je     L153
  lea    -0x63(%rsi),%eax
  cmp    $0x15,%eax
  ja     L96
  lea    D23(%rip),%rbx
  movslq (%rbx,%rax,4),%rax
  add    %rbx,%rax
  notrack jmp *%rax
  nopl   (%rax)
L96:
  mov    (%r15),%esi
  mov    %rbp,%rdi
  mov    %r12,%r15
  call   <wputchar@plt>
  mov    0x8(%rsp),%rbx
  movsbl (%rbx),%esi
  lea    0x1(%rbx),%rax
  mov    %rax,0x8(%rsp)
  test   %esi,%esi
  jne    L281
  nop
L28:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L121
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
  movslq (%r15),%rdx
  mov    %r13,%rdi
  mov    %ecx,0x4(%rsp)
  call   <itoa@plt>
  movsbl 0x10(%rsp),%esi
  mov    0x8(%rsp),%rbx
  mov    0x4(%rsp),%ecx
  test   %sil,%sil
  je     L108
L118:
  mov    %r13,%rax
  nopl   0x0(%rax)
L0:
  add    $0x1,%rax
  mov    %ecx,%edx
  sub    $0x1,%ecx
  cmpb   $0x0,(%rax)
  jne    L0
  lea    -0x2(%rdx),%r15d
  test   %ecx,%ecx
  jle    L52
  xchg   %ax,%ax
L33:
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <wputchar@plt>
  mov    %r15d,%eax
  sub    $0x1,%r15d
  test   %eax,%eax
  jg     L33
  movsbl 0x10(%rsp),%esi
  test   %sil,%sil
  je     L227
L52:
  mov    %r13,%r14
  nopl   0x0(%rax,%rax,1)
L283:
  mov    %rbp,%rdi
  add    $0x1,%r14
  call   <wputchar@plt>
  movsbl (%r14),%esi
  test   %sil,%sil
  jne    L283
L227:
  mov    %r12,%r15
  jmp    L14
  nopl   (%rax)
  movsbl (%r15),%esi
  mov    %rbp,%rdi
  mov    %r12,%r15
  call   <wputchar@plt>
  mov    0x8(%rsp),%rbx
  jmp    L14
  nopl   0x0(%rax)
  mov    0x8(%rsp),%rbx
  mov    (%r15),%r14
  test   %r14,%r14
  jne    L181
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L267:
  mov    %rbp,%rdi
  add    $0x1,%r14
  call   <wputchar@plt>
L181:
  movsbl (%r14),%esi
  test   %sil,%sil
  jne    L267
  mov    %r12,%r15
  jmp    L14
  nopl   (%rax)
L153:
  mov    0x8(%rsp),%rax
  movsbl (%rax),%esi
  lea    0x1(%rax),%rbx
  mov    %rbx,0x8(%rsp)
  lea    -0x63(%rsi),%eax
  cmp    $0x15,%al
  ja     L96
  lea    D7(%rip),%rdi
  movzbl %al,%eax
  movslq (%rdi,%rax,4),%rax
  add    %rdi,%rax
  notrack jmp *%rax
  mov    (%r15),%rdx
  mov    %r13,%rdi
  mov    %ecx,0x4(%rsp)
  call   <itoa@plt>
  movsbl 0x10(%rsp),%esi
  mov    0x4(%rsp),%ecx
  test   %sil,%sil
  jne    L118
L108:
  test   %ecx,%ecx
  jle    L227
  lea    -0x1(%rcx),%r15d
  jmp    L33
  nopw   0x0(%rax,%rax,1)
L156:
  mov    0x8(%rsp),%rax
  add    $0x1,%rax
  nopl   0x0(%rax)
L38:
  movsbl -0x1(%rax),%esi
  lea    (%rcx,%rcx,4),%ecx
  mov    %rax,%rdi
  add    $0x1,%rax
  lea    (%rdx,%rcx,2),%ecx
  lea    -0x30(%rsi),%edx
  cmp    $0x9,%edx
  jbe    L38
  mov    %rdi,0x8(%rsp)
  jmp    L263
  nopl   0x0(%rax,%rax,1)
L3:
  lea    D27(%rip),%r14
  mov    $0x28,%esi
  jmp    L267
L121:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D27
data_type: string

tool: D27: (null)

assistant: ```c
void wprintf(struct Window *win, const char *format, ...) {
  char **arg = (char **)&format;
  int c;
  char buf[20];
  arg++;
  while ((c = *format++) != 0) {
    if (c != '%') {
      wputchar(win, c);
    } else {
      char *p;
      int padChar = ' ';
      int padWidth = 0;
      int longArg = 0;
      c = *format++;
      if (c == '0') {
        padChar = '0';
        c = *format++;
      }
      if (c >= '0' && c <= '9') {
        do {
          padWidth = 10 * padWidth + (c - '0');
          c = *format++;
        } while (c >= '0' && c <= '9');
      }
      if (c == 'l') {
        longArg = 1;
        c = *format++;
      }
      switch (c) {
      case 'd':
      case 'u':
      case 'x':
        if (longArg) {
          itoa(buf, c, *((long *)arg++));
        } else {
          itoa(buf, c, (long)(*((int *)arg++)));
        }
        for (p = buf; *p; p++) {
          padWidth--;
        }
        while (0 < padWidth--) {
          wputchar(win, padChar);
        }
        for (p = buf; *p; p++) {
          wputchar(win, *p);
        }
        break;
      case 'c':
        wputchar(win, *((char *)arg++));
        break;
      case 's':
        p = *arg++;
        if (!p) {
          p = "(null)";
        }
        while (*p) {
          wputchar(win, *p++);
        }
        break;
      default:
        wputchar(win, *((int *)arg++));
        break;
      }
    }
  }
}
```