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

```asm
<sphere_intersect>:
  endbr64
  push   %r15
  mov    %rcx,%r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x48,%rsp
  mov    %rsi,0x8(%rsp)
  lea    0x2c(%rsp),%r13
  mov    %r9d,0x1c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
L77:
  movss  (%rbx,%rax,1),%xmm1
  subss  0x0(%rbp,%rax,1),%xmm1
  movss  %xmm1,0x0(%r13,%rax,1)
  add    $0x4,%rax
  cmp    $0xc,%rax
  jne    L77
  mov    %r15,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  movss  %xmm0,0x18(%rsp)
  call   <dot@plt>
  mov    %r15,%rsi
  mov    %r13,%rdi
  mov    %eax,%r14d
  xor    %eax,%eax
  call   <dot@plt>
  mov    %r13,%rsi
  mov    %r13,%rdi
  mov    %eax,0x14(%rsp)
  xor    %eax,%eax
  call   <dot@plt>
  movss  0x18(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  imul   0x14(%rsp),%r14d
  cvtsi2ss %eax,%xmm2
  pxor   %xmm1,%xmm1
  pxor   %xmm4,%xmm4
  mulss  %xmm0,%xmm0
  cvtsi2ss %r14d,%xmm1
  subss  %xmm0,%xmm2
  subss  %xmm2,%xmm1
  comiss %xmm1,%xmm4
  ja     L13
  mov    0x1c(%rsp),%eax
  movss  %xmm1,0x14(%rsp)
  mov    %r15,%rsi
  mov    %r13,%rdi
  test   %eax,%eax
  mov    $0x0,%eax
  jne    L25
  call   <dot@plt>
  pxor   %xmm0,%xmm0
  movss  0x14(%rsp),%xmm1
  pxor   %xmm5,%xmm5
  neg    %eax
  cvtsi2ss %eax,%xmm0
  subss  %xmm1,%xmm0
  comiss %xmm0,%xmm5
  jae    L13
L42:
  xor    %eax,%eax
  lea    0x20(%rsp),%r13
L54:
  movss  (%r15,%rax,1),%xmm1
  mulss  %xmm0,%xmm1
  addss  (%rbx,%rax,1),%xmm1
  movss  %xmm1,(%r12,%rax,1)
  subss  0x0(%rbp,%rax,1),%xmm1
  movss  %xmm1,0x0(%r13,%rax,1)
  add    $0x4,%rax
  cmp    $0xc,%rax
  jne    L54
  mov    %r15,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  movss  %xmm0,0x14(%rsp)
  call   <dot@plt>
  mov    %r13,%rsi
  mov    %r13,%rdi
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <dot@plt>
  pxor   %xmm2,%xmm2
  pxor   %xmm1,%xmm1
  movss  0x14(%rsp),%xmm0
  cvtsi2ss %ebx,%xmm2
  cvtsi2ss %eax,%xmm1
  xor    %eax,%eax
  addss  %xmm2,%xmm2
  divss  %xmm1,%xmm2
L62:
  movss  0x0(%r13,%rax,1),%xmm3
  movss  (%r15,%rax,1),%xmm1
  mov    0x8(%rsp),%rdx
  mulss  %xmm2,%xmm3
  subss  %xmm3,%xmm1
  movss  %xmm1,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    $0xc,%rax
  jne    L62
L86:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L71
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L25:
  call   <dot@plt>
  pxor   %xmm0,%xmm0
  movss  0x14(%rsp),%xmm1
  pxor   %xmm5,%xmm5
  neg    %eax
  cvtsi2ss %eax,%xmm0
  addss  %xmm1,%xmm0
  comiss %xmm0,%xmm5
  jb     L42
L13:
  movss  D8(%rip),%xmm0
  jmp    L86
L71:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D8
type: byte[4]

tool: {"D8": [0x00,0x00,0x80,0xbf]}

assistant: ```c
float sphere_intersect(float *restrict y, float *restrict r, const float *restrict s, const float *restrict d, const float *restrict c, float R, int invert) {
  int i;
  float D, n[3], t, v[3];
  for (i = 0; i < 3; ++i)
    v[i] = s[i] - c[i];
  D = ((dot(v, d)) * (dot(v, d))) - (dot(v, v) - ((R) * (R)));
  if (D < 0)
    return -1;
  if (invert)
    t = -dot(v, d) + D;
  else
    t = -dot(v, d) - D;
  if (t <= 0)
    return -1;
  for (i = 0; i < 3; ++i) {
    y[i] = s[i] + t * d[i];
    n[i] = y[i] - c[i];
  }
  float two_dot_nd_div_sq_n_mag = 2.0f * dot(n, d) / dot(n, n);
  for (i = 0; i < 3; ++i)
    r[i] = d[i] - two_dot_nd_div_sq_n_mag * n[i];
  return t;
}
```