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

```asm
<qreval>:
  endbr64
  push   %r15
  xor    %ecx,%ecx
  push   %r14
  mov    %rsi,%r14
  lea    0x0(,%rdx,8),%esi
  push   %r13
  push   %rbp
  lea    -0x1(%rdx),%ebp
  push   %rbx
  movslq %ebp,%rbx
  sub    $0x40,%rsp
  movq   D15(%rip),%xmm4
  movsd  D79(%rip),%xmm5
L161:
  shl    $0x3,%rbx
  jmp    L69
  nopl   0x0(%rax,%rax,1)
L38:
  movsd  (%rdi,%rbx,1),%xmm3
  lea    -0x1(%rbp),%edx
  lea    -0x8(%rbx),%rax
  mov    %rdi,%r13
  movsd  -0x8(%r14,%rbx,1),%xmm2
  lea    (%rbx,%rdi,1),%r15
  movapd %xmm3,%xmm1
  andpd  %xmm4,%xmm1
  movapd %xmm2,%xmm0
  mulsd  %xmm5,%xmm1
  andpd  %xmm4,%xmm0
  comisd %xmm0,%xmm1
  jb     L90
  mov    %rax,%rbx
  mov    %edx,%ebp
L69:
  test   %ebp,%ebp
  jg     L38
  xor    %eax,%eax
L63:
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L90:
  mulsd  %xmm2,%xmm2
  add    %rdi,%rax
  pxor   %xmm7,%xmm7
  movsd  (%rax),%xmm1
  movapd %xmm1,%xmm8
  subsd  %xmm3,%xmm8
  mulsd  D2(%rip),%xmm8
  movapd %xmm8,%xmm0
  mulsd  %xmm8,%xmm0
  addsd  %xmm2,%xmm0
  ucomisd %xmm0,%xmm7
  ja     L124
  sqrtsd %xmm0,%xmm0
L8:
  cmp    $0x1,%ebp
  je     L160
  andpd  %xmm4,%xmm1
  movsd  -0x10(%r14,%rbx,1),%xmm2
  mulsd  %xmm5,%xmm1
  andpd  %xmm4,%xmm2
  comisd %xmm1,%xmm2
  ja     L172
L160:
  addsd  %xmm3,%xmm8
  sub    $0x2,%ebp
  movslq %ebp,%rbx
  movapd %xmm8,%xmm1
  subsd  %xmm0,%xmm1
  addsd  %xmm8,%xmm0
  movsd  %xmm1,(%r15)
  movsd  %xmm0,(%rax)
  jmp    L161
L172:
  cmp    %esi,%ecx
  jg     L94
  addsd  %xmm8,%xmm3
  comisd %xmm7,%xmm8
  movapd %xmm3,%xmm1
  jbe    L168
  subsd  %xmm0,%xmm1
L64:
  movsd  (%rdi),%xmm8
  movsd  D60(%rip),%xmm3
  xor    %ebx,%ebx
  movapd %xmm7,%xmm9
  subsd  %xmm1,%xmm8
  movsd  %xmm8,(%rdi)
  jmp    L88
  nopl   0x0(%rax,%rax,1)
L70:
  movsd  0x0(%r13),%xmm8
L88:
  mulsd  %xmm3,%xmm8
  movsd  (%r14,%rbx,8),%xmm2
  subsd  %xmm9,%xmm8
  movapd %xmm2,%xmm9
  mulsd  %xmm2,%xmm2
  mulsd  %xmm3,%xmm9
  movapd %xmm8,%xmm0
  mulsd  %xmm8,%xmm0
  addsd  %xmm2,%xmm0
  ucomisd %xmm0,%xmm7
  ja     L159
  sqrtsd %xmm0,%xmm0
L82:
  test   %rbx,%rbx
  je     L127
  mulsd  %xmm0,%xmm6
  movsd  %xmm6,-0x8(%r14,%rbx,8)
L127:
  mulsd  %xmm0,%xmm3
  add    $0x8,%r13
  movsd  %xmm3,-0x8(%r13)
  movsd  (%r14,%rbx,8),%xmm6
  movapd %xmm3,%xmm2
  movapd %xmm8,%xmm3
  divsd  %xmm0,%xmm3
  add    $0x1,%rbx
  divsd  %xmm0,%xmm6
  movsd  0x0(%r13),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%r13)
  mulsd  %xmm6,%xmm9
  mulsd  %xmm6,%xmm0
  addsd  %xmm9,%xmm2
  mulsd  %xmm6,%xmm0
  mulsd  %xmm3,%xmm2
  addsd  %xmm0,%xmm2
  addsd  %xmm1,%xmm2
  movsd  %xmm2,-0x8(%r13)
  cmp    %ebx,%ebp
  jg     L70
  movslq %ebp,%rbx
  test   %ebp,%ebp
  mov    $0x8,%eax
  lea    0x0(,%rbx,8),%rdx
  cmovle %rax,%rdx
  add    $0x1,%ecx
  lea    (%rdi,%rdx,1),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm3,%xmm0
  subsd  %xmm9,%xmm0
  movsd  %xmm0,(%rax)
  mulsd  %xmm6,%xmm0
  movsd  %xmm0,-0x8(%r14,%rdx,1)
  mulsd  (%rax),%xmm3
  addsd  %xmm1,%xmm3
  movsd  %xmm3,(%rax)
  jmp    L161
L168:
  addsd  %xmm0,%xmm1
  jmp    L64
L94:
  mov    $0xffffffff,%eax
  jmp    L63
L124:
  mov    %rdi,0x38(%rsp)
  mov    %esi,0x28(%rsp)
  mov    %rax,0x18(%rsp)
  mov    %ecx,0x10(%rsp)
  movsd  %xmm8,0x30(%rsp)
  movsd  %xmm1,0x20(%rsp)
  movsd  %xmm6,0x8(%rsp)
  movsd  %xmm3,(%rsp)
  call   <sqrt@plt>
  mov    D79(%rip),%rax
  mov    0x28(%rsp),%esi
  pxor   %xmm7,%xmm7
  movq   D15(%rip),%xmm4
  mov    0x38(%rsp),%rdi
  movq   %rax,%xmm5
  movsd  0x30(%rsp),%xmm8
  movsd  0x20(%rsp),%xmm1
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%ecx
  movsd  0x8(%rsp),%xmm6
  movsd  (%rsp),%xmm3
  jmp    L8
L159:
  mov    %rdi,0x38(%rsp)
  mov    %esi,0x18(%rsp)
  mov    %ecx,0x8(%rsp)
  movsd  %xmm3,0x30(%rsp)
  movsd  %xmm9,0x28(%rsp)
  movsd  %xmm8,0x20(%rsp)
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm6,(%rsp)
  call   <sqrt@plt>
  mov    D79(%rip),%rax
  mov    0x38(%rsp),%rdi
  pxor   %xmm7,%xmm7
  movq   D15(%rip),%xmm4
  movsd  0x30(%rsp),%xmm3
  movsd  0x28(%rsp),%xmm9
  mov    0x18(%rsp),%esi
  movq   %rax,%xmm5
  movsd  0x20(%rsp),%xmm8
  movsd  0x10(%rsp),%xmm1
  mov    0x8(%rsp),%ecx
  movsd  (%rsp),%xmm6
  jmp    L82
```

tool_calls: name: retrieve_data
arguments: data_tag: D15
type: qword
name: retrieve_data
arguments: data_tag: D79
type: byte[8]
name: retrieve_data
arguments: data_tag: D2
type: f32[2]
name: retrieve_data
arguments: data_tag: D60
type: f64

tool: D15: 9223372036854775807

tool: {"D79": [0x16,0x56,0xe7,0x9e,0xaf,0x03,0xd2,0x3c]}

tool: {"D2": [0.0,1.75]}

tool: D60: 1

assistant: ```c
int qreval(double *ev, double *dp, int n) {
  double cc, sc, d, x, y, h, tzr = 1.e-15;
  int j, k, m, mqr = 8 * n;
  for (j = 0, m = n - 1;; ++j) {
    while (1) {
      if (m < 1)
        return 0;
      k = m - 1;
      if (fabs(dp[k]) <= fabs(ev[m]) * tzr)
        --m;
      else {
        x = (ev[k] - ev[m]) / 2.;
        h = sqrt(x * x + dp[k] * dp[k]);
        if (m > 1 && fabs(dp[m - 2]) > fabs(ev[k]) * tzr)
          break;
        x += ev[m];
        ev[m--] = x - h;
        ev[m--] = x + h;
      }
    }
    if (j > mqr)
      return -1;
    if (x > 0.)
      d = ev[m] + x - h;
    else
      d = ev[m] + x + h;
    cc = 1.;
    y = 0.;
    ev[0] -= d;
    for (k = 0; k < m; ++k) {
      x = ev[k] * cc - y;
      y = dp[k] * cc;
      h = sqrt(x * x + dp[k] * dp[k]);
      if (k > 0)
        dp[k - 1] = sc * h;
      ev[k] = cc * h;
      cc = x / h;
      sc = dp[k] / h;
      ev[k + 1] -= d;
      y *= sc;
      ev[k] = cc * (ev[k] + y) + ev[k + 1] * sc * sc + d;
    }
    ev[k] = ev[k] * cc - y;
    dp[k - 1] = ev[k] * sc;
    ev[k] = ev[k] * cc + d;
  }
  return 0;
}
```