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

```asm
<ep21R>:
  endbr64
  imul   %r8d,%r9d
  test   %r8d,%r8d
  jle    L152
  push   %r15
  pxor   %xmm2,%xmm2
  xor    %r15d,%r15d
  push   %r13
  mov    %rdx,%r13
  push   %rbp
  push   %rbx
  movslq %r8d,%rbx
  sub    $0x28,%rsp
  movq   D39(%rip),%xmm3
  movsd  D2(%rip),%xmm4
  nopl   0x0(%rax,%rax,1)
L180:
  mov    %r15d,%ebp
  mov    %r15,%rax
  movapd %xmm2,%xmm0
  cmp    %r9d,%r15d
  jge    L128
  nopl   0x0(%rax,%rax,1)
L41:
  movsd  0x0(%r13,%rax,8),%xmm1
  add    %rbx,%rax
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %eax,%r9d
  jg     L41
  ucomisd %xmm0,%xmm2
  ja     L63
  movsd  (%rcx,%r15,8),%xmm1
  sqrtsd %xmm0,%xmm0
  movapd %xmm1,%xmm6
  andpd  %xmm3,%xmm6
  comisd %xmm6,%xmm0
  ja     L105
L31:
  comisd %xmm0,%xmm1
  jb     L154
  movsd  %xmm1,(%rsi,%r15,8)
  cmp    %r9d,%ebp
  jge    L171
L129:
  mov    %r15,%rax
  nopl   (%rax)
L11:
  movsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    %rbx,%rax
  cmp    %eax,%r9d
  jg     L11
L171:
  add    $0x1,%r15
  cmp    %rbx,%r15
  jne    L180
L61:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r13
  pop    %r15
  ret
  nopl   0x0(%rax)
L154:
  movq   $0x0,(%rsi,%r15,8)
  cmp    %r9d,%ebp
  jge    L171
  mov    %r15,%rax
  nopl   0x0(%rax,%rax,1)
L166:
  movq   $0x0,(%rdi,%rax,8)
  add    %rbx,%rax
  cmp    %eax,%r9d
  jg     L166
  add    $0x1,%r15
  cmp    %rbx,%r15
  jne    L180
  jmp    L61
  nop
L105:
  addsd  %xmm0,%xmm1
  mov    %r15,%rax
  mulsd  %xmm4,%xmm1
  movsd  %xmm1,(%rsi,%r15,8)
  jmp    L153
  nopl   0x0(%rax,%rax,1)
L20:
  movsd  (%rsi,%r15,8),%xmm1
L153:
  divsd  %xmm0,%xmm1
  mulsd  0x0(%r13,%rax,8),%xmm1
  movsd  %xmm1,(%rdi,%rax,8)
  add    %rbx,%rax
  cmp    %eax,%r9d
  jg     L20
  add    $0x1,%r15
  cmp    %rbx,%r15
  jne    L180
  jmp    L61
  nopl   0x0(%rax,%rax,1)
L128:
  movsd  (%rcx,%r15,8),%xmm1
  jmp    L31
L152:
  ret
L63:
  mov    %rcx,0x18(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %rdi,0x8(%rsp)
  mov    %r9d,0x4(%rsp)
  call   <sqrt@plt>
  mov    0x18(%rsp),%rcx
  mov    0x4(%rsp),%r9d
  pxor   %xmm2,%xmm2
  movq   D39(%rip),%xmm5
  mov    D2(%rip),%rax
  movsd  (%rcx,%r15,8),%xmm1
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%rsi
  movapd %xmm5,%xmm3
  movq   %rax,%xmm4
  movapd %xmm1,%xmm6
  andpd  %xmm5,%xmm6
  comisd %xmm6,%xmm0
  ja     L105
  comisd %xmm0,%xmm1
  jb     L154
  movsd  %xmm1,(%rsi,%r15,8)
  jmp    L129
```

tool_calls: name: retrieve_data
arguments: tag: D39
type_guessed: qword
name: retrieve_data
arguments: tag: D2
type_guessed: byte[8]

tool: D39: 9223372036854775807

tool: {"D2": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
void ep21R(double *x, double *t, double *u, double *v, int n, int k) {
  int i, j, tn = n * k;
  double temp;
  for (j = 0; j < n; j++) {
    temp = 0;
    for (i = j; i < tn; i += n)
      temp += u[i] * u[i];
    temp = sqrt(temp);
    if (temp > fabs(v[j])) {
      t[j] = (temp + v[j]) / 2;
      for (i = j; i < tn; i += n)
        x[i] = t[j] / temp * u[i];
    } else if (temp <= v[j]) {
      t[j] = v[j];
      for (i = j; i < tn; i += n)
        x[i] = u[i];
    } else {
      t[j] = 0;
      for (i = j; i < tn; i += n)
        x[i] = 0;
    }
  }
}
```