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

```asm
<qreval>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r15
  lea    0x0(,%rdx,8),%eax
  mov    %eax,0x3c(%rsp)
  lea    -0x1(%rdx),%ebp
  movl   $0x0,0x38(%rsp)
L107:
  movslq %ebp,%rbx
  shl    $0x3,%rbx
  jmp    L119
L22:
  mov    %r14,%rbx
  mov    %eax,%ebp
L119:
  test   %ebp,%ebp
  jle    L126
  lea    -0x1(%rbp),%eax
  lea    -0x8(%rbx),%r14
  movsd  -0x8(%r15,%rbx,1),%xmm1
  mov    %r12,0x8(%rsp)
  lea    (%rbx,%r12,1),%r13
  movsd  (%r12,%rbx,1),%xmm3
  movsd  %xmm3,0x10(%rsp)
  movapd %xmm1,%xmm2
  andpd  D17(%rip),%xmm2
  andpd  D17(%rip),%xmm3
  movapd %xmm3,%xmm0
  mulsd  D79(%rip),%xmm0
  comisd %xmm2,%xmm0
  jae    L22
  add    %r12,%r14
  movsd  (%r14),%xmm7
  movsd  %xmm7,0x20(%rsp)
  movapd %xmm7,%xmm0
  subsd  0x10(%rsp),%xmm0
  mulsd  D26(%rip),%xmm0
  movsd  %xmm0,0x18(%rsp)
  mulsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L130
  sqrtsd %xmm0,%xmm0
L150:
  cmp    $0x1,%ebp
  jle    L108
  movsd  -0x10(%r15,%rbx,1),%xmm2
  andpd  D17(%rip),%xmm2
  movsd  0x20(%rsp),%xmm1
  andpd  D17(%rip),%xmm1
  mulsd  D79(%rip),%xmm1
  comisd %xmm1,%xmm2
  ja     L146
L108:
  movsd  0x10(%rsp),%xmm1
  addsd  0x18(%rsp),%xmm1
  movapd %xmm1,%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,0x0(%r13)
  sub    $0x2,%ebp
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r14)
  jmp    L107
L130:
  call   <sqrt@plt>
  jmp    L150
L146:
  mov    0x3c(%rsp),%ecx
  cmp    %ecx,0x38(%rsp)
  jg     L85
  movsd  0x18(%rsp),%xmm4
  comisd D15(%rip),%xmm4
  jbe    L51
  movsd  0x10(%rsp),%xmm1
  addsd  %xmm4,%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,0x30(%rsp)
L99:
  movsd  (%r12),%xmm0
  subsd  0x30(%rsp),%xmm0
  movsd  %xmm0,(%r12)
  mov    %ebp,%r14d
  mov    $0x0,%ebx
  pxor   %xmm2,%xmm2
  movsd  D50(%rip),%xmm6
  movsd  %xmm6,0x10(%rsp)
  jmp    L148
L51:
  movsd  0x10(%rsp),%xmm1
  addsd  0x18(%rsp),%xmm1
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x30(%rsp)
  jmp    L99
L187:
  call   <sqrt@plt>
  jmp    L142
L166:
  movsd  0x10(%rsp),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%r13)
  movsd  0x18(%rsp),%xmm6
  divsd  %xmm0,%xmm6
  movsd  %xmm6,0x10(%rsp)
  movsd  (%r15,%rbx,8),%xmm2
  movapd %xmm2,%xmm5
  divsd  %xmm0,%xmm5
  movsd  %xmm5,0x28(%rsp)
  movsd  0x8(%r13),%xmm0
  movsd  0x30(%rsp),%xmm7
  subsd  %xmm7,%xmm0
  movsd  %xmm0,0x8(%r13)
  movsd  0x20(%rsp),%xmm2
  mulsd  %xmm5,%xmm2
  addsd  %xmm2,%xmm1
  mulsd  %xmm6,%xmm1
  mulsd  %xmm5,%xmm0
  mulsd  %xmm5,%xmm0
  addsd  %xmm0,%xmm1
  addsd  %xmm7,%xmm1
  movsd  %xmm1,0x0(%r13)
  add    $0x1,%rbx
  addq   $0x8,0x8(%rsp)
  cmp    %r14,%rbx
  je     L181
L148:
  mov    0x8(%rsp),%rax
  mov    %rax,%r13
  movsd  0x10(%rsp),%xmm6
  movapd %xmm6,%xmm0
  mulsd  (%rax),%xmm0
  movapd %xmm0,%xmm4
  subsd  %xmm2,%xmm4
  movsd  %xmm4,0x18(%rsp)
  movsd  (%r15,%rbx,8),%xmm1
  mulsd  %xmm1,%xmm6
  movsd  %xmm6,0x20(%rsp)
  movapd %xmm4,%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm4,%xmm4
  ucomisd %xmm0,%xmm4
  ja     L187
  sqrtsd %xmm0,%xmm0
L142:
  test   %ebx,%ebx
  jle    L166
  movsd  0x28(%rsp),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,-0x8(%r15,%rbx,8)
  jmp    L166
L181:
  movslq %ebp,%rdx
  shl    $0x3,%rdx
  lea    (%r12,%rdx,1),%rax
  movapd %xmm6,%xmm4
  movapd %xmm6,%xmm0
  mulsd  (%rax),%xmm0
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
  mulsd  %xmm5,%xmm0
  movsd  %xmm0,-0x8(%r15,%rdx,1)
  mulsd  (%rax),%xmm4
  movapd %xmm4,%xmm0
  addsd  %xmm7,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,0x38(%rsp)
  jmp    L107
L126:
  mov    $0x0,%eax
L56:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L85:
  mov    $0xffffffff,%eax
  jmp    L56
```

tool_calls: name: unpack_data
arguments: label: D17
type_guessed: qword[2]
name: unpack_data
arguments: label: D79
type_guessed: byte[8]
name: unpack_data
arguments: label: D26
type_guessed: f32[2]
name: unpack_data
arguments: label: D15
type_guessed: f32
name: unpack_data
arguments: label: D50
type_guessed: f64

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

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

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

tool: D15: 0

tool: D50: 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;
}
```