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

```asm
<s16_encode>:
  endbr64
  push   %r15
  mov    $0xe0,%ecx
  mov    %rsi,%r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x778,%rsp
  movdqa D7(%rip),%xmm0
  mov    (%rbx),%r11
  mov    %rdi,0x10(%rsp)
  lea    0x60(%rsp),%rdi
  lea    0x60(%rsp),%r10
  mov    (%r15),%rbx
  mov    %rsi,0x18(%rsp)
  lea    D43(%rip),%rsi
  lea    0x20(%rsp),%r14
  mov    %r10,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x768(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x20(%rsp)
  movdqa D12(%rip),%xmm0
  rep movsq %ds:(%rsi),%es:(%rdi)
  movaps %xmm0,0x30(%rsp)
  movdqa D44(%rip),%xmm0
  movaps %xmm0,0x40(%rsp)
  movdqa D0(%rip),%xmm0
  movaps %xmm0,0x50(%rsp)
  nopl   0x0(%rax)
L28:
  mov    (%r14),%ebp
  mov    %r12d,(%r11)
  cmp    %ebp,%r13d
  cmovbe %r13,%rbp
  test   %ebp,%ebp
  je     L9
  lea    -0x1(%rbp),%r9d
  mov    %ebp,0xc(%rsp)
  mov    %r12d,%r8d
  mov    $0x1,%eax
  add    $0x2,%r9
  xor    %edi,%edi
  jmp    L26
  nopl   (%rax)
L76:
  mov    %edi,%ecx
  add    %esi,%edi
  shl    %cl,%edx
  add    %edx,%r8d
  mov    %eax,%edx
  add    $0x1,%rax
  mov    %r8d,(%r11)
  cmp    %rax,%r9
  je     L70
L26:
  mov    -0x4(%rbx,%rax,4),%edx
  mov    -0x4(%r10,%rax,4),%esi
  mov    %edx,%ebp
  mov    %esi,%ecx
  shr    %cl,%ebp
  test   %ebp,%ebp
  je     L76
L66:
  add    $0x4,%r14
  add    $0x10000000,%r12d
  add    $0x70,%r10
  cmp    %r15,%r14
  jne    L28
L29:
  mov    0x768(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  add    $0x778,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L70:
  mov    0xc(%rsp),%ebp
  cmp    %ebp,%edx
  jne    L66
L9:
  lea    (%rbx,%rbp,4),%rax
  mov    0x18(%rsp),%rbx
  mov    %rax,(%rbx)
  mov    0x10(%rsp),%rax
  addq   $0x4,(%rax)
  jmp    L29
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D7
datatype: byte[16]
name: parse_data
arguments: data_tag: D43
datatype: string
name: parse_data
arguments: data_tag: D12
datatype: byte[16]
name: parse_data
arguments: data_tag: D44
datatype: byte[16]
name: parse_data
arguments: data_tag: D0
datatype: byte[16]

tool: {"D7": [0x1c,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x15,0x00,0x00,0x00]}

tool: D43: 

tool: {"D12": [0x0e,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00]}

tool: {"D44": [0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x05,0x00,0x00,0x00]}

tool: {"D0": [0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

assistant: ```c
void s16_encode(unsigned int **_w, unsigned int **_p, unsigned int m) {
  int cnum[16] = {28, 21, 21, 21, 14, 9, 8, 7, 6, 6, 5, 5, 4, 3, 2, 1};
  int cbits[16][28] = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0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 0, 0}, {14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
  unsigned int _k, _j, _m, _o;
  for (_k = 0; _k < 16; _k++) {
    (**_w) = _k << 28;
    _m = (cnum[_k] < m) ? cnum[_k] : m;
    for (_j = 0, _o = 0; (_j < _m) && (*((*_p) + _j) < (1 << cbits[_k][_j]));) {
      (**_w) += ((*((*_p) + _j)) << _o);
      _o += cbits[_k][_j];
      _j++;
    }
    if (_j == _m) {
      (*_p) += _m;
      (*_w)++;
      break;
    }
  }
}
```