user: Please show me the C implementation that matches the assembly code listed below:

```asm
<check_rotation>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  movsd  0x8(%rdi),%xmm1
  movsd  0x10(%rdi),%xmm13
  movsd  0x20(%rdi),%xmm2
  movsd  0x28(%rdi),%xmm11
  movapd %xmm1,%xmm4
  movapd %xmm13,%xmm0
  movsd  (%rdi),%xmm8
  movsd  0x18(%rdi),%xmm10
  mulsd  %xmm2,%xmm0
  movapd %xmm13,%xmm3
  mulsd  %xmm11,%xmm4
  movapd %xmm8,%xmm6
  mulsd  %xmm10,%xmm3
  mulsd  %xmm2,%xmm6
  subsd  %xmm0,%xmm4
  movapd %xmm8,%xmm0
  mulsd  %xmm11,%xmm0
  subsd  %xmm0,%xmm3
  movapd %xmm1,%xmm0
  mulsd  %xmm10,%xmm0
  movapd %xmm3,%xmm5
  mulsd  %xmm3,%xmm5
  subsd  %xmm0,%xmm6
  movapd %xmm4,%xmm0
  mulsd  %xmm4,%xmm0
  addsd  %xmm5,%xmm0
  movapd %xmm6,%xmm5
  mulsd  %xmm6,%xmm5
  addsd  %xmm5,%xmm0
  pxor   %xmm5,%xmm5
  ucomisd %xmm0,%xmm5
  ja     L240
  sqrtsd %xmm0,%xmm0
L443:
  ucomisd %xmm5,%xmm0
  jp     L360
  je     L139
L360:
  divsd  %xmm0,%xmm4
  movapd %xmm8,%xmm9
  mulsd  %xmm10,%xmm9
  divsd  %xmm0,%xmm3
  divsd  %xmm0,%xmm6
  movapd %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm9
  movapd %xmm13,%xmm0
  mulsd  %xmm11,%xmm0
  addsd  %xmm0,%xmm9
  comisd %xmm9,%xmm5
  jbe    L444
  xorpd  D63(%rip),%xmm9
L444:
  movsd  D126(%rip),%xmm14
  addsd  %xmm9,%xmm14
  ucomisd %xmm14,%xmm5
  ja     L324
  sqrtsd %xmm14,%xmm14
L86:
  movsd  D126(%rip),%xmm12
  subsd  %xmm9,%xmm12
  ucomisd %xmm12,%xmm5
  ja     L271
  sqrtsd %xmm12,%xmm12
L362:
  addsd  %xmm14,%xmm12
  movapd %xmm1,%xmm0
  movapd %xmm8,%xmm14
  movsd  D135(%rip),%xmm7
  mulsd  %xmm4,%xmm0
  movapd %xmm13,%xmm15
  mulsd  %xmm6,%xmm14
  mulsd  %xmm12,%xmm7
  movapd %xmm8,%xmm12
  mulsd  %xmm3,%xmm12
  mulsd  %xmm4,%xmm15
  movapd %xmm14,%xmm8
  movapd %xmm12,%xmm9
  subsd  %xmm0,%xmm9
  subsd  %xmm15,%xmm8
  ucomisd %xmm5,%xmm9
  jp     L30
  jne    L30
  ucomisd %xmm5,%xmm8
  jp     L131
  jne    L131
  mulsd  %xmm3,%xmm13
  mulsd  %xmm6,%xmm1
  movapd %xmm13,%xmm9
  subsd  %xmm1,%xmm9
  movsd  %xmm1,0x8(%rsp)
  ucomisd %xmm5,%xmm9
  jp     L63
  je     L139
L63:
  subsd  %xmm14,%xmm15
  movq   %xmm4,%rdx
  movapd %xmm0,%xmm1
  movsd  0x8(%rsp),%xmm0
  movapd %xmm12,%xmm14
  movapd %xmm6,%xmm4
  movapd %xmm13,%xmm12
  mov    $0x2,%ebp
  movq   %rdx,%xmm6
  movapd %xmm15,%xmm8
L302:
  subsd  %xmm12,%xmm0
  subsd  %xmm14,%xmm1
  movapd %xmm7,%xmm13
  mulsd  %xmm3,%xmm13
  movapd %xmm7,%xmm12
  mulsd  %xmm4,%xmm12
  divsd  %xmm9,%xmm1
  divsd  %xmm0,%xmm8
  movapd %xmm1,%xmm14
  movapd %xmm1,%xmm15
  mulsd  %xmm1,%xmm14
  divsd  %xmm9,%xmm13
  divsd  %xmm0,%xmm12
  movapd %xmm8,%xmm0
  mulsd  %xmm8,%xmm0
  addsd  %xmm0,%xmm14
  movapd %xmm8,%xmm0
  addsd  D126(%rip),%xmm14
  mulsd  %xmm13,%xmm15
  mulsd  %xmm12,%xmm0
  addsd  %xmm0,%xmm15
  movapd %xmm13,%xmm0
  mulsd  %xmm13,%xmm0
  movapd %xmm15,%xmm9
  mulsd  %xmm15,%xmm9
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm12,%xmm0
  mulsd  %xmm12,%xmm0
  addsd  0x8(%rsp),%xmm0
  subsd  D126(%rip),%xmm0
  mulsd  %xmm14,%xmm0
  subsd  %xmm0,%xmm9
  comisd %xmm9,%xmm5
  ja     L139
  ucomisd %xmm9,%xmm5
  movapd %xmm15,%xmm0
  xorpd  D63(%rip),%xmm0
  movq   %xmm0,%rbx
  ja     L47
  movapd %xmm9,%xmm0
  sqrtsd %xmm0,%xmm0
  movapd %xmm0,%xmm9
  subsd  %xmm15,%xmm9
  movapd %xmm9,%xmm15
  movapd %xmm1,%xmm9
  divsd  %xmm14,%xmm15
  mulsd  %xmm15,%xmm9
  addsd  %xmm13,%xmm9
  movsd  %xmm9,0x8(%rsp)
  movapd %xmm8,%xmm9
  mulsd  %xmm15,%xmm9
  addsd  %xmm12,%xmm9
  movsd  %xmm9,0x20(%rsp)
L372:
  movq   %rbx,%xmm9
  subsd  %xmm0,%xmm9
  divsd  %xmm14,%xmm9
  mulsd  %xmm9,%xmm8
  mulsd  %xmm9,%xmm1
  movapd %xmm8,%xmm14
  addsd  %xmm13,%xmm1
  addsd  %xmm12,%xmm14
  cmp    $0x1,%ebp
  je     L433
  cmp    $0x2,%ebp
  jne    L258
  movq   %xmm4,%rax
  movapd %xmm6,%xmm4
  movq   %rax,%xmm6
  movq   %xmm1,%rax
  movapd %xmm9,%xmm1
  movq   %rax,%xmm9
  mov    0x8(%rsp),%rax
  movsd  %xmm15,0x8(%rsp)
  movq   %rax,%xmm15
L258:
  movapd %xmm1,%xmm0
  movapd %xmm10,%xmm12
  movapd %xmm11,%xmm13
  mulsd  %xmm3,%xmm12
  unpcklpd %xmm14,%xmm0
  movaps %xmm0,0x30(%rsp)
  mulsd  %xmm6,%xmm10
  movapd %xmm2,%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm4,%xmm13
  movapd %xmm12,%xmm8
  subsd  %xmm0,%xmm8
  movsd  %xmm0,0x10(%rsp)
  movapd %xmm10,%xmm0
  subsd  %xmm13,%xmm0
  movsd  %xmm13,0x28(%rsp)
  ucomisd %xmm5,%xmm8
  movapd %xmm0,%xmm13
  jp     L474
  jne    L474
  ucomisd %xmm5,%xmm0
  jp     L2
  jne    L2
  mulsd  %xmm3,%xmm11
  mulsd  %xmm6,%xmm2
  movapd %xmm11,%xmm8
  subsd  %xmm2,%xmm8
  movapd %xmm2,%xmm0
  ucomisd %xmm5,%xmm8
  jp     L9
  je     L139
L9:
  movsd  0x28(%rsp),%xmm13
  movsd  0x10(%rsp),%xmm2
  movapd %xmm6,%xmm4
  movsd  %xmm0,0x10(%rsp)
  mov    $0x2,%ebp
  subsd  %xmm10,%xmm13
  movapd %xmm12,%xmm10
  movapd %xmm11,%xmm12
L137:
  movsd  0x10(%rsp),%xmm0
  subsd  %xmm10,%xmm2
  movapd %xmm13,%xmm6
  mulsd  %xmm7,%xmm3
  subsd  %xmm12,%xmm0
  mulsd  %xmm7,%xmm4
  divsd  %xmm8,%xmm2
  divsd  %xmm0,%xmm6
  movapd %xmm2,%xmm11
  mulsd  %xmm2,%xmm11
  divsd  %xmm8,%xmm3
  movapd %xmm2,%xmm8
  divsd  %xmm0,%xmm4
  movapd %xmm6,%xmm0
  mulsd  %xmm6,%xmm0
  addsd  %xmm0,%xmm11
  movapd %xmm6,%xmm0
  addsd  D126(%rip),%xmm11
  mulsd  %xmm3,%xmm8
  mulsd  %xmm4,%xmm0
  movapd %xmm4,%xmm7
  mulsd  %xmm4,%xmm7
  addsd  %xmm0,%xmm8
  movapd %xmm3,%xmm0
  mulsd  %xmm3,%xmm0
  movapd %xmm8,%xmm12
  mulsd  %xmm8,%xmm12
  addsd  %xmm7,%xmm0
  subsd  D126(%rip),%xmm0
  mulsd  %xmm11,%xmm0
  subsd  %xmm0,%xmm12
  comisd %xmm12,%xmm5
  ja     L139
  ucomisd %xmm12,%xmm5
  movapd %xmm8,%xmm13
  xorpd  D63(%rip),%xmm13
  ja     L351
  sqrtsd %xmm12,%xmm12
  movapd %xmm6,%xmm10
  movapd %xmm12,%xmm7
  subsd  %xmm8,%xmm7
  movapd %xmm2,%xmm8
  divsd  %xmm11,%xmm7
  mulsd  %xmm7,%xmm8
  mulsd  %xmm7,%xmm10
  addsd  %xmm3,%xmm8
  addsd  %xmm4,%xmm10
L169:
  movapd %xmm13,%xmm0
  subsd  %xmm12,%xmm0
  divsd  %xmm11,%xmm0
  mulsd  %xmm0,%xmm2
  mulsd  %xmm0,%xmm6
  addsd  %xmm3,%xmm2
  addsd  %xmm4,%xmm6
  cmp    $0x1,%ebp
  je     L275
  cmp    $0x2,%ebp
  jne    L92
  movq   %xmm2,%rax
  movapd %xmm0,%xmm2
  movq   %rax,%xmm0
  movq   %xmm8,%rax
  movapd %xmm7,%xmm8
  movq   %rax,%xmm7
L92:
  movapd %xmm2,%xmm4
  movsd  0x20(%rsp),%xmm3
  unpcklpd %xmm6,%xmm4
  movaps %xmm4,0x10(%rsp)
  movsd  0x8(%rsp),%xmm4
  mulsd  %xmm10,%xmm3
  mulsd  %xmm8,%xmm4
  addsd  %xmm3,%xmm4
  movapd %xmm15,%xmm3
  mulsd  %xmm7,%xmm3
  addsd  %xmm3,%xmm4
  comisd %xmm4,%xmm5
  jbe    L120
  xorpd  D63(%rip),%xmm4
L120:
  movsd  0x20(%rsp),%xmm11
  movsd  0x8(%rsp),%xmm3
  mulsd  %xmm6,%xmm11
  mulsd  %xmm2,%xmm3
  addsd  %xmm11,%xmm3
  movapd %xmm15,%xmm11
  mulsd  %xmm0,%xmm11
  addsd  %xmm11,%xmm3
  comisd %xmm3,%xmm5
  jbe    L68
  xorpd  D63(%rip),%xmm3
L68:
  movapd %xmm14,%xmm12
  movapd %xmm1,%xmm11
  mulsd  %xmm10,%xmm12
  mulsd  %xmm8,%xmm11
  addsd  %xmm12,%xmm11
  movapd %xmm9,%xmm12
  mulsd  %xmm7,%xmm12
  addsd  %xmm12,%xmm11
  comisd %xmm11,%xmm5
  jbe    L173
  xorpd  D63(%rip),%xmm11
L173:
  movapd %xmm14,%xmm13
  movapd %xmm1,%xmm12
  mulsd  %xmm6,%xmm13
  mulsd  %xmm2,%xmm12
  addsd  %xmm13,%xmm12
  movapd %xmm9,%xmm13
  mulsd  %xmm0,%xmm13
  addsd  %xmm13,%xmm12
  comisd %xmm12,%xmm5
  jbe    L205
  xorpd  D63(%rip),%xmm12
L205:
  comisd %xmm4,%xmm3
  jbe    L89
  comisd %xmm4,%xmm11
  jbe    L259
  comisd %xmm4,%xmm12
  ja     L127
L445:
  movsd  %xmm1,(%rdi)
  movsd  %xmm14,0x8(%rdi)
  movsd  %xmm9,0x10(%rdi)
L485:
  movsd  %xmm2,0x18(%rdi)
  xor    %eax,%eax
  movsd  %xmm6,0x20(%rdi)
  movsd  %xmm0,0x28(%rdi)
L292:
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L30:
  xor    %ebp,%ebp
L53:
  mulsd  %xmm6,%xmm1
  movapd %xmm13,%xmm14
  mulsd  %xmm3,%xmm14
  jmp    L302
  nopl   (%rax)
L474:
  xor    %ebp,%ebp
L59:
  mulsd  %xmm6,%xmm2
  movapd %xmm11,%xmm10
  mulsd  %xmm3,%xmm10
  jmp    L137
  nopl   (%rax)
L89:
  comisd %xmm3,%xmm11
  jbe    L104
  comisd %xmm3,%xmm12
  jbe    L445
  movsd  0x8(%rsp),%xmm7
  movsd  %xmm15,0x10(%rdi)
  xor    %eax,%eax
  movsd  %xmm2,0x18(%rdi)
  movsd  %xmm7,(%rdi)
  movsd  0x20(%rsp),%xmm7
  movsd  %xmm6,0x20(%rdi)
  movsd  %xmm7,0x8(%rdi)
  movsd  %xmm0,0x28(%rdi)
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L433:
  movq   %xmm6,%rax
  movapd %xmm3,%xmm6
  movq   %rax,%xmm3
  movq   %xmm9,%rax
  movapd %xmm14,%xmm9
  movq   %rax,%xmm14
  movq   %xmm15,%rax
  movsd  0x20(%rsp),%xmm15
  mov    %rax,0x20(%rsp)
  jmp    L258
  nopl   0x0(%rax,%rax,1)
L275:
  movq   %xmm0,%rax
  movapd %xmm6,%xmm0
  movq   %rax,%xmm6
  movq   %xmm7,%rax
  movapd %xmm10,%xmm7
  movq   %rax,%xmm10
  jmp    L92
  nopw   0x0(%rax,%rax,1)
L131:
  movq   %xmm9,%rax
  movapd %xmm8,%xmm9
  movapd %xmm15,%xmm0
  mov    $0x1,%ebp
  movq   %rax,%xmm8
  movq   %xmm3,%rax
  movapd %xmm6,%xmm3
  movq   %rax,%xmm6
  movq   %xmm1,%rax
  movapd %xmm14,%xmm12
  movapd %xmm13,%xmm1
  movq   %rax,%xmm13
  jmp    L53
L2:
  movq   %xmm8,%rdx
  movsd  0x28(%rsp),%xmm0
  movapd %xmm13,%xmm8
  movapd %xmm10,%xmm12
  movq   %rdx,%xmm13
  movq   %xmm3,%rdx
  movapd %xmm6,%xmm3
  mov    $0x1,%ebp
  movq   %rdx,%xmm6
  movq   %xmm2,%rdx
  movsd  %xmm0,0x10(%rsp)
  movapd %xmm11,%xmm2
  movq   %rdx,%xmm11
  jmp    L59
  nopw   0x0(%rax,%rax,1)
L104:
  comisd %xmm11,%xmm12
  jbe    L334
  movsd  %xmm1,(%rdi)
  movsd  %xmm14,0x8(%rdi)
  movsd  %xmm9,0x10(%rdi)
L33:
  movsd  %xmm8,0x18(%rdi)
  xor    %eax,%eax
  movsd  %xmm10,0x20(%rdi)
  movsd  %xmm7,0x28(%rdi)
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L259:
  comisd %xmm11,%xmm12
  movsd  %xmm1,(%rdi)
  movsd  %xmm14,0x8(%rdi)
  movsd  %xmm9,0x10(%rdi)
  jbe    L485
  jmp    L33
  nopl   (%rax)
L334:
  movapd 0x30(%rsp),%xmm7
  movsd  %xmm9,0x10(%rdi)
  xor    %eax,%eax
  movsd  %xmm0,0x28(%rdi)
  movups %xmm7,(%rdi)
  movapd 0x10(%rsp),%xmm7
  movups %xmm7,0x18(%rdi)
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L127:
  movsd  0x8(%rsp),%xmm2
  movsd  %xmm15,0x10(%rdi)
  xor    %eax,%eax
  movsd  %xmm8,0x18(%rdi)
  movsd  %xmm2,(%rdi)
  movsd  0x20(%rsp),%xmm2
  movsd  %xmm10,0x20(%rdi)
  movsd  %xmm2,0x8(%rdi)
  movsd  %xmm7,0x28(%rdi)
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L139:
  mov    $0xffffffff,%eax
  jmp    L292
L240:
  mov    %rdi,0x60(%rsp)
  movsd  %xmm6,0x58(%rsp)
  movsd  %xmm3,0x50(%rsp)
  movsd  %xmm4,0x48(%rsp)
  movsd  %xmm11,0x40(%rsp)
  movsd  %xmm2,0x30(%rsp)
  movsd  %xmm10,0x28(%rsp)
  movsd  %xmm13,0x10(%rsp)
  movsd  %xmm1,0x20(%rsp)
  movsd  %xmm8,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x60(%rsp),%rdi
  pxor   %xmm5,%xmm5
  movsd  0x58(%rsp),%xmm6
  movsd  0x50(%rsp),%xmm3
  movsd  0x48(%rsp),%xmm4
  movsd  0x40(%rsp),%xmm11
  movsd  0x30(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm10
  movsd  0x10(%rsp),%xmm13
  movsd  0x20(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm8
  jmp    L443
L271:
  movapd %xmm12,%xmm0
  mov    %rdi,0x68(%rsp)
  movsd  %xmm3,0x60(%rsp)
  movsd  %xmm4,0x58(%rsp)
  movsd  %xmm14,0x50(%rsp)
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm11,0x40(%rsp)
  movsd  %xmm2,0x30(%rsp)
  movsd  %xmm10,0x28(%rsp)
  movsd  %xmm13,0x10(%rsp)
  movsd  %xmm1,0x20(%rsp)
  movsd  %xmm8,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x68(%rsp),%rdi
  pxor   %xmm5,%xmm5
  movsd  0x60(%rsp),%xmm3
  movsd  0x58(%rsp),%xmm4
  movsd  0x50(%rsp),%xmm14
  movapd %xmm0,%xmm12
  movsd  0x48(%rsp),%xmm6
  movsd  0x40(%rsp),%xmm11
  movsd  0x30(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm10
  movsd  0x10(%rsp),%xmm13
  movsd  0x20(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm8
  jmp    L362
L324:
  movapd %xmm14,%xmm0
  mov    %rdi,0x68(%rsp)
  movsd  %xmm3,0x60(%rsp)
  movsd  %xmm9,0x58(%rsp)
  movsd  %xmm4,0x50(%rsp)
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm11,0x40(%rsp)
  movsd  %xmm2,0x30(%rsp)
  movsd  %xmm10,0x28(%rsp)
  movsd  %xmm13,0x10(%rsp)
  movsd  %xmm1,0x20(%rsp)
  movsd  %xmm8,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x68(%rsp),%rdi
  pxor   %xmm5,%xmm5
  movsd  0x60(%rsp),%xmm3
  movsd  0x58(%rsp),%xmm9
  movsd  0x50(%rsp),%xmm4
  movapd %xmm0,%xmm14
  movsd  0x48(%rsp),%xmm6
  movsd  0x40(%rsp),%xmm11
  movsd  0x30(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm10
  movsd  0x10(%rsp),%xmm13
  movsd  0x20(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm8
  jmp    L86
L47:
  movapd %xmm9,%xmm0
  movsd  %xmm6,0x78(%rsp)
  mov    %rdi,0xa0(%rsp)
  movsd  %xmm3,0x98(%rsp)
  movsd  %xmm7,0x88(%rsp)
  movsd  %xmm4,0x80(%rsp)
  movsd  %xmm11,0x70(%rsp)
  movsd  %xmm2,0x68(%rsp)
  movsd  %xmm10,0x60(%rsp)
  movsd  %xmm15,0x30(%rsp)
  movsd  %xmm14,0x28(%rsp)
  movsd  %xmm12,0x90(%rsp)
  movsd  %xmm8,0x10(%rsp)
  movsd  %xmm13,0x20(%rsp)
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm9,0x58(%rsp)
  call   <sqrt@plt>
  movsd  0x30(%rsp),%xmm15
  movsd  0x28(%rsp),%xmm14
  movsd  0x8(%rsp),%xmm1
  movsd  0x20(%rsp),%xmm13
  subsd  %xmm15,%xmm0
  movsd  0x10(%rsp),%xmm8
  movsd  0x90(%rsp),%xmm12
  movsd  %xmm14,0x50(%rsp)
  movsd  0x58(%rsp),%xmm9
  movsd  %xmm1,0x48(%rsp)
  movsd  %xmm13,0x40(%rsp)
  divsd  %xmm14,%xmm0
  movsd  %xmm8,0x30(%rsp)
  movsd  %xmm12,0x10(%rsp)
  movapd %xmm0,%xmm15
  movapd %xmm1,%xmm0
  mulsd  %xmm15,%xmm0
  movsd  %xmm15,0x28(%rsp)
  addsd  %xmm13,%xmm0
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm8,%xmm0
  mulsd  %xmm15,%xmm0
  addsd  %xmm12,%xmm0
  movsd  %xmm0,0x20(%rsp)
  movapd %xmm9,%xmm0
  call   <sqrt@plt>
  movsd  0x78(%rsp),%xmm6
  pxor   %xmm5,%xmm5
  mov    0xa0(%rsp),%rdi
  movsd  0x98(%rsp),%xmm3
  movsd  0x70(%rsp),%xmm11
  movsd  0x88(%rsp),%xmm7
  movsd  0x68(%rsp),%xmm2
  movsd  0x80(%rsp),%xmm4
  movsd  0x60(%rsp),%xmm10
  movsd  0x50(%rsp),%xmm14
  movsd  0x48(%rsp),%xmm1
  movsd  0x40(%rsp),%xmm13
  movsd  0x30(%rsp),%xmm8
  movsd  0x28(%rsp),%xmm15
  movsd  0x10(%rsp),%xmm12
  jmp    L372
L351:
  movapd %xmm12,%xmm0
  movsd  %xmm1,0x78(%rsp)
  mov    %rdi,0xa8(%rsp)
  movsd  %xmm13,0xa0(%rsp)
  movsd  %xmm15,0x98(%rsp)
  movsd  %xmm14,0x88(%rsp)
  movsd  %xmm9,0x80(%rsp)
  movsd  %xmm8,0x50(%rsp)
  movsd  %xmm11,0x48(%rsp)
  movsd  %xmm4,0x90(%rsp)
  movsd  %xmm6,0x40(%rsp)
  movsd  %xmm3,0x28(%rsp)
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm12,0x70(%rsp)
  call   <sqrt@plt>
  movsd  0x50(%rsp),%xmm8
  movsd  0x48(%rsp),%xmm11
  movapd %xmm0,%xmm7
  movsd  0x10(%rsp),%xmm2
  movsd  0x40(%rsp),%xmm6
  subsd  %xmm8,%xmm7
  movsd  0x28(%rsp),%xmm3
  movsd  0x90(%rsp),%xmm4
  movsd  %xmm11,0x68(%rsp)
  movapd %xmm2,%xmm8
  movapd %xmm6,%xmm10
  movsd  0x70(%rsp),%xmm12
  movsd  %xmm2,0x60(%rsp)
  movsd  %xmm3,0x58(%rsp)
  divsd  %xmm11,%xmm7
  movapd %xmm12,%xmm0
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm4,0x28(%rsp)
  mulsd  %xmm7,%xmm8
  movsd  %xmm7,0x40(%rsp)
  mulsd  %xmm7,%xmm10
  addsd  %xmm3,%xmm8
  addsd  %xmm4,%xmm10
  movsd  %xmm8,0x50(%rsp)
  movsd  %xmm10,0x10(%rsp)
  call   <sqrt@plt>
  movsd  0x78(%rsp),%xmm1
  pxor   %xmm5,%xmm5
  mov    0xa8(%rsp),%rdi
  movsd  0xa0(%rsp),%xmm13
  movsd  0x60(%rsp),%xmm2
  movapd %xmm0,%xmm12
  movsd  0x98(%rsp),%xmm15
  movsd  0x68(%rsp),%xmm11
  movsd  0x88(%rsp),%xmm14
  movsd  0x58(%rsp),%xmm3
  movsd  0x80(%rsp),%xmm9
  movsd  0x50(%rsp),%xmm8
  movsd  0x48(%rsp),%xmm6
  movsd  0x40(%rsp),%xmm7
  movsd  0x28(%rsp),%xmm4
  movsd  0x10(%rsp),%xmm10
  jmp    L169
```

tool_calls: name: unpack_data
arguments: data_tag: D63
datatype: f32[4]
name: unpack_data
arguments: data_tag: D126
datatype: f64
name: unpack_data
arguments: data_tag: D135
datatype: f64

tool: {"D63": [0.0,-0.0,0.0,0.0]}

tool: D126: 1

tool: D135: 0.5

assistant: ```c
int check_rotation(double rot[2][3]) {
  double v1[3], v2[3], v3[3];
  double ca, cb, k1, k2, k3, k4;
  double a, b, c, d;
  double p1, q1, r1;
  double p2, q2, r2;
  double p3, q3, r3;
  double p4, q4, r4;
  double w;
  double e1, e2, e3, e4;
  int f;
  v1[0] = rot[0][0];
  v1[1] = rot[0][1];
  v1[2] = rot[0][2];
  v2[0] = rot[1][0];
  v2[1] = rot[1][1];
  v2[2] = rot[1][2];
  v3[0] = v1[1] * v2[2] - v1[2] * v2[1];
  v3[1] = v1[2] * v2[0] - v1[0] * v2[2];
  v3[2] = v1[0] * v2[1] - v1[1] * v2[0];
  w = sqrt(v3[0] * v3[0] + v3[1] * v3[1] + v3[2] * v3[2]);
  if (w == 0.0)
    return -1;
  v3[0] /= w;
  v3[1] /= w;
  v3[2] /= w;
  cb = v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
  if (cb < 0)
    cb *= -1.0;
  ca = (sqrt(cb + 1.0) + sqrt(1.0 - cb)) * 0.5;
  if (v3[1] * v1[0] - v1[1] * v3[0] != 0.0) {
    f = 0;
  } else {
    if (v3[2] * v1[0] - v1[2] * v3[0] != 0.0) {
      w = v1[1];
      v1[1] = v1[2];
      v1[2] = w;
      w = v3[1];
      v3[1] = v3[2];
      v3[2] = w;
      f = 1;
    } else {
      w = v1[0];
      v1[0] = v1[2];
      v1[2] = w;
      w = v3[0];
      v3[0] = v3[2];
      v3[2] = w;
      f = 2;
    }
  }
  if (v3[1] * v1[0] - v1[1] * v3[0] == 0.0)
    return -1;
  k1 = (v1[1] * v3[2] - v3[1] * v1[2]) / (v3[1] * v1[0] - v1[1] * v3[0]);
  k2 = (v3[1] * ca) / (v3[1] * v1[0] - v1[1] * v3[0]);
  k3 = (v1[0] * v3[2] - v3[0] * v1[2]) / (v3[0] * v1[1] - v1[0] * v3[1]);
  k4 = (v3[0] * ca) / (v3[0] * v1[1] - v1[0] * v3[1]);
  a = k1 * k1 + k3 * k3 + 1;
  b = k1 * k2 + k3 * k4;
  c = k2 * k2 + k4 * k4 - 1;
  d = b * b - a * c;
  if (d < 0)
    return -1;
  r1 = (-b + sqrt(d)) / a;
  p1 = k1 * r1 + k2;
  q1 = k3 * r1 + k4;
  r2 = (-b - sqrt(d)) / a;
  p2 = k1 * r2 + k2;
  q2 = k3 * r2 + k4;
  if (f == 1) {
    w = q1;
    q1 = r1;
    r1 = w;
    w = q2;
    q2 = r2;
    r2 = w;
    w = v1[1];
    v1[1] = v1[2];
    v1[2] = w;
    w = v3[1];
    v3[1] = v3[2];
    v3[2] = w;
    f = 0;
  }
  if (f == 2) {
    w = p1;
    p1 = r1;
    r1 = w;
    w = p2;
    p2 = r2;
    r2 = w;
    w = v1[0];
    v1[0] = v1[2];
    v1[2] = w;
    w = v3[0];
    v3[0] = v3[2];
    v3[2] = w;
    f = 0;
  }
  if (v3[1] * v2[0] - v2[1] * v3[0] != 0.0) {
    f = 0;
  } else {
    if (v3[2] * v2[0] - v2[2] * v3[0] != 0.0) {
      w = v2[1];
      v2[1] = v2[2];
      v2[2] = w;
      w = v3[1];
      v3[1] = v3[2];
      v3[2] = w;
      f = 1;
    } else {
      w = v2[0];
      v2[0] = v2[2];
      v2[2] = w;
      w = v3[0];
      v3[0] = v3[2];
      v3[2] = w;
      f = 2;
    }
  }
  if (v3[1] * v2[0] - v2[1] * v3[0] == 0.0)
    return -1;
  k1 = (v2[1] * v3[2] - v3[1] * v2[2]) / (v3[1] * v2[0] - v2[1] * v3[0]);
  k2 = (v3[1] * ca) / (v3[1] * v2[0] - v2[1] * v3[0]);
  k3 = (v2[0] * v3[2] - v3[0] * v2[2]) / (v3[0] * v2[1] - v2[0] * v3[1]);
  k4 = (v3[0] * ca) / (v3[0] * v2[1] - v2[0] * v3[1]);
  a = k1 * k1 + k3 * k3 + 1;
  b = k1 * k2 + k3 * k4;
  c = k2 * k2 + k4 * k4 - 1;
  d = b * b - a * c;
  if (d < 0)
    return -1;
  r3 = (-b + sqrt(d)) / a;
  p3 = k1 * r3 + k2;
  q3 = k3 * r3 + k4;
  r4 = (-b - sqrt(d)) / a;
  p4 = k1 * r4 + k2;
  q4 = k3 * r4 + k4;
  if (f == 1) {
    w = q3;
    q3 = r3;
    r3 = w;
    w = q4;
    q4 = r4;
    r4 = w;
    w = v2[1];
    v2[1] = v2[2];
    v2[2] = w;
    w = v3[1];
    v3[1] = v3[2];
    v3[2] = w;
    f = 0;
  }
  if (f == 2) {
    w = p3;
    p3 = r3;
    r3 = w;
    w = p4;
    p4 = r4;
    r4 = w;
    w = v2[0];
    v2[0] = v2[2];
    v2[2] = w;
    w = v3[0];
    v3[0] = v3[2];
    v3[2] = w;
    f = 0;
  }
  e1 = p1 * p3 + q1 * q3 + r1 * r3;
  if (e1 < 0)
    e1 = -e1;
  e2 = p1 * p4 + q1 * q4 + r1 * r4;
  if (e2 < 0)
    e2 = -e2;
  e3 = p2 * p3 + q2 * q3 + r2 * r3;
  if (e3 < 0)
    e3 = -e3;
  e4 = p2 * p4 + q2 * q4 + r2 * r4;
  if (e4 < 0)
    e4 = -e4;
  if (e1 < e2) {
    if (e1 < e3) {
      if (e1 < e4) {
        rot[0][0] = p1;
        rot[0][1] = q1;
        rot[0][2] = r1;
        rot[1][0] = p3;
        rot[1][1] = q3;
        rot[1][2] = r3;
      } else {
        rot[0][0] = p2;
        rot[0][1] = q2;
        rot[0][2] = r2;
        rot[1][0] = p4;
        rot[1][1] = q4;
        rot[1][2] = r4;
      }
    } else {
      if (e3 < e4) {
        rot[0][0] = p2;
        rot[0][1] = q2;
        rot[0][2] = r2;
        rot[1][0] = p3;
        rot[1][1] = q3;
        rot[1][2] = r3;
      } else {
        rot[0][0] = p2;
        rot[0][1] = q2;
        rot[0][2] = r2;
        rot[1][0] = p4;
        rot[1][1] = q4;
        rot[1][2] = r4;
      }
    }
  } else {
    if (e2 < e3) {
      if (e2 < e4) {
        rot[0][0] = p1;
        rot[0][1] = q1;
        rot[0][2] = r1;
        rot[1][0] = p4;
        rot[1][1] = q4;
        rot[1][2] = r4;
      } else {
        rot[0][0] = p2;
        rot[0][1] = q2;
        rot[0][2] = r2;
        rot[1][0] = p4;
        rot[1][1] = q4;
        rot[1][2] = r4;
      }
    } else {
      if (e3 < e4) {
        rot[0][0] = p2;
        rot[0][1] = q2;
        rot[0][2] = r2;
        rot[1][0] = p3;
        rot[1][1] = q3;
        rot[1][2] = r3;
      } else {
        rot[0][0] = p2;
        rot[0][1] = q2;
        rot[0][2] = r2;
        rot[1][0] = p4;
        rot[1][1] = q4;
        rot[1][2] = r4;
      }
    }
  }
  return 0;
}
```