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

```asm
<PopCSn0>:
  endbr64
  cmp    %esi,%edi
  jge    L46
  movsd  D54(%rip),%xmm0
  ret
L46:
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %edi,%ebp
  movq   %xmm0,%r13
  movq   %xmm1,%rbx
  mov    %esi,%r12d
  pxor   %xmm7,%xmm7
  cvtsi2sd %edi,%xmm7
  movsd  %xmm7,0x8(%rsp)
  movsd  D31(%rip),%xmm1
  movapd %xmm7,%xmm0
  call   <pow@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  D70(%rip),%xmm0
  movq   %xmm0,%r14
  movq   %rbx,%xmm0
  movq   %r13,%xmm2
  divsd  %xmm2,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L71
  sqrtsd %xmm0,%xmm0
L62:
  movq   %r14,%xmm2
  divsd  %xmm0,%xmm2
  mov    D48(%rip),%rax
  movq   %rax,%xmm1
  movapd %xmm2,%xmm0
  call   <pow@plt>
  add    $0x1,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  D25(%rip),%xmm1
  call   <pow@plt>
  mov    %eax,%ecx
  mov    %ebp,%eax
  cltd
  idiv   %ecx
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,0x10(%rsp)
  divsd  0x8(%rsp),%xmm0
  mov    D48(%rip),%rax
  movq   %rax,%xmm1
  call   <pow@plt>
  mov    %eax,%edx
  mov    $0x1,%eax
  sub    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  0x10(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L52
  sqrtsd %xmm0,%xmm0
L17:
  movapd %xmm0,%xmm6
  mulsd  D34(%rip),%xmm6
  movsd  %xmm6,0x28(%rsp)
  movsd  D76(%rip),%xmm0
  divsd  %xmm6,%xmm0
  movsd  %xmm0,0x18(%rsp)
  test   %ebp,%ebp
  js     L48
  movapd %xmm6,%xmm7
  mulsd  %xmm6,%xmm7
  movsd  %xmm7,0x20(%rsp)
  add    $0x1,%ebp
  pxor   %xmm2,%xmm2
  movsd  %xmm2,0x8(%rsp)
  mov    $0x0,%ebx
L76:
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  movsd  0x10(%rsp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm0
  divsd  0x20(%rsp),%xmm0
  call   <exp@plt>
  mulsd  0x18(%rsp),%xmm0
  addsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  add    $0x1,%ebx
  cmp    %ebx,%ebp
  jne    L76
L7:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r12d,%xmm0
  movsd  0x10(%rsp),%xmm1
  subsd  %xmm0,%xmm1
  movapd %xmm1,%xmm0
  mulsd  D4(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  0x28(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  call   <exp@plt>
  mulsd  0x18(%rsp),%xmm0
  divsd  0x8(%rsp),%xmm0
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L71:
  call   <sqrt@plt>
  jmp    L62
L52:
  call   <sqrt@plt>
  jmp    L17
L48:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L7
```

tool_calls: name: retrieve_data
arguments: data_label: D54
data_type: f32[2]
name: retrieve_data
arguments: data_label: D31
data_type: f64
name: retrieve_data
arguments: data_label: D70
data_type: f64
name: retrieve_data
arguments: data_label: D48
data_type: f64
name: retrieve_data
arguments: data_label: D25
data_type: f64
name: retrieve_data
arguments: data_label: D34
data_type: f64
name: retrieve_data
arguments: data_label: D76
data_type: f64
name: retrieve_data
arguments: data_label: D4
data_type: f32[2]

tool: {"D54": [0.0,-1.875]}

tool: D31: 0.45

tool: D70: 0.26

tool: D48: 1.66666667

tool: D25: 0.6

tool: D34: 0.5

tool: D76: 0.39894228

tool: {"D4": [0.0,-1.75]}

assistant: ```c
double PopCSn0(int Z, double M, double E, int CSn) {
  int Q = 0;
  double Sum = 0, Q0 = 0, Width = 0, WP = 0;
  if (Z < CSn)
    return -1.0;
  Q0 = Z / pow(1 + pow(0.260 * pow(Z, 0.45) / sqrt(E / M), 1.66666667), 0.6);
  Width = 0.5 * sqrt(Q0 * (1 - pow(Q0 / Z, 1.66666667)));
  WP = 0.39894228 / Width;
  for (Q = 0; Q <= Z; Q++) {
    Sum += WP * exp(-0.5 * (Q0 - Q) * (Q0 - Q) / (Width * Width));
  };
  return WP * exp(-0.5 * (Q0 - CSn) * (Q0 - CSn) / (Width * Width)) / Sum;
}
```