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

```asm
<calc_comoving_distance>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  movsd  %xmm0,-0x28(%rbp)
  movsd  %xmm1,-0x30(%rbp)
  movsd  %xmm2,-0x38(%rbp)
  movsd  %xmm3,-0x40(%rbp)
  movl   $0x0,-0x14(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x28(%rbp),%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movsd  D97(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <pow@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x38(%rbp),%xmm1
  movsd  -0x28(%rbp),%xmm2
  movsd  D19(%rip),%xmm0
  addsd  %xmm0,%xmm2
  movsd  -0x28(%rbp),%xmm3
  movsd  D19(%rip),%xmm0
  addsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  movsd  D19(%rip),%xmm0
  subsd  -0x38(%rbp),%xmm0
  subsd  -0x40(%rbp),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  addsd  -0x40(%rbp),%xmm0
  movq   %xmm0,%rax
  movsd  D106(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <pow@plt>
  movq   %xmm0,%rax
  movsd  D122(%rip),%xmm0
  movq   %rax,%xmm1
  divsd  %xmm0,%xmm1
  movsd  D127(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x30(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  jmp    L9
L17:
  movsd  -0x10(%rbp),%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movsd  D97(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <pow@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x38(%rbp),%xmm1
  movsd  -0x10(%rbp),%xmm2
  movsd  D19(%rip),%xmm0
  addsd  %xmm0,%xmm2
  movsd  -0x10(%rbp),%xmm3
  movsd  D19(%rip),%xmm0
  addsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  movsd  D19(%rip),%xmm0
  subsd  -0x38(%rbp),%xmm0
  subsd  -0x40(%rbp),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  addsd  -0x40(%rbp),%xmm0
  movq   %xmm0,%rax
  movsd  D106(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <pow@plt>
  movsd  -0x8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x10(%rbp),%xmm0
  addsd  -0x30(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  addl   $0x1,-0x14(%rbp)
L9:
  movsd  -0x30(%rbp),%xmm1
  movsd  D151(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  -0x28(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  comisd -0x10(%rbp),%xmm0
  ja     L17
  movsd  -0x8(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x30(%rbp),%xmm1
  movsd  D124(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D19
type_guessed: f32[2]
name: parse_data
arguments: label: D97
type_guessed: f32[2]
name: parse_data
arguments: label: D106
type_guessed: f32[2]
name: parse_data
arguments: label: D122
type_guessed: f64
name: parse_data
arguments: label: D127
type_guessed: f64
name: parse_data
arguments: label: D151
type_guessed: f64
name: parse_data
arguments: label: D124
type_guessed: f64

tool: {"D19": [0.0,1.875]}

tool: {"D97": [0.0,2.125]}

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

tool: D122: 2

tool: D127: 0.5

tool: D151: 0.1

tool: D124: 2997.92458

assistant: ```c
double calc_comoving_distance(double red, double dz, double Om, double OL) {
  int i = 0;
  double z, result = 0.0;
  result = pow(Om * pow(red + 1, 3) + (red + 1) * (red + 1) * (1 - Om - OL) + OL, -0.5) / 2.0 + 0.5;
  for (z = dz; z < red - dz * 0.1; z += dz, i++)
    result += pow(Om * pow(z + 1, 3) + (z + 1) * (z + 1) * (1 - Om - OL) + OL, -0.5);
  return result * dz * 2997.92458;
}
```