user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<cquat_from_matrix>:
  endbr64
  sub    $0x18,%rsp
  movsd  (%rsi),%xmm2
  movsd  0x20(%rsi),%xmm3
  movsd  D57(%rip),%xmm1
  movsd  0x40(%rsi),%xmm4
  movapd %xmm2,%xmm5
  addsd  %xmm1,%xmm5
  movapd %xmm5,%xmm0
  addsd  %xmm3,%xmm0
  addsd  %xmm4,%xmm0
  comisd D45(%rip),%xmm0
  ja     L25
  comisd %xmm3,%xmm2
  jbe    L49
  comisd %xmm4,%xmm2
  ja     L103
L49:
  comisd %xmm2,%xmm3
  ja     L74
L141:
  comisd %xmm2,%xmm4
  jbe    L42
  comisd %xmm3,%xmm4
  ja     L93
L42:
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L74:
  comisd %xmm4,%xmm3
  jbe    L141
  subsd  %xmm2,%xmm1
  movapd %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  addsd  %xmm3,%xmm0
  subsd  %xmm4,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L2
  sqrtsd %xmm0,%xmm0
L145:
  addsd  %xmm0,%xmm0
  movsd  D34(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  movsd  0x8(%rsi),%xmm1
  addsd  0x18(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x28(%rsi),%xmm1
  addsd  0x38(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  movsd  0x10(%rsi),%xmm1
  subsd  0x30(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  jmp    L42
  nopw   0x0(%rax,%rax,1)
L25:
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L39
  sqrtsd %xmm0,%xmm0
L138:
  addsd  %xmm0,%xmm0
  movsd  D34(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  movsd  0x38(%rsi),%xmm1
  subsd  0x28(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x10(%rsi),%xmm1
  subsd  0x30(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  movsd  0x18(%rsi),%xmm1
  subsd  0x8(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L103:
  subsd  %xmm3,%xmm5
  pxor   %xmm1,%xmm1
  movapd %xmm5,%xmm0
  subsd  %xmm4,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L164
  sqrtsd %xmm0,%xmm0
L102:
  addsd  %xmm0,%xmm0
  movsd  D34(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x8(%rsi),%xmm1
  addsd  0x18(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  movsd  0x10(%rsi),%xmm1
  addsd  0x30(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  movsd  0x38(%rsi),%xmm1
  subsd  0x28(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L93:
  movapd %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  subsd  %xmm2,%xmm0
  subsd  %xmm3,%xmm0
  addsd  %xmm4,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L120
  sqrtsd %xmm0,%xmm0
L40:
  addsd  %xmm0,%xmm0
  movsd  D34(%rip),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdi)
  movsd  0x10(%rsi),%xmm1
  addsd  0x30(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rdi)
  movsd  0x28(%rsi),%xmm1
  addsd  0x38(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  0x18(%rsi),%xmm1
  subsd  0x8(%rsi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdi)
  jmp    L42
L39:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L138
L164:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L102
L120:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L40
L2:
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  jmp    L145
```

tool_calls: name: read_data
arguments: data_tag: D57
datatype: f64
name: read_data
arguments: data_tag: D45
datatype: f64[2]
name: read_data
arguments: data_tag: D34
datatype: byte[8]

tool: D57: 1

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

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

assistant: ```c
void cquat_from_matrix(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[((3) - 1) * (3) + ((2) - 1)] - m[((2) - 1) * (3) + ((3) - 1)]) / s;
    q[1] = (m[((1) - 1) * (3) + ((3) - 1)] - m[((3) - 1) * (3) + ((1) - 1)]) / s;
    q[2] = (m[((2) - 1) * (3) + ((1) - 1)] - m[((1) - 1) * (3) + ((2) - 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[((1) - 1) * (3) + ((2) - 1)] + m[((2) - 1) * (3) + ((1) - 1)]) / s;
    q[2] = (m[((1) - 1) * (3) + ((3) - 1)] + m[((3) - 1) * (3) + ((1) - 1)]) / s;
    q[3] = (m[((3) - 1) * (3) + ((2) - 1)] - m[((2) - 1) * (3) + ((3) - 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[((1) - 1) * (3) + ((2) - 1)] + m[((2) - 1) * (3) + ((1) - 1)]) / s;
    q[2] = (m[((2) - 1) * (3) + ((3) - 1)] + m[((3) - 1) * (3) + ((2) - 1)]) / s;
    q[3] = (m[((1) - 1) * (3) + ((3) - 1)] - m[((3) - 1) * (3) + ((1) - 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[((1) - 1) * (3) + ((3) - 1)] + m[((3) - 1) * (3) + ((1) - 1)]) / s;
    q[0] = (m[((2) - 1) * (3) + ((3) - 1)] + m[((3) - 1) * (3) + ((2) - 1)]) / s;
    q[1] = (m[((2) - 1) * (3) + ((1) - 1)] - m[((1) - 1) * (3) + ((2) - 1)]) / s;
  }
}
```