user: What would the C source look like for the assembly code provided here?

```asm
<quatd_from_mat3d>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x44(%rbp)
  movl   $0x1,-0x40(%rbp)
  movl   $0x2,-0x3c(%rbp)
  movl   $0x3,-0x38(%rbp)
  mov    -0x60(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x60(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x60(%rbp),%rax
  add    $0x40,%rax
  movsd  (%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x28(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L27
  movsd  -0x28(%rbp),%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm3,%xmm3
  cvtsd2ss %xmm0,%xmm3
  movd   %xmm3,%eax
  movd   %eax,%xmm0
  call   <sqrtf@plt>
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x20(%rbp),%xmm1
  movsd  D39(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  movsd  D39(%rip),%xmm0
  divsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  %xmm2,-0x68(%rbp)
  mov    -0x3c(%rbp),%edx
  mov    -0x40(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x68(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x3c(%rbp),%edx
  mov    -0x44(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  movsd  %xmm3,-0x68(%rbp)
  mov    -0x44(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x68(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x3c(%rbp),%edx
  mov    -0x40(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm4
  movsd  %xmm4,-0x68(%rbp)
  mov    -0x40(%rbp),%edx
  mov    -0x44(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x68(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L12
L27:
  mov    -0x40(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x44(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x44(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  mov    -0x40(%rbp),%edx
  mov    -0x40(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm4
  movsd  %xmm4,-0x68(%rbp)
  mov    -0x44(%rbp),%edx
  mov    -0x44(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x68(%rbp),%xmm4
  comisd %xmm0,%xmm4
  jbe    L29
  mov    -0x40(%rbp),%eax
  mov    %eax,-0x48(%rbp)
L29:
  mov    -0x3c(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm5
  movsd  %xmm5,-0x68(%rbp)
  mov    -0x48(%rbp),%edx
  mov    -0x48(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x68(%rbp),%xmm5
  comisd %xmm0,%xmm5
  jbe    L48
  mov    -0x3c(%rbp),%eax
  mov    %eax,-0x48(%rbp)
L48:
  mov    -0x48(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x48(%rbp),%edx
  mov    -0x48(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm5
  movsd  %xmm5,-0x68(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x34(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm6
  movsd  %xmm6,-0x70(%rbp)
  mov    -0x30(%rbp),%edx
  mov    -0x30(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  addsd  -0x70(%rbp),%xmm0
  movsd  -0x68(%rbp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm7,%xmm7
  cvtsd2ss %xmm0,%xmm7
  movd   %xmm7,%eax
  movd   %eax,%xmm0
  call   <sqrtf@plt>
  movd   %xmm0,%eax
  mov    %eax,-0x2c(%rbp)
  pxor   %xmm1,%xmm1
  cvtss2sd -0x2c(%rbp),%xmm1
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  D39(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  movss  D34(%rip),%xmm0
  divss  -0x2c(%rbp),%xmm0
  movss  %xmm0,-0x2c(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm6
  movsd  %xmm6,-0x68(%rbp)
  mov    -0x30(%rbp),%edx
  mov    -0x34(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x68(%rbp),%xmm1
  subsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtss2sd -0x2c(%rbp),%xmm0
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x48(%rbp),%edx
  mov    -0x34(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm7
  movsd  %xmm7,-0x68(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x48(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x68(%rbp),%xmm1
  addsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtss2sd -0x2c(%rbp),%xmm0
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x48(%rbp),%edx
  mov    -0x30(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  %xmm2,-0x68(%rbp)
  mov    -0x30(%rbp),%edx
  mov    -0x48(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mat3_getIndex@plt>
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x68(%rbp),%xmm1
  addsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtss2sd -0x2c(%rbp),%xmm0
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
L12:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L21
  call   <__stack_chk_fail@plt>
L21:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D19
datatype: f64
name: parse_data
arguments: data_label: D39
datatype: f64
name: parse_data
arguments: data_label: D34
datatype: byte[4]

tool: D19: 1

tool: D39: 0.5

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

assistant: ```c
void quatd_from_mat3d(double quat[4], const double matrix[9]) {
  int X = 0, Y = 1, Z = 2, W = 3;
  double trace = matrix[0] + matrix[4] + matrix[8];
  if (trace > 0.0) {
    double s = sqrtf(trace + 1.0);
    quat[W] = s * 0.5;
    s = 0.5 / s;
    quat[X] = (matrix[mat3_getIndex(Z, Y)] - matrix[mat3_getIndex(Y, Z)]) * s;
    quat[Y] = (matrix[mat3_getIndex(X, Z)] - matrix[mat3_getIndex(Z, X)]) * s;
    quat[Z] = (matrix[mat3_getIndex(Y, Z)] - matrix[mat3_getIndex(X, Y)]) * s;
  } else {
    int next[3] = {Y, Z, X};
    int i = X;
    if (matrix[mat3_getIndex(Y, Y)] > matrix[mat3_getIndex(X, X)])
      i = Y;
    if (matrix[mat3_getIndex(Z, Z)] > matrix[mat3_getIndex(i, i)])
      i = Z;
    int j = next[i];
    int k = next[j];
    float s = sqrtf((matrix[mat3_getIndex(i, i)] - (matrix[mat3_getIndex(j, j)] + matrix[mat3_getIndex(k, k)])) + 1.0);
    quat[i] = s * 0.5;
    s = 0.5 / s;
    quat[W] = (matrix[mat3_getIndex(k, j)] - matrix[mat3_getIndex(j, k)]) * s;
    quat[j] = (matrix[mat3_getIndex(j, i)] + matrix[mat3_getIndex(i, j)]) * s;
    quat[k] = (matrix[mat3_getIndex(k, i)] + matrix[mat3_getIndex(i, k)]) * s;
  }
}
```