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

```asm
<quat2rpy>:
  endbr64
  push   %r12
  pxor   %xmm5,%xmm5
  mov    %rsi,%r12
  push   %rbp
  movapd %xmm5,%xmm0
  mov    %rdx,%rbp
  push   %rbx
  mov    %rcx,%rbx
  add    $0xffffffffffffff80,%rsp
  movdqu 0x10(%rdi),%xmm6
  movdqu (%rdi),%xmm7
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  movsd  D0(%rip),%xmm2
  lea    0x20(%rdi),%rax
  movq   D33(%rip),%xmm4
  movaps %xmm6,0x60(%rsp)
  movsd  D25(%rip),%xmm6
  movaps %xmm7,0x50(%rsp)
L3:
  movsd  (%rdi),%xmm1
  movapd %xmm1,%xmm3
  andpd  %xmm4,%xmm3
  comisd %xmm2,%xmm3
  jbe    L58
  divsd  %xmm3,%xmm2
  mulsd  %xmm2,%xmm0
  mulsd  %xmm2,%xmm0
  movapd %xmm3,%xmm2
  addsd  %xmm6,%xmm0
L27:
  add    $0x8,%rdi
  cmp    %rdi,%rax
  jne    L3
  ucomisd %xmm0,%xmm5
  ja     L66
  sqrtsd %xmm0,%xmm0
L29:
  mulsd  %xmm2,%xmm0
  lea    0x50(%rsp),%rax
  lea    0x70(%rsp),%rdx
L62:
  movsd  (%rax),%xmm1
  add    $0x8,%rax
  divsd  %xmm0,%xmm1
  movsd  %xmm1,-0x8(%rax)
  cmp    %rax,%rdx
  jne    L62
  movsd  0x50(%rsp),%xmm3
  movsd  0x58(%rsp),%xmm5
  movsd  0x60(%rsp),%xmm2
  movsd  0x68(%rsp),%xmm7
  movapd %xmm3,%xmm4
  movapd %xmm5,%xmm9
  movapd %xmm5,%xmm0
  movsd  %xmm5,0x18(%rsp)
  mulsd  %xmm3,%xmm4
  movapd %xmm2,%xmm8
  movapd %xmm3,%xmm10
  movsd  %xmm2,0x30(%rsp)
  mulsd  %xmm5,%xmm9
  movapd %xmm7,%xmm6
  movsd  %xmm3,0x10(%rsp)
  mulsd  %xmm2,%xmm8
  movsd  %xmm7,0x8(%rsp)
  mulsd  %xmm7,%xmm10
  mulsd  %xmm2,%xmm0
  mulsd  %xmm7,%xmm6
  movapd %xmm4,%xmm1
  movsd  %xmm4,0x48(%rsp)
  addsd  %xmm9,%xmm1
  movsd  %xmm9,0x40(%rsp)
  movsd  %xmm8,0x38(%rsp)
  subsd  %xmm8,%xmm1
  addsd  %xmm10,%xmm0
  movsd  %xmm6,0x28(%rsp)
  subsd  %xmm6,%xmm1
  addsd  %xmm0,%xmm0
  call   <rt_atan2d_snf@plt>
  movsd  0x18(%rsp),%xmm5
  movsd  0x10(%rsp),%xmm3
  movsd  0x8(%rsp),%xmm7
  movsd  0x30(%rsp),%xmm2
  movsd  %xmm0,(%r12)
  movapd %xmm3,%xmm1
  movapd %xmm5,%xmm0
  movsd  %xmm5,0x20(%rsp)
  mulsd  %xmm2,%xmm1
  movsd  %xmm7,0x18(%rsp)
  mulsd  %xmm7,%xmm0
  movsd  %xmm2,0x8(%rsp)
  subsd  %xmm1,%xmm0
  mulsd  D39(%rip),%xmm0
  call   <asin@plt>
  movsd  0x8(%rsp),%xmm2
  movsd  0x18(%rsp),%xmm7
  movsd  0x10(%rsp),%xmm3
  movsd  0x20(%rsp),%xmm5
  movsd  %xmm0,0x0(%rbp)
  mulsd  %xmm7,%xmm2
  movsd  0x48(%rsp),%xmm4
  movsd  0x40(%rsp),%xmm9
  mulsd  %xmm5,%xmm3
  movsd  0x38(%rsp),%xmm8
  movsd  0x28(%rsp),%xmm6
  subsd  %xmm9,%xmm4
  movapd %xmm4,%xmm1
  addsd  %xmm3,%xmm2
  subsd  %xmm8,%xmm1
  addsd  %xmm2,%xmm2
  addsd  %xmm6,%xmm1
  movapd %xmm2,%xmm0
  call   <rt_atan2d_snf@plt>
  movsd  %xmm0,(%rbx)
  mov    0x78(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L21
  sub    $0xffffffffffffff80,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L58:
  divsd  %xmm2,%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  jmp    L27
L66:
  movsd  %xmm2,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm2
  jmp    L29
L21:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D0
type: f32[2]
name: extract_symbolic_data
arguments: label: D33
type: qword
name: extract_symbolic_data
arguments: label: D25
type: f64
name: extract_symbolic_data
arguments: label: D39
type: f32[2]

tool: {"D0": [0.0,1.4693679385278594e-39]}

tool: D33: 9223372036854775807

tool: D25: 1

tool: {"D39": [0.0,-2.0]}

assistant: ```c
void quat2rpy(const double q[4], double *yaw, double *pitch, double *roll) {
  int k;
  double qin[4];
  double qm;
  double scale;
  double absxk;
  double t;
  for (k = 0; k < 4; k++) {
    qin[k] = q[k];
  }
  qm = 0.0;
  scale = 2.2250738585072014E-308;
  for (k = 0; k < 4; k++) {
    absxk = fabs(q[k]);
    if (absxk > scale) {
      t = scale / absxk;
      qm = 1.0 + qm * t * t;
      scale = absxk;
    } else {
      t = absxk / scale;
      qm += t * t;
    }
  }
  qm = scale * sqrt(qm);
  for (k = 0; k < 4; k++) {
    qin[k] /= qm;
  }
  *yaw = rt_atan2d_snf(2.0 * (qin[1] * qin[2] + qin[0] * qin[3]), ((qin[0] * qin[0] + qin[1] * qin[1]) - qin[2] * qin[2]) - qin[3] * qin[3]);
  *pitch = asin(-2.0 * (qin[1] * qin[3] - qin[0] * qin[2]));
  *roll = rt_atan2d_snf(2.0 * (qin[2] * qin[3] + qin[0] * qin[1]), ((qin[0] * qin[0] - qin[1] * qin[1]) - qin[2] * qin[2]) + qin[3] * qin[3]);
}
```