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

```asm
<c_single_scat>:
  endbr64
  push   %r15
  movslq %edi,%r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  movq   %xmm0,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  movsd  %xmm3,0x10(%rsp)
  xorpd  D69(%rip),%xmm3
  movsd  %xmm1,(%rsp)
  movapd %xmm3,%xmm0
  movsd  %xmm2,0x8(%rsp)
  divsd  %xmm2,%xmm0
  movsd  %xmm4,0x28(%rsp)
  call   <exp@plt>
  movsd  0x8(%rsp),%xmm2
  addsd  (%rsp),%xmm2
  movq   %r12,%xmm6
  andpd  D22(%rip),%xmm2
  movapd %xmm0,%xmm1
  comisd %xmm2,%xmm6
  jae    L9
  movsd  (%rsp),%xmm7
  pxor   %xmm5,%xmm5
  comisd %xmm5,%xmm7
  jbe    L47
  cmp    %ebp,%r15d
  jg     L59
  movslq %r15d,%rax
  sub    %r15d,%ebp
  pxor   %xmm3,%xmm3
  add    %rax,%rbp
  lea    -0x8(,%rax,8),%r12
  shl    $0x3,%rbp
  nopl   0x0(%rax)
L58:
  movsd  0x8(%r13,%r12,1),%xmm2
  movsd  %xmm3,0x20(%rsp)
  movsd  %xmm1,0x18(%rsp)
  movapd %xmm2,%xmm0
  divsd  0x8(%rsp),%xmm2
  subsd  0x10(%rsp),%xmm0
  divsd  (%rsp),%xmm0
  addsd  %xmm2,%xmm0
  xorpd  D69(%rip),%xmm0
  call   <exp@plt>
  movsd  0x18(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm3
  movapd %xmm0,%xmm1
  movsd  (%r14,%r12,1),%xmm0
  mulsd  (%rbx,%r12,1),%xmm0
  subsd  %xmm1,%xmm4
  add    $0x8,%r12
  mulsd  %xmm4,%xmm0
  addsd  %xmm0,%xmm3
  cmp    %r12,%rbp
  jne    L58
L46:
  movsd  (%rsp),%xmm1
  divsd  0x8(%rsp),%xmm1
  addsd  D66(%rip),%xmm1
  mulsd  D53(%rip),%xmm1
  movsd  0x28(%rsp),%xmm0
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  divsd  %xmm1,%xmm0
  mulsd  %xmm3,%xmm0
  ret
  nopw   0x0(%rax,%rax,1)
L47:
  movslq %r15d,%rbp
  pxor   %xmm3,%xmm3
  test   %r15d,%r15d
  jle    L46
  nopl   0x0(%rax)
L44:
  movsd  -0x8(%r13,%rbp,8),%xmm2
  movq   %xmm1,%r12
  movsd  %xmm3,0x18(%rsp)
  movapd %xmm2,%xmm0
  divsd  0x8(%rsp),%xmm2
  subsd  0x10(%rsp),%xmm0
  divsd  (%rsp),%xmm0
  addsd  %xmm2,%xmm0
  xorpd  D69(%rip),%xmm0
  call   <exp@plt>
  movq   %r12,%xmm2
  movsd  0x18(%rsp),%xmm3
  movapd %xmm0,%xmm1
  movsd  -0x8(%r14,%rbp,8),%xmm0
  mulsd  -0x8(%rbx,%rbp,8),%xmm0
  subsd  %xmm1,%xmm2
  sub    $0x1,%rbp
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm3
  test   %ebp,%ebp
  jg     L44
  jmp    L46
  nopl   (%rax)
L9:
  cmp    $0x1,%r15d
  jle    L17
  lea    -0x1(%r15),%edx
  xor    %eax,%eax
  pxor   %xmm3,%xmm3
  nopl   0x0(%rax)
L42:
  movsd  (%r14,%rax,8),%xmm0
  mulsd  (%rbx,%rax,8),%xmm0
  movsd  0x8(%r13,%rax,8),%xmm2
  subsd  0x0(%r13,%rax,8),%xmm2
  add    $0x1,%rax
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm3
  cmp    %rax,%rdx
  jne    L42
L86:
  shl    $0x3,%r15
  movsd  0x10(%rsp),%xmm0
  movsd  -0x8(%r14,%r15,1),%xmm2
  mulsd  -0x8(%rbx,%r15,1),%xmm2
  subsd  -0x8(%r13,%r15,1),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  0x28(%rsp),%xmm0
  addsd  %xmm3,%xmm2
  movsd  0x8(%rsp),%xmm3
  mulsd  D53(%rip),%xmm3
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  divsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  ret
L59:
  pxor   %xmm3,%xmm3
  jmp    L46
  nopl   0x0(%rax)
L17:
  pxor   %xmm3,%xmm3
  jmp    L86
```

tool_calls: name: read_data
arguments: data_tag: D69
type: f32[4]
name: read_data
arguments: data_tag: D22
type: qword[2]
name: read_data
arguments: data_tag: D66
type: f64
name: read_data
arguments: data_tag: D53
type: byte[8]

tool: {"D69": [0.0,-0.0,0.0,0.0]}

tool: {"D22": [0x7fffffffffffffff,0x0000000000000000]}

tool: D66: 1

tool: {"D53": [0x18,0x2d,0x44,0x54,0xfb,0x21,0x29,0x40]}

assistant: ```c
double c_single_scat(double dither, int layru, int nlyr, double *phase, double *omega, double *tau, double umu, double umu0, double utau, double fbeam) {
  register int lyr;
  double ans, exp0, exp1;
  ans = 0.;
  exp0 = exp(-utau / umu0);
  if (fabs(umu + umu0) <= dither) {
    for (lyr = 1; lyr <= layru - 1; lyr++) {
      ans += omega[lyr - 1] * phase[lyr - 1] * (tau[lyr] - tau[lyr - 1]);
    }
    ans = fbeam / (4. * 3.14159265358979323846 * umu0) * exp0 * (ans + omega[layru - 1] * phase[layru - 1] * (utau - tau[layru - 1]));
    return ans;
  }
  if (umu > 0.) {
    for (lyr = layru; lyr <= nlyr; lyr++) {
      exp1 = exp(-((tau[lyr] - utau) / umu + tau[lyr] / umu0));
      ans += omega[lyr - 1] * phase[lyr - 1] * (exp0 - exp1);
      exp0 = exp1;
    }
  } else {
    for (lyr = layru; lyr >= 1; lyr--) {
      exp1 = exp(-((tau[lyr - 1] - utau) / umu + tau[lyr - 1] / umu0));
      ans += omega[lyr - 1] * phase[lyr - 1] * (exp0 - exp1);
      exp0 = exp1;
    }
  }
  ans *= fbeam / (4. * 3.14159265358979323846 * (1. + umu / umu0));
  return ans;
}
```