user: Demonstrate the C code that generates the assembly output below:

```asm
<normalize_quat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  comisd D38(%rip),%xmm0
  ja     L55
  movsd  D29(%rip),%xmm0
  comisd -0x8(%rbp),%xmm0
  jbe    L27
L55:
  movl   $0x0,-0xc(%rbp)
  jmp    L80
L61:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  lea    D37(%rip),%rdx
  movsd  (%rcx,%rdx,1),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0xc(%rbp)
L80:
  cmpl   $0x3,-0xc(%rbp)
  jle    L61
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L89
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jne    L89
  mov    -0x18(%rbp),%rax
  movsd  D6(%rip),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L89
L27:
  movl   $0x0,-0xc(%rbp)
  jmp    L52
L56:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  divsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  lea    D37(%rip),%rax
  movsd  %xmm0,(%rdx,%rax,1)
  addl   $0x1,-0xc(%rbp)
L52:
  cmpl   $0x3,-0xc(%rbp)
  jle    L56
  nop
L89:
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D38
datatype: f64[2]
name: retrieve_data
arguments: data_label: D29
datatype: f64
name: retrieve_data
arguments: data_label: D6
datatype: f64

tool: {"D38": [1.01,0.99]}

tool: D29: 0.99

tool: D6: 1

assistant: ```c
void normalize_quat(double q[4]) {
  int i;
  double mag;
  static double oldq[4];
  mag = sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]);
  if ((mag > 1.01) || (mag < 0.99)) {
    for (i = 0; i < 4; i++) {
      q[i] = oldq[i];
    }
    if (q[0] * q[0] + q[1] * q[1] + q[2] * q[2] == 0.)
      q[0] = 1.;
  } else
    for (i = 0; i < 4; i++) {
      q[i] /= mag;
      oldq[i] = q[i];
    }
}
```