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

```asm
<vectord_normalize_to_unit_length>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x18,%rsp
  call   <assert@plt>
  mov    %r12,%rdi
  call   <assert@plt>
  test   %ebx,%ebx
  je     L155
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <vectord_remove_mean@plt>
  test   %rbp,%rbp
  je     L60
  cmp    $0x1,%rbp
  je     L44
  mov    %rbp,%rdx
  pxor   %xmm3,%xmm3
  mov    %r12,%rax
  shr    %rdx
  movapd %xmm3,%xmm0
  shl    $0x4,%rdx
  add    %r12,%rdx
  nopw   0x0(%rax,%rax,1)
L127:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  mulpd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  unpckhpd %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rax,%rdx
  jne    L127
  mov    %rbp,%rax
  and    $0xfffffffffffffffe,%rax
  test   $0x1,%bpl
  je     L112
L126:
  movsd  (%r12,%rax,8),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
L112:
  ucomisd %xmm0,%xmm3
  ja     L46
  sqrtsd %xmm0,%xmm0
  comisd %xmm3,%xmm0
  jbe    L60
L18:
  cmp    $0x1,%rbp
  je     L111
  mov    %rbp,%rdx
  movapd %xmm0,%xmm2
  mov    %r12,%rax
  shr    %rdx
  unpcklpd %xmm2,%xmm2
  shl    $0x4,%rdx
  add    %r12,%rdx
  xchg   %ax,%ax
L0:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  divpd  %xmm2,%xmm1
  movups %xmm1,-0x10(%rax)
  cmp    %rax,%rdx
  jne    L0
  mov    %rbp,%rax
  and    $0xfffffffffffffffe,%rax
  and    $0x1,%ebp
  je     L60
L120:
  lea    (%r12,%rax,8),%rax
  movsd  (%rax),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
L60:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L155:
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <vectord_length@plt>
  comisd D19(%rip),%xmm0
  jbe    L7
  movsd  D8(%rip),%xmm1
  mov    %r12,%rcx
  divsd  %xmm0,%xmm1
  cvttsd2si %xmm1,%edx
L119:
  add    $0x18,%rsp
  mov    %rbp,%rsi
  mov    %r13,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10d0 <vectord_multiply@plt>
  nopl   (%rax)
L7:
  mov    %r12,%rcx
  mov    $0x1,%edx
  jmp    L119
L44:
  pxor   %xmm3,%xmm3
  xor    %eax,%eax
  movapd %xmm3,%xmm0
  jmp    L126
L111:
  xor    %eax,%eax
  jmp    L120
L46:
  movsd  %xmm3,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm3
  comisd %xmm3,%xmm0
  ja     L18
  jmp    L60
```

tool_calls: name: disassemble_data
arguments: tag: D19
type_guessed: f64[2]
name: disassemble_data
arguments: tag: D8
type_guessed: byte[8]

tool: {"D19": [0.0,1.0]}

tool: {"D8": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
void vectord_normalize_to_unit_length(const double *self, size_t size, bool remove_mean, double *output) {
  assert(self);
  assert(output);
  if (remove_mean) {
    vectord_remove_mean(self, size, output);
    double length = 0.0;
    for (size_t i = 0; i < size; i++)
      length += output[i] * output[i];
    length = sqrt(length);
    if (length > 0) {
      for (size_t i = 0; i < size; i++)
        output[i] /= length;
    }
  } else {
    double length = vectord_length(self, size);
    if (length > 0)
      vectord_multiply(self, size, 1 / length, output);
    else
      vectord_multiply(self, size, 1, output);
  }
}
```