user: Please show me the C implementation that matches the assembly code listed below:

```asm
<wind>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  call   <getline@plt>
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <skipsp@plt>
  mov    %rax,%rsi
  lea    0x30(%rsp),%rdi
  call   <strcpy@plt>
  mov    $0x0,%eax
  call   <getline@plt>
  test   %rax,%rax
  je     L32
  mov    %rax,%rdi
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x24(%rsp),%r9
  lea    0x20(%rsp),%r8
  lea    D25(%rip),%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x4,%eax
  je     L17
L32:
  lea    D39(%rip),%rdi
  mov    $0x0,%eax
  call   <fatal@plt>
L17:
  mov    $0x0,%eax
  call   <getline@plt>
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <skipsp@plt>
  movzbl (%rax),%eax
  and    $0xffffffdf,%eax
  cmp    $0x56,%al
  sete   %r13b
  movzbl %r13b,%r13d
  mov    $0x0,%eax
  call   <getline@plt>
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <skipsp@plt>
  movzbl (%rax),%eax
  and    $0xffffffdf,%eax
  cmp    $0x47,%al
  sete   %r12b
  movzbl %r12b,%r12d
  mov    $0x0,%eax
  call   <getline@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L3
  lea    0x14(%rsp),%rdx
  lea    D11(%rip),%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L62
L3:
  lea    D5(%rip),%rdi
  mov    $0x0,%eax
  call   <fatal@plt>
L62:
  mov    $0x0,%eax
  call   <getline@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L58
  lea    0x28(%rsp),%rdx
  lea    D38(%rip),%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L47
L58:
  lea    D58(%rip),%rdi
  mov    $0x0,%eax
  call   <fatal@plt>
L47:
  lea    0x8(%rsp),%rbx
  mov    %rbx,%rdx
  mov    0x18(%rsp),%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <outs@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    0x1c(%rsp),%esi
  mov    $0x0,%eax
  call   <outs@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    0x20(%rsp),%esi
  mov    $0x0,%eax
  call   <outs@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    0x24(%rsp),%esi
  mov    $0x0,%eax
  call   <outs@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    0x14(%rsp),%esi
  mov    $0x0,%eax
  call   <outs@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    %r13d,%esi
  mov    $0x0,%eax
  call   <outc@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    $0x0,%esi
  mov    $0x0,%eax
  call   <outc@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <outc@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    $0x0,%esi
  mov    $0x0,%eax
  call   <outc@plt>
  mov    %rax,%rdi
  mov    %rbx,%rdx
  mov    0x28(%rsp),%rsi
  mov    $0x0,%eax
  call   <outl@plt>
  mov    %rax,%rdi
  lea    0x30(%rsp),%rsi
  mov    $0x1,%ecx
  mov    %rbx,%rdx
  mov    $0x0,%eax
  call   <outp@plt>
  sub    %rbp,%rax
  mov    0xb8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L23
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D25
type_infered: string
name: retrieve_data
arguments: data_label: D39
type_infered: string
name: retrieve_data
arguments: data_label: D11
type_infered: string
name: retrieve_data
arguments: data_label: D5
type_infered: string
name: retrieve_data
arguments: data_label: D38
type_infered: string
name: retrieve_data
arguments: data_label: D58
type_infered: string

tool: D25: %d %d %d %d

tool: D39: bad rectangle

tool: D11: %d

tool: D5: bad proc id

tool: D38: %ld

tool: D58: bad refcon

assistant: ```c
long wind(data, maxl, rcp)
char *data;
long maxl;
struct res *rcp;
{
  int vis, goaway, pid;
  long ref;
  int r1, r2, r3, r4;
  char title[128];
  char *datap = data;
  char *lp, *getline(), *skipsp();
  char *outp(), *outs(), *outl(), *outc();
  char *strcpy();
  lp = skipsp(getline());
  strcpy(title, lp);
  if ((lp = getline()) == 0 || sscanf(lp, "%d %d %d %d", &r1, &r2, &r3, &r4) != 4)
    fatal("bad rectangle");
  lp = skipsp(getline());
  vis = (*lp == 'V' || *lp == 'v' ? 1 : 0);
  lp = skipsp(getline());
  goaway = (*lp == 'G' || *lp == 'g' ? 1 : 0);
  if ((lp = getline()) == 0 || sscanf(lp, "%d", &pid) != 1)
    fatal("bad proc id");
  if ((lp = getline()) == 0 || sscanf(lp, "%ld", &ref) != 1)
    fatal("bad refcon");
  datap = outs(datap, r1, &maxl);
  datap = outs(datap, r2, &maxl);
  datap = outs(datap, r3, &maxl);
  datap = outs(datap, r4, &maxl);
  datap = outs(datap, pid, &maxl);
  datap = outc(datap, (char)vis, &maxl);
  datap = outc(datap, (char)0, &maxl);
  datap = outc(datap, (char)goaway, &maxl);
  datap = outc(datap, (char)0, &maxl);
  datap = outl(datap, (long)ref, &maxl);
  datap = outp(datap, title, &maxl, 1);
  return (datap - data);
}
```