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

```asm
<qrupdate>:
  endbr64
  push   %r15
  pxor   %xmm2,%xmm2
  mov    %rdx,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  lea    -0x1(%rsi),%ebp
  push   %rbx
  movslq %ebp,%rax
  sub    $0x28,%rsp
  ucomisd (%rdx,%rax,8),%xmm2
  mov    $0x0,%edx
  mov    %rcx,0x10(%rsp)
  lea    0x0(,%rax,8),%rcx
  mov    %rcx,0x18(%rsp)
  setnp  %al
  cmovne %edx,%eax
  test   %al,%al
  je     L122
  test   %ebp,%ebp
  jle    L122
  lea    -0x2(%rsi),%eax
  xor    %edi,%edi
  cltq
  cs nopw 0x0(%rax,%rax,1)
L49:
  ucomisd (%r15,%rax,8),%xmm2
  mov    %eax,%ebp
  setnp  %dl
  cmovne %edi,%edx
  test   %eax,%eax
  setg   %cl
  sub    $0x1,%rax
  test   %cl,%dl
  jne    L49
L122:
  mov    %ebp,%r13d
  sub    $0x1,%r13d
  js     L85
  movq   D27(%rip),%xmm5
  movslq %ebp,%rax
  lea    (%r15,%rax,8),%rbx
  movaps %xmm5,(%rsp)
  jmp    L97
  nopl   (%rax)
L146:
  movsd  (%rbx),%xmm0
  andpd  D7(%rip),%xmm0
L103:
  sub    $0x1,%r13d
  movsd  %xmm0,-0x8(%rbx)
  sub    $0x8,%rbx
  cmp    $0xffffffff,%r13d
  je     L85
L97:
  movsd  (%rbx),%xmm1
  movsd  -0x8(%rbx),%xmm0
  mov    %r13d,%edx
  mov    %r12d,%esi
  xorpd  (%rsp),%xmm1
  mov    %r14,%rdi
  call   <jrotate@plt>
  movsd  -0x8(%rbx),%xmm0
  pxor   %xmm2,%xmm2
  ucomisd %xmm2,%xmm0
  jp     L121
  je     L146
L121:
  movsd  (%rbx),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm2
  ja     L109
  sqrtsd %xmm0,%xmm0
  jmp    L103
  nopl   0x0(%rax)
L85:
  test   %r12d,%r12d
  jle    L147
  movslq %r12d,%rdx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L108:
  mov    0x10(%rsp),%rsi
  movsd  (%r15),%xmm0
  mulsd  (%rsi,%rax,8),%xmm0
  addsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,(%r14,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L108
L147:
  test   %ebp,%ebp
  jle    L12
  mov    0x18(%rsp),%rax
  movslq %r12d,%r15
  mov    %r12d,%r13d
  xor    %ebx,%ebx
  movq   D27(%rip),%xmm6
  neg    %r15
  lea    0x10(%rax),%rcx
  lea    0x8(%r14,%rax,1),%rbp
  shl    $0x3,%r15
  mov    %rcx,0x10(%rsp)
  movaps %xmm6,(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L76:
  movsd  0x0(%rbp),%xmm1
  xorpd  (%rsp),%xmm1
  mov    %ebx,%edx
  mov    %r12d,%esi
  movsd  0x0(%rbp,%r15,1),%xmm0
  mov    %r14,%rdi
  add    $0x1,%ebx
  call   <jrotate@plt>
  mov    %r13d,%eax
  add    0x10(%rsp),%rbp
  add    %r12d,%r13d
  cmp    %eax,%ebx
  jl     L76
L12:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L109:
  call   <sqrt@plt>
  jmp    L103
```

tool_calls: name: retrieve_data
arguments: data_label: D27
datatype: byte[8]
name: retrieve_data
arguments: data_label: D7
datatype: qword[2]

tool: {"D27": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

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

assistant: ```c
void qrupdate(double *R, int N, double *u, double *v) {
  int i, j, k;
  k = N - 1;
  while (u[k] == 0 && k > 0) {
    k--;
  }
  for (i = k - 1; i >= 0; --i) {
    jrotate(R, N, u[i], -u[i + 1], i);
    if (u[i] == 0) {
      u[i] = fabs(u[i + 1]);
    } else {
      u[i] = sqrt(u[i] * u[i] + u[i + 1] * u[i + 1]);
    }
  }
  for (i = 0; i < N; ++i) {
    R[i] += u[0] * v[i];
  }
  for (i = 0; i <= k - 1; ++i) {
    j = i * N;
    k = j + N;
    jrotate(R, N, R[j + i], -R[k + i], i);
  }
}
```