user: 请将以下的汇编代码转换成C语言代码：

```asm
<cquat_from_matrix>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  movsd  (%rsi),%xmm1
  movsd  0x20(%rsi),%xmm2
  movsd  0x40(%rsi),%xmm3
  movapd %xmm1,%xmm4
  addsd  D38(%rip),%xmm4
  movapd %xmm4,%xmm0
  addsd  %xmm2,%xmm0
  addsd  %xmm3,%xmm0
  comisd D34(%rip),%xmm0
  ja     L80
  comisd %xmm2,%xmm1
  jbe    L83
  comisd %xmm3,%xmm1
  ja     L147
L83:
  comisd %xmm1,%xmm2
  jbe    L134
  comisd %xmm3,%xmm2
  ja     L10
L134:
  comisd %xmm1,%xmm3
  jbe    L154
  comisd %xmm2,%xmm3
  jbe    L154
  movsd  D38(%rip),%xmm0
  subsd  %xmm1,%xmm0
  subsd  %xmm2,%xmm0
  addsd  %xmm3,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L92
  sqrtsd %xmm0,%xmm0
L85:
  addsd  %xmm0,%xmm0
  movapd %xmm0,%xmm1
  mulsd  D62(%rip),%xmm1
  movsd  %xmm1,0x10(%rbp)
  movsd  0x10(%rbx),%xmm1
  addsd  0x30(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rbp)
  movsd  0x28(%rbx),%xmm1
  addsd  0x38(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%rbp)
  movsd  0x18(%rbx),%xmm1
  subsd  0x8(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rbp)
  jmp    L154
L80:
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L81
  sqrtsd %xmm0,%xmm0
L169:
  addsd  %xmm0,%xmm0
  movapd %xmm0,%xmm1
  mulsd  D62(%rip),%xmm1
  movsd  %xmm1,0x18(%rbp)
  movsd  0x38(%rbx),%xmm1
  subsd  0x28(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%rbp)
  movsd  0x10(%rbx),%xmm1
  subsd  0x30(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rbp)
  movsd  0x18(%rbx),%xmm1
  subsd  0x8(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbp)
L154:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L81:
  call   <sqrt@plt>
  jmp    L169
L147:
  subsd  %xmm2,%xmm4
  movapd %xmm4,%xmm0
  subsd  %xmm3,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L107
  sqrtsd %xmm0,%xmm0
L66:
  addsd  %xmm0,%xmm0
  movapd %xmm0,%xmm1
  mulsd  D62(%rip),%xmm1
  movsd  %xmm1,0x0(%rbp)
  movsd  0x8(%rbx),%xmm1
  addsd  0x18(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rbp)
  movsd  0x10(%rbx),%xmm1
  addsd  0x30(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbp)
  movsd  0x38(%rbx),%xmm1
  subsd  0x28(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rbp)
  jmp    L154
L107:
  call   <sqrt@plt>
  jmp    L66
L10:
  movsd  D38(%rip),%xmm0
  subsd  %xmm1,%xmm0
  addsd  %xmm2,%xmm0
  subsd  %xmm3,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L103
  sqrtsd %xmm0,%xmm0
L13:
  addsd  %xmm0,%xmm0
  movapd %xmm0,%xmm1
  mulsd  D62(%rip),%xmm1
  movsd  %xmm1,0x8(%rbp)
  movsd  0x8(%rbx),%xmm1
  addsd  0x18(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%rbp)
  movsd  0x28(%rbx),%xmm1
  addsd  0x38(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbp)
  movsd  0x10(%rbx),%xmm1
  subsd  0x30(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rbp)
  jmp    L154
L103:
  call   <sqrt@plt>
  jmp    L13
L92:
  call   <sqrt@plt>
  jmp    L85
```

tool_calls: name: extract_symbolic_data
arguments: tag: D38
datatype: f64
name: extract_symbolic_data
arguments: tag: D34
datatype: f64[2]
name: extract_symbolic_data
arguments: tag: D62
datatype: byte[8]

tool: D38: 1

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

tool: {"D62": [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;
  }
}
```