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

```asm
<R2Quaternion>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  movss  (%rdi),%xmm0
  movss  D10(%rip),%xmm1
  movaps %xmm0,%xmm2
  addss  %xmm1,%xmm2
  movss  0x10(%rdi),%xmm4
  movss  0x20(%rdi),%xmm3
  movaps %xmm2,%xmm5
  addss  %xmm4,%xmm5
  addss  %xmm3,%xmm5
  subss  %xmm4,%xmm2
  subss  %xmm3,%xmm2
  subss  %xmm0,%xmm1
  movaps %xmm4,%xmm0
  addss  %xmm1,%xmm0
  subss  %xmm3,%xmm0
  subss  %xmm4,%xmm1
  addss  %xmm3,%xmm1
  mov    $0x1,%r12d
  comiss %xmm5,%xmm2
  ja     L78
  movaps %xmm5,%xmm2
  mov    $0x0,%r12d
L78:
  comiss %xmm2,%xmm0
  ja     L82
  movaps %xmm2,%xmm0
L18:
  comiss %xmm0,%xmm1
  ja     L59
  call   <sqrtf@plt>
  add    %eax,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  test   %r12d,%r12d
  jne    L31
  movaps %xmm0,%xmm1
  mulss  D17(%rip),%xmm1
  movss  %xmm1,0x0(%rbp)
  movss  0x14(%rbx),%xmm1
  subss  0x1c(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x4(%rbp)
  movss  0x18(%rbx),%xmm1
  subss  0x8(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x8(%rbp)
  movss  0x4(%rbx),%xmm1
  subss  0xc(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0xc(%rbp)
L86:
  movss  0x0(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  ja     L102
L115:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L82:
  mov    $0x2,%r12d
  jmp    L18
L31:
  cmp    $0x1,%r12d
  jne    L60
  movaps %xmm0,%xmm1
  mulss  D17(%rip),%xmm1
  movss  %xmm1,0x4(%rbp)
  movss  0x14(%rbx),%xmm1
  subss  0x1c(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x0(%rbp)
  movss  0x4(%rbx),%xmm1
  addss  0xc(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x8(%rbp)
  movss  0x8(%rbx),%xmm1
  addss  0x18(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0xc(%rbp)
  jmp    L86
L60:
  cmp    $0x2,%r12d
  jne    L48
  movaps %xmm0,%xmm1
  mulss  D17(%rip),%xmm1
  movss  %xmm1,0x8(%rbp)
  movss  0x18(%rbx),%xmm1
  subss  0x8(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x0(%rbp)
  movss  0x4(%rbx),%xmm1
  addss  0xc(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x4(%rbp)
  movss  0x14(%rbx),%xmm1
  addss  0x1c(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0xc(%rbp)
  jmp    L86
L102:
  movss  D53(%rip),%xmm1
  xorps  %xmm1,%xmm0
  movss  %xmm0,0x0(%rbp)
  movss  0x4(%rbp),%xmm0
  xorps  %xmm1,%xmm0
  movss  %xmm0,0x4(%rbp)
  movss  0x8(%rbp),%xmm0
  xorps  %xmm1,%xmm0
  movss  %xmm0,0x8(%rbp)
  movss  0xc(%rbp),%xmm0
  xorps  %xmm1,%xmm0
  movss  %xmm0,0xc(%rbp)
  jmp    L115
L59:
  movaps %xmm1,%xmm0
  call   <sqrtf@plt>
  add    %eax,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
L48:
  movaps %xmm0,%xmm1
  mulss  D17(%rip),%xmm1
  movss  %xmm1,0xc(%rbp)
  movss  0x4(%rbx),%xmm1
  subss  0xc(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x0(%rbp)
  movss  0x8(%rbx),%xmm1
  addss  0x18(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x4(%rbp)
  movss  0x14(%rbx),%xmm1
  addss  0x1c(%rbx),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x8(%rbp)
  jmp    L86
```

tool_calls: name: parse_data
arguments: label: D10
datatype: byte[4]
name: parse_data
arguments: label: D17
datatype: byte[4]
name: parse_data
arguments: label: D53
datatype: byte[4]

tool: {"D10": [0x00,0x00,0x80,0x3f]}

tool: {"D17": [0x00,0x00,0x80,0x3e]}

tool: {"D53": [0x00,0x00,0x00,0x80]}

assistant: ```c
void R2Quaternion(float R[3][3], float q[4]) {
  float m[4], mag;
  uint8_t index, i;
  m[0] = 1 + R[0][0] + R[1][1] + R[2][2];
  m[1] = 1 + R[0][0] - R[1][1] - R[2][2];
  m[2] = 1 - R[0][0] + R[1][1] - R[2][2];
  m[3] = 1 - R[0][0] - R[1][1] + R[2][2];
  index = 0;
  mag = m[0];
  for (i = 1; i < 4; i++) {
    if (m[i] > mag) {
      mag = m[i];
      index = i;
    }
  }
  mag = 2 * sqrtf(mag);
  if (index == 0) {
    q[0] = mag / 4;
    q[1] = (R[1][2] - R[2][1]) / mag;
    q[2] = (R[2][0] - R[0][2]) / mag;
    q[3] = (R[0][1] - R[1][0]) / mag;
  } else if (index == 1) {
    q[1] = mag / 4;
    q[0] = (R[1][2] - R[2][1]) / mag;
    q[2] = (R[0][1] + R[1][0]) / mag;
    q[3] = (R[0][2] + R[2][0]) / mag;
  } else if (index == 2) {
    q[2] = mag / 4;
    q[0] = (R[2][0] - R[0][2]) / mag;
    q[1] = (R[0][1] + R[1][0]) / mag;
    q[3] = (R[1][2] + R[2][1]) / mag;
  } else {
    q[3] = mag / 4;
    q[0] = (R[0][1] - R[1][0]) / mag;
    q[1] = (R[0][2] + R[2][0]) / mag;
    q[2] = (R[1][2] + R[2][1]) / mag;
  }
  if (q[0] < 0) {
    q[0] = -q[0];
    q[1] = -q[1];
    q[2] = -q[2];
    q[3] = -q[3];
  }
}
```