user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<cquat_from_matrix_t>:
  endbr64
  sub    $0x18,%rsp
  movsd  (%rsi),%xmm2
  movsd  0x20(%rsi),%xmm3
  movsd  D30(%rip),%xmm1
  movsd  0x40(%rsi),%xmm4
  movapd %xmm2,%xmm5
  addsd  %xmm1,%xmm5
  movapd %xmm5,%xmm0
  addsd  %xmm3,%xmm0
  addsd  %xmm4,%xmm0
  comisd D22(%rip),%xmm0
  ja     L34
  comisd %xmm3,%xmm2
  jbe    L55
  comisd %xmm4,%xmm2
  ja     L92
L55:
  comisd %xmm2,%xmm3
  ja     L3
L49:
  comisd %xmm2,%xmm4
  jbe    L37
  comisd %xmm3,%xmm4
  ja     L130
L37:
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  comisd %xmm4,%xmm3
  jbe    L49
  subsd  %xmm2,%xmm1
  movapd %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  addsd  %xmm3,%xmm0
  subsd  %xmm4,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L115
  sqrtsd %xmm0,%xmm0
L54:
  addsd  %xmm0,%xmm0
  movsd  D45(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  movsd  0x18(%rsi),%xmm1
  addsd  0x8(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x38(%rsi),%xmm1
  addsd  0x28(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  movsd  0x30(%rsi),%xmm1
  subsd  0x10(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L34:
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L91
  sqrtsd %xmm0,%xmm0
L16:
  addsd  %xmm0,%xmm0
  movsd  D45(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  movsd  0x28(%rsi),%xmm1
  subsd  0x38(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x30(%rsi),%xmm1
  subsd  0x10(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  movsd  0x8(%rsi),%xmm1
  subsd  0x18(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L92:
  subsd  %xmm3,%xmm5
  pxor   %xmm1,%xmm1
  movapd %xmm5,%xmm0
  subsd  %xmm4,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L9
  sqrtsd %xmm0,%xmm0
L10:
  addsd  %xmm0,%xmm0
  movsd  D45(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x18(%rsi),%xmm1
  addsd  0x8(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  movsd  0x30(%rsi),%xmm1
  addsd  0x10(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  movsd  0x28(%rsi),%xmm1
  subsd  0x38(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L130:
  movapd %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  subsd  %xmm2,%xmm0
  subsd  %xmm3,%xmm0
  addsd  %xmm4,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L11
  sqrtsd %xmm0,%xmm0
L50:
  addsd  %xmm0,%xmm0
  movsd  D45(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  movsd  0x30(%rsi),%xmm1
  addsd  0x10(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  movsd  0x38(%rsi),%xmm1
  addsd  0x28(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x8(%rsi),%xmm1
  subsd  0x18(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  jmp    L37
L91:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L16
L9:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L10
L11:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L50
L115:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L54
```

tool_calls: name: extract_symbolic_data
arguments: tag: D30
type_infered: f64
name: extract_symbolic_data
arguments: tag: D22
type_infered: f64[2]
name: extract_symbolic_data
arguments: tag: D45
type_infered: byte[8]

tool: D30: 1

tool: {"D22": [0.1,0.25]}

tool: {"D45": [0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x3f]}

assistant: ```c
void cquat_from_matrix_t(double *q, const double *m) {
  double m11 = m[((1) - 1) * (3) + ((1) - 1)];
  double m22 = m[((2) - 1) * (3) + ((2) - 1)];
  double m33 = m[((3) - 1) * (3) + ((3) - 1)];
  double s;
  s = 1.0 + m11 + m22 + m33;
  if (s > 0.1) {
    s = 2.0 * sqrt(s);
    q[3] = s / 4.0;
    q[0] = (m[((2) - 1) * (3) + ((3) - 1)] - m[((3) - 1) * (3) + ((2) - 1)]) / s;
    q[1] = (m[((3) - 1) * (3) + ((1) - 1)] - m[((1) - 1) * (3) + ((3) - 1)]) / s;
    q[2] = (m[((1) - 1) * (3) + ((2) - 1)] - m[((2) - 1) * (3) + ((1) - 1)]) / s;
  } else if ((m11 > m22) && (m11 > m33)) {
    s = 2.0 * sqrt(1.0 + m11 - m22 - m33);
    q[0] = s / 4.0;
    q[1] = (m[((2) - 1) * (3) + ((1) - 1)] + m[((1) - 1) * (3) + ((2) - 1)]) / s;
    q[2] = (m[((3) - 1) * (3) + ((1) - 1)] + m[((1) - 1) * (3) + ((3) - 1)]) / s;
    q[3] = (m[((2) - 1) * (3) + ((3) - 1)] - m[((3) - 1) * (3) + ((2) - 1)]) / s;
  } else if ((m22 > m11) && (m22 > m33)) {
    s = 2.0 * sqrt(1.0 - m11 + m22 - m33);
    q[1] = s / 4.0;
    q[0] = (m[((2) - 1) * (3) + ((1) - 1)] + m[((1) - 1) * (3) + ((2) - 1)]) / s;
    q[2] = (m[((3) - 1) * (3) + ((2) - 1)] + m[((2) - 1) * (3) + ((3) - 1)]) / s;
    q[3] = (m[((3) - 1) * (3) + ((1) - 1)] - m[((1) - 1) * (3) + ((3) - 1)]) / s;
  } else if ((m33 > m11) && (m33 > m22)) {
    s = 2.0 * sqrt(1.0 - m11 - m22 + m33);
    q[2] = s / 4.0;
    q[3] = (m[((3) - 1) * (3) + ((1) - 1)] + m[((1) - 1) * (3) + ((3) - 1)]) / s;
    q[0] = (m[((3) - 1) * (3) + ((2) - 1)] + m[((2) - 1) * (3) + ((3) - 1)]) / s;
    q[1] = (m[((1) - 1) * (3) + ((2) - 1)] - m[((2) - 1) * (3) + ((1) - 1)]) / s;
  }
}
```