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

```asm
<FixCollision>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %esi,0x24(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  shl    $0x4,%ecx
  lea    (%rcx,%rdx,1),%eax
  cmp    %eax,%edx
  jge    L125
  movslq %edx,%rdx
  lea    (%rdi,%rdx,1),%r12
  lea    -0x1(%rcx),%eax
  shr    $0x4,%eax
  mov    %eax,%eax
  shl    $0x4,%rax
  lea    0x10(%rdi,%rdx,1),%rdx
  add    %rdx,%rax
  mov    %rax,0x28(%rsp)
  jmp    L95
L99:
  movss  (%rbx),%xmm0
  divss  0xc(%rsp),%xmm0
  movss  %xmm0,(%rbx)
L157:
  movss  D27(%rip),%xmm0
  mulss  (%rbx),%xmm0
  call   <sqrt@plt>
  movss  %xmm0,(%rbx)
  cmpl   $0x0,0x0(%r13)
  js     L35
L130:
  add    $0x4,%rbx
  add    $0x4,%r13
  cmp    %rbx,%r15
  je     L155
L67:
  movss  0xc(%rsp),%xmm3
  pxor   %xmm4,%xmm4
  ucomiss %xmm4,%xmm3
  jp     L99
  je     L157
  jmp    L99
L35:
  xorps  D10(%rip),%xmm0
  movss  %xmm0,(%rbx)
  jmp    L130
L155:
  pxor   %xmm0,%xmm0
  cvtsi2ssl 0x10(%rsp),%xmm0
  mulss  0x6c(%rsp),%xmm0
  movss  D7(%rip),%xmm2
  divss  %xmm2,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl 0x14(%rsp),%xmm1
  mulss  0x70(%rsp),%xmm1
  divss  %xmm2,%xmm1
  addss  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl 0x20(%rsp),%xmm1
  mulss  0x74(%rsp),%xmm1
  divss  %xmm2,%xmm1
  addss  %xmm1,%xmm0
  cvttss2si %xmm0,%edx
  mov    %edx,%ecx
  neg    %ecx
  mov    $0x10000,%eax
  sub    %edx,%eax
  test   %edx,%edx
  cmovle %ecx,%eax
  movzbl %ah,%ecx
  mov    %cl,0xe(%r14)
  mov    %al,0xf(%r14)
  mov    $0x0,%eax
  jmp    L111
L79:
  add    $0x10000,%edx
  mov    %edx,0x0(%rbp)
L32:
  movzwl 0x0(%rbp),%edx
  mov    %edx,0x0(%rbp)
  movzbl %dh,%ebx
  mov    %bl,0x8(%r14,%rax,1)
  mov    %dl,0x9(%r14,%rax,1)
  add    $0x4,%rbp
  add    $0x2,%rax
  cmp    $0x6,%rax
  je     L143
L111:
  cvttss2si 0x6c(%rsp,%rax,2),%edx
  test   %edx,%edx
  js     L79
  mov    %edx,0x0(%rbp)
  jmp    L32
L143:
  add    $0x10,%r12
  cmp    0x28(%rsp),%r12
  je     L125
L95:
  mov    %r12,%r14
  movzbl 0x2(%r12),%eax
  shl    $0x8,%eax
  movzbl 0x3(%r12),%edx
  or     %edx,%eax
  lea    (%rax,%rax,2),%eax
  mov    0x24(%rsp),%ebx
  lea    (%rbx,%rax,2),%edi
  movzbl 0x4(%r12),%eax
  shl    $0x8,%eax
  movzbl 0x5(%r12),%edx
  or     %edx,%eax
  lea    (%rax,%rax,2),%eax
  lea    (%rbx,%rax,2),%esi
  movzbl 0x6(%r12),%eax
  shl    $0x8,%eax
  movzbl 0x7(%r12),%edx
  or     %edx,%eax
  lea    (%rax,%rax,2),%eax
  lea    (%rbx,%rax,2),%ecx
  mov    $0x0,%eax
  movslq %edi,%rdi
  mov    0x18(%rsp),%rbx
  add    %rbx,%rdi
  movslq %esi,%rsi
  add    %rbx,%rsi
  movslq %ecx,%rcx
  add    %rbx,%rcx
L78:
  movzbl (%rdi,%rax,1),%r8d
  shl    $0x8,%r8d
  movzbl 0x1(%rdi,%rax,1),%edx
  or     %r8d,%edx
  movswl %dx,%edx
  mov    %edx,0x3c(%rsp,%rax,2)
  movzbl (%rsi,%rax,1),%r8d
  shl    $0x8,%r8d
  movzbl 0x1(%rsi,%rax,1),%edx
  or     %r8d,%edx
  movswl %dx,%edx
  mov    %edx,0x48(%rsp,%rax,2)
  movzbl (%rcx,%rax,1),%r8d
  shl    $0x8,%r8d
  movzbl 0x1(%rcx,%rax,1),%edx
  or     %r8d,%edx
  movswl %dx,%edx
  mov    %edx,0x54(%rsp,%rax,2)
  add    $0x2,%rax
  cmp    $0x6,%rax
  jne    L78
  mov    0x3c(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x48(%rsp),%ecx
  sub    %ecx,%eax
  sub    0x54(%rsp),%ecx
  mov    0x40(%rsp),%edi
  mov    %edi,0x14(%rsp)
  mov    0x4c(%rsp),%r8d
  mov    %edi,%r9d
  sub    %r8d,%r9d
  sub    0x58(%rsp),%r8d
  mov    0x44(%rsp),%esi
  mov    %esi,%edx
  mov    %esi,0x20(%rsp)
  mov    0x50(%rsp),%esi
  sub    %esi,%edx
  sub    0x5c(%rsp),%esi
  mov    %r9d,%edi
  imul   %esi,%edi
  mov    %r8d,%r10d
  imul   %edx,%r10d
  sub    %r10d,%edi
  mov    %edi,0x60(%rsp)
  imul   %ecx,%edx
  imul   %eax,%esi
  sub    %esi,%edx
  mov    %edx,0x64(%rsp)
  imul   %r8d,%eax
  imul   %r9d,%ecx
  sub    %ecx,%eax
  mov    %eax,0x68(%rsp)
  pxor   %xmm0,%xmm0
  cvtsi2ss %edi,%xmm0
  mulss  %xmm0,%xmm0
  movss  %xmm0,0x6c(%rsp)
  pxor   %xmm1,%xmm1
  cvtsi2ss %edx,%xmm1
  movaps %xmm1,%xmm2
  mulss  %xmm1,%xmm2
  movss  %xmm2,0x70(%rsp)
  pxor   %xmm1,%xmm1
  cvtsi2ss %eax,%xmm1
  mulss  %xmm1,%xmm1
  movss  %xmm1,0x74(%rsp)
  addss  %xmm2,%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,0xc(%rsp)
  lea    0x6c(%rsp),%rbx
  lea    0x60(%rsp),%rbp
  lea    0x78(%rsp),%r15
  mov    %rbp,%r13
  jmp    L67
L125:
  mov    0x78(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L76
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L76:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D27
datatype: byte[4]
name: extract_symbolic_data
arguments: data_tag: D10
datatype: byte[16]
name: extract_symbolic_data
arguments: data_tag: D7
datatype: byte[4]

tool: {"D27": [0x00,0xfc,0x7f,0x4e]}

tool: {"D10": [0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D7": [0x00,0xfe,0xff,0x46]}

assistant: ```c
void FixCollision(unsigned char *data, int vertOff, int TriOff, int TriCount) {
  int i, pos, end = TriOff + (TriCount << 4);
  int v1, v2, v3, p1[3], p2[3], p3[3], dx[2], dy[2], dz[2], dn, ni[3];
  float nf[3], nd;
  for (pos = TriOff; pos < end; pos += 0x10) {
    v1 = (((data)[pos + 2] << 8) | ((data)[pos + 2 + 1]));
    v2 = (((data)[pos + 4] << 8) | ((data)[pos + 4 + 1]));
    v3 = (((data)[pos + 6] << 8) | ((data)[pos + 6 + 1]));
    for (i = 0; i < 3; i++) {
      p1[i] = (signed short)(((data)[vertOff + (v1 * 0x6) + (i << 1)] << 8) | ((data)[vertOff + (v1 * 0x6) + (i << 1) + 1]));
      p2[i] = (signed short)(((data)[vertOff + (v2 * 0x6) + (i << 1)] << 8) | ((data)[vertOff + (v2 * 0x6) + (i << 1) + 1]));
      p3[i] = (signed short)(((data)[vertOff + (v3 * 0x6) + (i << 1)] << 8) | ((data)[vertOff + (v3 * 0x6) + (i << 1) + 1]));
    }
    dx[0] = p1[0] - p2[0];
    dx[1] = p2[0] - p3[0];
    dy[0] = p1[1] - p2[1];
    dy[1] = p2[1] - p3[1];
    dz[0] = p1[2] - p2[2];
    dz[1] = p2[2] - p3[2];
    ni[0] = (dy[0] * dz[1]) - (dz[0] * dy[1]);
    ni[1] = (dz[0] * dx[1]) - (dx[0] * dz[1]);
    ni[2] = (dx[0] * dy[1]) - (dy[0] * dx[1]);
    for (i = 0; i < 3; i++)
      nf[i] = (float)ni[i] * ni[i];
    nd = nf[0] + nf[1] + nf[2];
    for (i = 0; i < 3; i++) {
      if (nd)
        nf[i] /= nd;
      nf[i] *= 0x3FFF0001;
      nf[i] = sqrt(nf[i]);
      if (ni[i] < 0)
        nf[i] *= -1;
    }
    dn = (int)((nf[0] * p1[0] / 0x7FFF) + (nf[1] * p1[1] / 0x7FFF) + (nf[2] * p1[2] / 0x7FFF)) * -1;
    if (dn < 0)
      dn += 0x10000;
    data[pos + 0xE] = (dn >> 8) & 0xFF;
    data[pos + 0xF] = dn & 0xFF;
    dn &= 0xFFFF;
    for (i = 0; i < 3; i++) {
      ni[i] = (int)nf[i];
      if (ni[i] < 0)
        ni[i] += 0x10000;
      ni[i] &= 0xFFFF;
      data[pos + 8 + (i << 1)] = (ni[i] >> 8) & 0xFF;
      data[pos + 9 + (i << 1)] = ni[i] & 0xFF;
    }
  }
}
```