#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double atan2(double, double);
int /*<<< orphan*/ rotation_matrix_c(double *, double, double *);
double sqrt(double);
void get_closer_rotation_matrix_c(double *TH, double *point, double *M,
                                  double *F, double *out_rot_mat) {
  int i, j;
  double sum1 = 0;
  double TH_norm[3];
  double d1[3];
  double R[9], O[9];
  for (i = 0; i < 3; i++)
    sum1 += TH[i] * TH[i];
  sum1 = sqrt(sum1);
  for (i = 0; i < 3; i++)
    TH_norm[i] = TH[i] / sum1;
  for (i = 0; i < 3; i++) {
    sum1 = 0;
    for (j = 0; j < 3; j++) {
      sum1 += (M[i * 3 + j] - point[j]) * TH_norm[j];
    }
    d1[i] = sum1;
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      O[i * 3 + j] = TH_norm[j] * d1[i] + point[j];
      R[i * 3 + j] = M[i * 3 + j] - O[i * 3 + j];
    }
  }
  double temp_fs_sum = 0;
  double temp_fr_sum = 0;
  double n3 = 0, d3 = 0, a, r_row_sums[3], s_row_sums[3];
  double S[9], F1[9];
  for (i = 0; i < 3; i++) {
    S[3 * i + 0] = R[3 * i + 1] * TH[2] - R[3 * i + 2] * TH[1];
    S[3 * i + 1] = R[3 * i + 2] * TH[0] - R[3 * i + 0] * TH[2];
    S[3 * i + 2] = R[3 * i + 0] * TH[1] - R[3 * i + 1] * TH[0];
    s_row_sums[i] = 0;
    r_row_sums[i] = 0;
    temp_fs_sum = 0;
    temp_fr_sum = 0;
    for (j = 0; j < 3; j++) {
      s_row_sums[i] += S[3 * i + j] * S[3 * i + j];
      r_row_sums[i] += R[3 * i + j] * R[3 * i + j];
      F1[3 * i + j] = F[3 * i + j] - O[3 * i + j];
    }
    s_row_sums[i] = sqrt(s_row_sums[i]);
    r_row_sums[i] = sqrt(r_row_sums[i]);
    for (j = 0; j < 3; j++) {
      S[3 * i + j] /= s_row_sums[i];
      R[3 * i + j] /= r_row_sums[i];
      temp_fs_sum += F1[3 * i + j] * S[3 * i + j];
      temp_fr_sum += F1[3 * i + j] * R[3 * i + j];
    }
    n3 += r_row_sums[i] * temp_fs_sum;
    d3 += r_row_sums[i] * temp_fr_sum;
  }
  a = atan2(n3, d3);
  a /= 3.;
  rotation_matrix_c(TH, a, out_rot_mat);
}


x86 assembly (clang, -O0):
<get_closer_rotation_matrix_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11a2 <get_closer_rotation_matrix_c+0x72>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115e <get_closer_rotation_matrix_c+0x2e>
movsd  -0x38(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11ec <get_closer_rotation_matrix_c+0xbc>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x38(%rbp),%xmm0
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b8 <get_closer_rotation_matrix_c+0x88>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    127d <get_closer_rotation_matrix_c+0x14d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    1260 <get_closer_rotation_matrix_c+0x130>
mov    -0x18(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x30(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    120c <get_closer_rotation_matrix_c+0xdc>
movsd  -0x38(%rbp),%xmm0
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f3 <get_closer_rotation_matrix_c+0xc3>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1332 <get_closer_rotation_matrix_c+0x202>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    131f <get_closer_rotation_matrix_c+0x1ef>
movslq -0x30(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movslq -0x2c(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  %xmm0,-0x110(%rbp,%rax,8)
ff ff
mov    -0x18(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
subsd  -0x110(%rbp,%rax,8),%xmm0
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  %xmm0,-0xc0(%rbp,%rax,8)
ff ff
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1295 <get_closer_rotation_matrix_c+0x165>
jmp    1324 <get_closer_rotation_matrix_c+0x1f4>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1284 <get_closer_rotation_matrix_c+0x154>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1747 <get_closer_rotation_matrix_c+0x617>
imul   $0x3,-0x2c(%rbp),%eax
add    $0x1,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
imul   $0x3,-0x2c(%rbp),%eax
add    $0x2,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm1
ff ff
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    $0x0,%eax
cltq
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    $0x2,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
imul   $0x3,-0x2c(%rbp),%eax
add    $0x0,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    $0x1,%eax
cltq
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    $0x0,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
imul   $0x3,-0x2c(%rbp),%eax
add    $0x1,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm1
ff ff
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    $0x2,%eax
cltq
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
movslq -0x2c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x170(%rbp,%rax,8)
ff ff
movslq -0x2c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x150(%rbp,%rax,8)
ff ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    15b2 <get_closer_rotation_matrix_c+0x482>
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0x1c0(%rbp,%rax,8),%xmm0
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0x1c0(%rbp,%rax,8),%xmm2
ff ff
movslq -0x2c(%rbp),%rax
movsd  -0x170(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x170(%rbp,%rax,8)
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
movslq -0x2c(%rbp),%rax
movsd  -0x150(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x150(%rbp,%rax,8)
ff ff
mov    -0x20(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
subsd  -0x110(%rbp,%rax,8),%xmm0
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  %xmm0,-0x210(%rbp,%rax,8)
ff ff
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14df <get_closer_rotation_matrix_c+0x3af>
movslq -0x2c(%rbp),%rax
movsd  -0x170(%rbp,%rax,8),%xmm0
ff ff
call   1040 <sqrt@plt>
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0x170(%rbp,%rax,8)
ff ff
movslq -0x2c(%rbp),%rax
movsd  -0x150(%rbp,%rax,8),%xmm0
ff ff
call   1040 <sqrt@plt>
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0x150(%rbp,%rax,8)
ff ff
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    16df <get_closer_rotation_matrix_c+0x5af>
movslq -0x2c(%rbp),%rax
movsd  -0x170(%rbp,%rax,8),%xmm1
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0x1c0(%rbp,%rax,8),%xmm0
ff ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
movslq -0x2c(%rbp),%rax
movsd  -0x150(%rbp,%rax,8),%xmm1
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp,%rax,8)
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0x210(%rbp,%rax,8),%xmm0
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0x1c0(%rbp,%rax,8),%xmm2
ff ff
movsd  -0x118(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0x210(%rbp,%rax,8),%xmm0
ff ff
imul   $0x3,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
movsd  -0x120(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    15f7 <get_closer_rotation_matrix_c+0x4c7>
movslq -0x2c(%rbp),%rax
movsd  -0x150(%rbp,%rax,8),%xmm0
ff ff
movsd  -0x118(%rbp),%xmm2
ff
movsd  -0x128(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movslq -0x2c(%rbp),%rax
movsd  -0x150(%rbp,%rax,8),%xmm0
ff ff
movsd  -0x120(%rbp),%xmm2
ff
movsd  -0x130(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1365 <get_closer_rotation_matrix_c+0x235>
movsd  -0x128(%rbp),%xmm0
ff
movsd  -0x130(%rbp),%xmm1
ff
call   1030 <atan2@plt>
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0x138(%rbp),%xmm0
ff
movsd  0x88c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x138(%rbp)
ff
mov    -0x8(%rbp),%rdi
movsd  -0x138(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rsi
call   1050 <rotation_matrix_c@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_closer_rotation_matrix_c>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbp
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm0
xorpd  %xmm8,%xmm8
addsd  %xmm8,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm8,%xmm0
jb     1189 <get_closer_rotation_matrix_c+0x59>
sqrtsd %xmm0,%xmm0
jmp    1193 <get_closer_rotation_matrix_c+0x63>
call   1040 <sqrt@plt>
xorpd  %xmm8,%xmm8
movupd 0x0(%rbp),%xmm15
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm15
movsd  0x10(%rbp),%xmm1
divsd  %xmm0,%xmm1
movupd 0x0(%r13),%xmm14
movapd %xmm15,%xmm3
unpckhpd %xmm15,%xmm3
movsd  0x10(%r13),%xmm12
movupd (%r12),%xmm11
movupd 0x10(%r12),%xmm10
movupd 0x20(%r12),%xmm9
movupd 0x30(%r12),%xmm7
movapd %xmm10,%xmm2
movsd  %xmm11,%xmm2
movapd %xmm14,%xmm4
unpcklpd %xmm14,%xmm4
subpd  %xmm4,%xmm2
movapd %xmm15,%xmm4
unpcklpd %xmm15,%xmm4
mulpd  %xmm2,%xmm4
xorpd  %xmm0,%xmm0
addpd  %xmm0,%xmm4
movapd %xmm11,%xmm6
shufpd $0x1,%xmm9,%xmm6
movapd %xmm14,%xmm2
unpckhpd %xmm14,%xmm2
subpd  %xmm2,%xmm6
mulpd  %xmm3,%xmm6
addpd  %xmm4,%xmm6
movapd %xmm9,%xmm5
movsd  %xmm10,%xmm5
movsd  0x40(%r12),%xmm13
movapd %xmm13,%xmm4
subsd  %xmm12,%xmm4
movapd %xmm12,%xmm2
unpcklpd %xmm12,%xmm2
subpd  %xmm2,%xmm5
movapd %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
mulpd  %xmm5,%xmm2
movapd %xmm7,%xmm5
subpd  %xmm14,%xmm5
movapd %xmm5,%xmm0
unpckhpd %xmm5,%xmm5
mulsd  %xmm3,%xmm5
movapd %xmm14,%xmm3
shufpd $0x1,%xmm12,%xmm3
mulsd  %xmm15,%xmm0
addsd  %xmm8,%xmm0
addsd  %xmm0,%xmm5
mulsd  %xmm1,%xmm4
addsd  %xmm5,%xmm4
movapd %xmm1,%xmm0
movapd %xmm15,%xmm5
shufpd $0x1,%xmm1,%xmm5
mulsd  %xmm4,%xmm1
addsd  %xmm12,%xmm1
addpd  %xmm6,%xmm2
movapd %xmm2,%xmm6
unpcklpd %xmm2,%xmm6
mulpd  %xmm15,%xmm6
addpd  %xmm14,%xmm6
movapd %xmm6,0xf0(%rsp)
subpd  %xmm6,%xmm11
movapd %xmm11,0xa0(%rsp)
unpcklpd %xmm15,%xmm0
unpcklpd %xmm14,%xmm12
mulpd  %xmm2,%xmm0
addpd  %xmm12,%xmm0
movapd %xmm0,0x100(%rsp)
subpd  %xmm0,%xmm10
movapd %xmm10,0xb0(%rsp)
unpckhpd %xmm2,%xmm2
mulpd  %xmm5,%xmm2
addpd  %xmm2,%xmm3
movapd %xmm3,0x110(%rsp)
subpd  %xmm3,%xmm9
movapd %xmm9,0xc0(%rsp)
unpcklpd %xmm4,%xmm4
mulpd  %xmm15,%xmm4
addpd  %xmm14,%xmm4
movapd %xmm4,0x120(%rsp)
subpd  %xmm4,%xmm7
movapd %xmm7,0xd0(%rsp)
movsd  %xmm1,0x130(%rsp)
subsd  %xmm1,%xmm13
movsd  %xmm13,0xe0(%rsp)
mov    $0x10,%ebx
xorpd  %xmm1,%xmm1
jmp    145f <get_closer_rotation_matrix_c+0x32f>
nopl   0x0(%rax,%rax,1)
movapd %xmm13,(%rsp)
call   1040 <sqrt@plt>
movapd (%rsp),%xmm13
movapd 0x70(%rsp),%xmm5
movapd 0x80(%rsp),%xmm10
xorpd  %xmm8,%xmm8
movapd 0x90(%rsp),%xmm1
movapd 0x60(%rsp),%xmm9
movapd 0x50(%rsp),%xmm4
movapd 0x40(%rsp),%xmm6
movapd 0x30(%rsp),%xmm7
movapd 0x20(%rsp),%xmm12
movapd 0x10(%rsp),%xmm3
divsd  %xmm13,%xmm7
movapd %xmm0,%xmm11
unpcklpd %xmm0,%xmm11
divpd  %xmm11,%xmm5
unpcklpd %xmm3,%xmm3
movapd %xmm5,%xmm2
unpcklpd %xmm7,%xmm2
mulpd  %xmm3,%xmm2
addpd  0xc0f(%rip),%xmm2
divsd  %xmm13,%xmm4
movupd %xmm5,0x90(%rsp,%rbx,1)
unpcklpd %xmm12,%xmm12
shufpd $0x1,%xmm4,%xmm5
mulpd  %xmm12,%xmm5
addpd  %xmm2,%xmm5
unpcklpd %xmm9,%xmm10
unpcklpd %xmm13,%xmm0
divpd  %xmm0,%xmm10
movlpd %xmm10,0xa0(%rsp,%rbx,1)
unpcklpd %xmm6,%xmm6
mulpd  %xmm10,%xmm6
addpd  %xmm5,%xmm6
mulpd  %xmm11,%xmm6
addpd  %xmm6,%xmm1
add    $0x18,%rbx
cmp    $0x58,%rbx
je     15d0 <get_closer_rotation_matrix_c+0x4a0>
movsd  0x10(%rbp),%xmm0
movsd  0xa0(%rsp,%rbx,1),%xmm10
movsd  0x0(%rbp),%xmm3
movsd  0x8(%rbp),%xmm6
movapd %xmm6,%xmm2
mulsd  %xmm10,%xmm2
movupd 0x90(%rsp,%rbx,1),%xmm5
movapd %xmm5,%xmm7
unpckhpd %xmm5,%xmm7
movapd %xmm7,%xmm11
mulsd  %xmm0,%xmm11
subsd  %xmm2,%xmm11
mulsd  %xmm5,%xmm0
movapd %xmm10,%xmm4
mulsd  %xmm3,%xmm4
subsd  %xmm0,%xmm4
mulsd  %xmm7,%xmm3
mulsd  %xmm5,%xmm6
subsd  %xmm3,%xmm6
movapd %xmm11,%xmm0
mulsd  %xmm11,%xmm0
addsd  %xmm8,%xmm0
movsd  -0x10(%r15,%rbx,1),%xmm9
subsd  0xe0(%rsp,%rbx,1),%xmm9
movsd  -0x8(%r15,%rbx,1),%xmm3
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
subsd  0xe8(%rsp,%rbx,1),%xmm3
addsd  %xmm0,%xmm2
movapd %xmm6,%xmm0
mulsd  %xmm6,%xmm0
addsd  %xmm2,%xmm0
movsd  (%r15,%rbx,1),%xmm2
subsd  0xf0(%rsp,%rbx,1),%xmm2
ucomisd %xmm8,%xmm0
movapd %xmm1,0x90(%rsp)
movapd %xmm10,0x80(%rsp)
movapd %xmm5,0x70(%rsp)
movapd %xmm6,0x60(%rsp)
movapd %xmm4,0x50(%rsp)
movapd %xmm2,0x40(%rsp)
movapd %xmm11,0x30(%rsp)
movapd %xmm3,0x20(%rsp)
movapd %xmm9,0x10(%rsp)
jb     1570 <get_closer_rotation_matrix_c+0x440>
xorps  %xmm13,%xmm13
sqrtsd %xmm0,%xmm13
jmp    1599 <get_closer_rotation_matrix_c+0x469>
cs nopw 0x0(%rax,%rax,1)
movapd %xmm7,(%rsp)
call   1040 <sqrt@plt>
movapd (%rsp),%xmm7
movapd 0x70(%rsp),%xmm5
movapd 0x80(%rsp),%xmm10
xorpd  %xmm8,%xmm8
movapd %xmm0,%xmm13
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
addsd  %xmm8,%xmm0
mulsd  %xmm7,%xmm7
addsd  %xmm0,%xmm7
movapd %xmm10,%xmm0
mulsd  %xmm10,%xmm0
addsd  %xmm7,%xmm0
ucomisd %xmm8,%xmm0
jb     1380 <get_closer_rotation_matrix_c+0x250>
sqrtsd %xmm0,%xmm0
jmp    13a6 <get_closer_rotation_matrix_c+0x276>
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
call   1030 <atan2@plt>
divsd  0xa1b(%rip),%xmm0
mov    %rbp,%rdi
mov    %r14,%rsi
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <rotation_matrix_c@plt>

LLVM IR (-O0):
define void @get_closer_rotation_matrix_c(double* %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca [3 x double]
%15 = alloca [3 x double]
%16 = alloca [9 x double]
%17 = alloca [9 x double]
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca [3 x double]
%24 = alloca [3 x double]
%25 = alloca [9 x double]
%26 = alloca [9 x double]
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
store double 0.000000e+00, double* %13
store i32 0, i32* %11
br label %27
27: ; preds = %43, %5
%28 = load i32, i32* %11
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = load double*, double** %6
%32 = load i32, i32* %11
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load double*, double** %6
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = load double, double* %13
%42 = call double @llvm.fmuladd.f64(double %35, double %40, double %41)
store double %42, double* %13
br label %43
43: ; preds = %30
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
store i32 %45, i32* %11
br label %27
46: ; preds = %27
%47 = load double, double* %13
%48 = call double @sqrt(double %47)
store double %48, double* %13
store i32 0, i32* %11
br label %49
49: ; preds = %63, %46
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 3
br i1 %51, label %52, label %66
52: ; preds = %49
%53 = load double*, double** %6
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = load double, double* %13
%59 = fdiv double %57, %58
%60 = load i32, i32* %11
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 %61
store double %59, double* %62
br label %63
63: ; preds = %52
%64 = load i32, i32* %11
%65 = add nsw i32 %64, 1
store i32 %65, i32* %11
br label %49
66: ; preds = %49
store i32 0, i32* %11
br label %67
67: ; preds = %103, %66
%68 = load i32, i32* %11
%69 = icmp slt i32 %68, 3
br i1 %69, label %70, label %106
70: ; preds = %67
store double 0.000000e+00, double* %13
store i32 0, i32* %12
br label %71
71: ; preds = %95, %70
%72 = load i32, i32* %12
%73 = icmp slt i32 %72, 3
br i1 %73, label %74, label %98
74: ; preds = %71
%75 = load double*, double** %8
%76 = load i32, i32* %11
%77 = mul nsw i32 %76, 3
%78 = load i32, i32* %12
%79 = add nsw i32 %77, %78
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %75, i64 %80
%82 = load double, double* %81
%83 = load double*, double** %7
%84 = load i32, i32* %12
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
%87 = load double, double* %86
%88 = fsub double %82, %87
%89 = load i32, i32* %12
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 %90
%92 = load double, double* %91
%93 = load double, double* %13
%94 = call double @llvm.fmuladd.f64(double %88, double %92, double %93)
store double %94, double* %13
br label %95
95: ; preds = %74
%96 = load i32, i32* %12
%97 = add nsw i32 %96, 1
store i32 %97, i32* %12
br label %71
98: ; preds = %71
%99 = load double, double* %13
%100 = load i32, i32* %11
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %101
store double %99, double* %102
br label %103
103: ; preds = %98
%104 = load i32, i32* %11
%105 = add nsw i32 %104, 1
store i32 %105, i32* %11
br label %67
106: ; preds = %67
store i32 0, i32* %11
br label %107
107: ; preds = %161, %106
%108 = load i32, i32* %11
%109 = icmp slt i32 %108, 3
br i1 %109, label %110, label %164
110: ; preds = %107
store i32 0, i32* %12
br label %111
111: ; preds = %157, %110
%112 = load i32, i32* %12
%113 = icmp slt i32 %112, 3
br i1 %113, label %114, label %160
114: ; preds = %111
%115 = load i32, i32* %12
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 %116
%118 = load double, double* %117
%119 = load i32, i32* %11
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %120
%122 = load double, double* %121
%123 = load double*, double** %7
%124 = load i32, i32* %12
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = call double @llvm.fmuladd.f64(double %118, double %122, double %127)
%129 = load i32, i32* %11
%130 = mul nsw i32 %129, 3
%131 = load i32, i32* %12
%132 = add nsw i32 %130, %131
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [9 x double], [9 x double]* %17, i64 0, i64 %133
store double %128, double* %134
%135 = load double*, double** %8
%136 = load i32, i32* %11
%137 = mul nsw i32 %136, 3
%138 = load i32, i32* %12
%139 = add nsw i32 %137, %138
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %135, i64 %140
%142 = load double, double* %141
%143 = load i32, i32* %11
%144 = mul nsw i32 %143, 3
%145 = load i32, i32* %12
%146 = add nsw i32 %144, %145
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [9 x double], [9 x double]* %17, i64 0, i64 %147
%149 = load double, double* %148
%150 = fsub double %142, %149
%151 = load i32, i32* %11
%152 = mul nsw i32 %151, 3
%153 = load i32, i32* %12
%154 = add nsw i32 %152, %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %155
store double %150, double* %156
br label %157
157: ; preds = %114
%158 = load i32, i32* %12
%159 = add nsw i32 %158, 1
store i32 %159, i32* %12
br label %111
160: ; preds = %111
br label %161
161: ; preds = %160
%162 = load i32, i32* %11
%163 = add nsw i32 %162, 1
store i32 %163, i32* %11
br label %107
164: ; preds = %107
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %21
store i32 0, i32* %11
br label %165
165: ; preds = %415, %164
%166 = load i32, i32* %11
%167 = icmp slt i32 %166, 3
br i1 %167, label %168, label %418
168: ; preds = %165
%169 = load i32, i32* %11
%170 = mul nsw i32 3, %169
%171 = add nsw i32 %170, 1
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %172
%174 = load double, double* %173
%175 = load double*, double** %6
%176 = getelementptr inbounds double, double* %175, i64 2
%177 = load double, double* %176
%178 = load i32, i32* %11
%179 = mul nsw i32 3, %178
%180 = add nsw i32 %179, 2
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %181
%183 = load double, double* %182
%184 = load double*, double** %6
%185 = getelementptr inbounds double, double* %184, i64 1
%186 = load double, double* %185
%187 = fmul double %183, %186
%188 = fneg double %187
%189 = call double @llvm.fmuladd.f64(double %174, double %177, double %188)
%190 = load i32, i32* %11
%191 = mul nsw i32 3, %190
%192 = add nsw i32 %191, 0
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %193
store double %189, double* %194
%195 = load i32, i32* %11
%196 = mul nsw i32 3, %195
%197 = add nsw i32 %196, 2
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %198
%200 = load double, double* %199
%201 = load double*, double** %6
%202 = getelementptr inbounds double, double* %201, i64 0
%203 = load double, double* %202
%204 = load i32, i32* %11
%205 = mul nsw i32 3, %204
%206 = add nsw i32 %205, 0
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %207
%209 = load double, double* %208
%210 = load double*, double** %6
%211 = getelementptr inbounds double, double* %210, i64 2
%212 = load double, double* %211
%213 = fmul double %209, %212
%214 = fneg double %213
%215 = call double @llvm.fmuladd.f64(double %200, double %203, double %214)
%216 = load i32, i32* %11
%217 = mul nsw i32 3, %216
%218 = add nsw i32 %217, 1
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %219
store double %215, double* %220
%221 = load i32, i32* %11
%222 = mul nsw i32 3, %221
%223 = add nsw i32 %222, 0
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %224
%226 = load double, double* %225
%227 = load double*, double** %6
%228 = getelementptr inbounds double, double* %227, i64 1
%229 = load double, double* %228
%230 = load i32, i32* %11
%231 = mul nsw i32 3, %230
%232 = add nsw i32 %231, 1
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %233
%235 = load double, double* %234
%236 = load double*, double** %6
%237 = getelementptr inbounds double, double* %236, i64 0
%238 = load double, double* %237
%239 = fmul double %235, %238
%240 = fneg double %239
%241 = call double @llvm.fmuladd.f64(double %226, double %229, double %240)
%242 = load i32, i32* %11
%243 = mul nsw i32 3, %242
%244 = add nsw i32 %243, 2
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %245
store double %241, double* %246
%247 = load i32, i32* %11
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 %248
store double 0.000000e+00, double* %249
%250 = load i32, i32* %11
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %251
store double 0.000000e+00, double* %252
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store i32 0, i32* %12
br label %253
253: ; preds = %317, %168
%254 = load i32, i32* %12
%255 = icmp slt i32 %254, 3
br i1 %255, label %256, label %320
256: ; preds = %253
%257 = load i32, i32* %11
%258 = mul nsw i32 3, %257
%259 = load i32, i32* %12
%260 = add nsw i32 %258, %259
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %261
%263 = load double, double* %262
%264 = load i32, i32* %11
%265 = mul nsw i32 3, %264
%266 = load i32, i32* %12
%267 = add nsw i32 %265, %266
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %268
%270 = load double, double* %269
%271 = load i32, i32* %11
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 %272
%274 = load double, double* %273
%275 = call double @llvm.fmuladd.f64(double %263, double %270, double %274)
store double %275, double* %273
%276 = load i32, i32* %11
%277 = mul nsw i32 3, %276
%278 = load i32, i32* %12
%279 = add nsw i32 %277, %278
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %280
%282 = load double, double* %281
%283 = load i32, i32* %11
%284 = mul nsw i32 3, %283
%285 = load i32, i32* %12
%286 = add nsw i32 %284, %285
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %287
%289 = load double, double* %288
%290 = load i32, i32* %11
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %291
%293 = load double, double* %292
%294 = call double @llvm.fmuladd.f64(double %282, double %289, double %293)
store double %294, double* %292
%295 = load double*, double** %9
%296 = load i32, i32* %11
%297 = mul nsw i32 3, %296
%298 = load i32, i32* %12
%299 = add nsw i32 %297, %298
%300 = sext i32 %299 to i64
%301 = getelementptr inbounds double, double* %295, i64 %300
%302 = load double, double* %301
%303 = load i32, i32* %11
%304 = mul nsw i32 3, %303
%305 = load i32, i32* %12
%306 = add nsw i32 %304, %305
%307 = sext i32 %306 to i64
%308 = getelementptr inbounds [9 x double], [9 x double]* %17, i64 0, i64 %307
%309 = load double, double* %308
%310 = fsub double %302, %309
%311 = load i32, i32* %11
%312 = mul nsw i32 3, %311
%313 = load i32, i32* %12
%314 = add nsw i32 %312, %313
%315 = sext i32 %314 to i64
%316 = getelementptr inbounds [9 x double], [9 x double]* %26, i64 0, i64 %315
store double %310, double* %316
br label %317
317: ; preds = %256
%318 = load i32, i32* %12
%319 = add nsw i32 %318, 1
store i32 %319, i32* %12
br label %253
320: ; preds = %253
%321 = load i32, i32* %11
%322 = sext i32 %321 to i64
%323 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 %322
%324 = load double, double* %323
%325 = call double @sqrt(double %324)
%326 = load i32, i32* %11
%327 = sext i32 %326 to i64
%328 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 %327
store double %325, double* %328
%329 = load i32, i32* %11
%330 = sext i32 %329 to i64
%331 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %330
%332 = load double, double* %331
%333 = call double @sqrt(double %332)
%334 = load i32, i32* %11
%335 = sext i32 %334 to i64
%336 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %335
store double %333, double* %336
store i32 0, i32* %12
br label %337
337: ; preds = %397, %320
%338 = load i32, i32* %12
%339 = icmp slt i32 %338, 3
br i1 %339, label %340, label %400
340: ; preds = %337
%341 = load i32, i32* %11
%342 = sext i32 %341 to i64
%343 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 %342
%344 = load double, double* %343
%345 = load i32, i32* %11
%346 = mul nsw i32 3, %345
%347 = load i32, i32* %12
%348 = add nsw i32 %346, %347
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %349
%351 = load double, double* %350
%352 = fdiv double %351, %344
store double %352, double* %350
%353 = load i32, i32* %11
%354 = sext i32 %353 to i64
%355 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %354
%356 = load double, double* %355
%357 = load i32, i32* %11
%358 = mul nsw i32 3, %357
%359 = load i32, i32* %12
%360 = add nsw i32 %358, %359
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %361
%363 = load double, double* %362
%364 = fdiv double %363, %356
store double %364, double* %362
%365 = load i32, i32* %11
%366 = mul nsw i32 3, %365
%367 = load i32, i32* %12
%368 = add nsw i32 %366, %367
%369 = sext i32 %368 to i64
%370 = getelementptr inbounds [9 x double], [9 x double]* %26, i64 0, i64 %369
%371 = load double, double* %370
%372 = load i32, i32* %11
%373 = mul nsw i32 3, %372
%374 = load i32, i32* %12
%375 = add nsw i32 %373, %374
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds [9 x double], [9 x double]* %25, i64 0, i64 %376
%378 = load double, double* %377
%379 = load double, double* %18
%380 = call double @llvm.fmuladd.f64(double %371, double %378, double %379)
store double %380, double* %18
%381 = load i32, i32* %11
%382 = mul nsw i32 3, %381
%383 = load i32, i32* %12
%384 = add nsw i32 %382, %383
%385 = sext i32 %384 to i64
%386 = getelementptr inbounds [9 x double], [9 x double]* %26, i64 0, i64 %385
%387 = load double, double* %386
%388 = load i32, i32* %11
%389 = mul nsw i32 3, %388
%390 = load i32, i32* %12
%391 = add nsw i32 %389, %390
%392 = sext i32 %391 to i64
%393 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %392
%394 = load double, double* %393
%395 = load double, double* %19
%396 = call double @llvm.fmuladd.f64(double %387, double %394, double %395)
store double %396, double* %19
br label %397
397: ; preds = %340
%398 = load i32, i32* %12
%399 = add nsw i32 %398, 1
store i32 %399, i32* %12
br label %337
400: ; preds = %337
%401 = load i32, i32* %11
%402 = sext i32 %401 to i64
%403 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %402
%404 = load double, double* %403
%405 = load double, double* %18
%406 = load double, double* %20
%407 = call double @llvm.fmuladd.f64(double %404, double %405, double %406)
store double %407, double* %20
%408 = load i32, i32* %11
%409 = sext i32 %408 to i64
%410 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 %409
%411 = load double, double* %410
%412 = load double, double* %19
%413 = load double, double* %21
%414 = call double @llvm.fmuladd.f64(double %411, double %412, double %413)
store double %414, double* %21
br label %415
415: ; preds = %400
%416 = load i32, i32* %11
%417 = add nsw i32 %416, 1
store i32 %417, i32* %11
br label %165
418: ; preds = %165
%419 = load double, double* %20
%420 = load double, double* %21
%421 = call double @atan2(double %419, double %420)
store double %421, double* %22
%422 = load double, double* %22
%423 = fdiv double %422, 3.000000e+00
store double %423, double* %22
%424 = load double*, double** %6
%425 = load double, double* %22
%426 = load double*, double** %10
%427 = call i32 @rotation_matrix_c(double* %424, double %425, double* %426)
ret void
}

LLVM IR (-O2):
define void @get_closer_rotation_matrix_c(double* %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* %4) {
%6 = alloca [9 x double]
%7 = alloca [9 x double]
%8 = bitcast [9 x double]* %6 to i8*
%9 = bitcast [9 x double]* %7 to i8*
%10 = load double, double* %0
%11 = tail call double @llvm.fmuladd.f64(double %10, double %10, double 0.000000e+00)
%12 = getelementptr inbounds double, double* %0, i64 1
%13 = load double, double* %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double %13, double %11)
%15 = getelementptr inbounds double, double* %0, i64 2
%16 = load double, double* %15
%17 = tail call double @llvm.fmuladd.f64(double %16, double %16, double %14)
%18 = tail call double @sqrt(double %17)
%19 = bitcast double* %0 to <2 x double>*
%20 = load <2 x double>, <2 x double>* %19
%21 = insertelement <2 x double> poison, double %18, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = fdiv <2 x double> %20, %22
%24 = load double, double* %15
%25 = fdiv double %24, %18
%26 = bitcast double* %1 to <2 x double>*
%27 = load <2 x double>, <2 x double>* %26
%28 = extractelement <2 x double> %23, i64 0
%29 = bitcast double* %2 to <2 x double>*
%30 = load <2 x double>, <2 x double>* %29
%31 = extractelement <2 x double> %23, i64 1
%32 = getelementptr inbounds double, double* %2, i64 2
%33 = getelementptr inbounds double, double* %1, i64 2
%34 = load double, double* %33
%35 = bitcast double* %32 to <2 x double>*
%36 = load <2 x double>, <2 x double>* %35
%37 = shufflevector <2 x double> %30, <2 x double> %36, <2 x i32> <i32 0, i32 3>
%38 = shufflevector <2 x double> %27, <2 x double> undef, <2 x i32> zeroinitializer
%39 = fsub <2 x double> %37, %38
%40 = shufflevector <2 x double> %23, <2 x double> undef, <2 x i32> zeroinitializer
%41 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %40, <2 x double> zeroinitializer)
%42 = getelementptr inbounds double, double* %2, i64 4
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = shufflevector <2 x double> %30, <2 x double> %44, <2 x i32> <i32 1, i32 2>
%46 = shufflevector <2 x double> %27, <2 x double> undef, <2 x i32> <i32 1, i32 undef>
%47 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%48 = fsub <2 x double> %45, %47
%49 = shufflevector <2 x double> %23, <2 x double> undef, <2 x i32> <i32 1, i32 undef>
%50 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%51 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %50, <2 x double> %41)
%52 = shufflevector <2 x double> %36, <2 x double> %44, <2 x i32> <i32 0, i32 3>
%53 = insertelement <2 x double> poison, double %34, i64 0
%54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> zeroinitializer
%55 = fsub <2 x double> %52, %54
%56 = insertelement <2 x double> poison, double %25, i64 0
%57 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> zeroinitializer
%58 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %55, <2 x double> %57, <2 x double> %51)
%59 = getelementptr inbounds double, double* %2, i64 6
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = fsub <2 x double> %61, %27
%63 = extractelement <2 x double> %62, i64 0
%64 = tail call double @llvm.fmuladd.f64(double %63, double %28, double 0.000000e+00)
%65 = fsub <2 x double> %61, %27
%66 = extractelement <2 x double> %65, i64 1
%67 = tail call double @llvm.fmuladd.f64(double %66, double %31, double %64)
%68 = getelementptr inbounds double, double* %2, i64 8
%69 = load double, double* %68
%70 = fsub double %69, %34
%71 = tail call double @llvm.fmuladd.f64(double %70, double %25, double %67)
%72 = shufflevector <2 x double> %58, <2 x double> undef, <2 x i32> zeroinitializer
%73 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %72, <2 x double> %27)
%74 = bitcast [9 x double]* %7 to <2 x double>*
store <2 x double> %73, <2 x double>* %74
%75 = fsub <2 x double> %30, %73
%76 = bitcast [9 x double]* %6 to <2 x double>*
store <2 x double> %75, <2 x double>* %76
%77 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 2
%78 = shufflevector <2 x double> %56, <2 x double> %23, <2 x i32> <i32 0, i32 2>
%79 = shufflevector <2 x double> %53, <2 x double> %27, <2 x i32> <i32 0, i32 2>
%80 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %78, <2 x double> %58, <2 x double> %79)
%81 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 2
%82 = bitcast double* %77 to <2 x double>*
store <2 x double> %80, <2 x double>* %82
%83 = fsub <2 x double> %36, %80
%84 = bitcast double* %81 to <2 x double>*
store <2 x double> %83, <2 x double>* %84
%85 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 4
%86 = insertelement <2 x double> %49, double %25, i64 1
%87 = shufflevector <2 x double> %58, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%88 = insertelement <2 x double> %46, double %34, i64 1
%89 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %86, <2 x double> %87, <2 x double> %88)
%90 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 4
%91 = bitcast double* %85 to <2 x double>*
store <2 x double> %89, <2 x double>* %91
%92 = fsub <2 x double> %44, %89
%93 = bitcast double* %90 to <2 x double>*
store <2 x double> %92, <2 x double>* %93
%94 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 6
%95 = insertelement <2 x double> poison, double %71, i64 0
%96 = shufflevector <2 x double> %95, <2 x double> poison, <2 x i32> zeroinitializer
%97 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %96, <2 x double> %27)
%98 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 6
%99 = bitcast double* %94 to <2 x double>*
store <2 x double> %97, <2 x double>* %99
%100 = fsub <2 x double> %61, %97
%101 = bitcast double* %98 to <2 x double>*
store <2 x double> %100, <2 x double>* %101
%102 = tail call double @llvm.fmuladd.f64(double %25, double %71, double %34)
%103 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 8
store double %102, double* %103
%104 = fsub double %69, %102
%105 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 8
store double %104, double* %105
br label %106
106: ; preds = %5, %106
%107 = phi i64 [ 0, %5 ], [ %179, %106 ]
%108 = phi <2 x double> [ zeroinitializer, %5 ], [ %178, %106 ]
%109 = mul nuw nsw i64 %107, 3
%110 = add nuw nsw i64 %109, 1
%111 = load double, double* %15
%112 = add nuw nsw i64 %109, 2
%113 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 %112
%114 = load double, double* %113
%115 = load double, double* %12
%116 = fneg double %114
%117 = fmul double %115, %116
%118 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 %109
%119 = bitcast double* %118 to <2 x double>*
%120 = load <2 x double>, <2 x double>* %119
%121 = extractelement <2 x double> %120, i64 1
%122 = tail call double @llvm.fmuladd.f64(double %121, double %111, double %117)
%123 = load double, double* %0
%124 = extractelement <2 x double> %120, i64 0
%125 = fneg double %124
%126 = fmul double %111, %125
%127 = tail call double @llvm.fmuladd.f64(double %114, double %123, double %126)
%128 = fneg double %121
%129 = fmul double %123, %128
%130 = tail call double @llvm.fmuladd.f64(double %124, double %115, double %129)
%131 = tail call double @llvm.fmuladd.f64(double %122, double %122, double 0.000000e+00)
%132 = tail call double @llvm.fmuladd.f64(double %124, double %124, double 0.000000e+00)
%133 = getelementptr inbounds double, double* %3, i64 %109
%134 = load double, double* %133
%135 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 %109
%136 = load double, double* %135
%137 = fsub double %134, %136
%138 = tail call double @llvm.fmuladd.f64(double %127, double %127, double %131)
%139 = tail call double @llvm.fmuladd.f64(double %121, double %121, double %132)
%140 = getelementptr inbounds double, double* %3, i64 %110
%141 = load double, double* %140
%142 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 %110
%143 = load double, double* %142
%144 = fsub double %141, %143
%145 = tail call double @llvm.fmuladd.f64(double %130, double %130, double %138)
%146 = tail call double @llvm.fmuladd.f64(double %114, double %114, double %139)
%147 = getelementptr inbounds double, double* %3, i64 %112
%148 = load double, double* %147
%149 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 %112
%150 = load double, double* %149
%151 = fsub double %148, %150
%152 = tail call double @sqrt(double %145)
%153 = tail call double @sqrt(double %146)
%154 = fdiv double %122, %152
%155 = insertelement <2 x double> poison, double %153, i64 0
%156 = shufflevector <2 x double> %155, <2 x double> poison, <2 x i32> zeroinitializer
%157 = fdiv <2 x double> %120, %156
%158 = insertelement <2 x double> poison, double %137, i64 0
%159 = shufflevector <2 x double> %158, <2 x double> poison, <2 x i32> zeroinitializer
%160 = insertelement <2 x double> %157, double %154, i64 1
%161 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %159, <2 x double> %160, <2 x double> zeroinitializer)
%162 = fdiv double %127, %152
%163 = bitcast double* %118 to <2 x double>*
store <2 x double> %157, <2 x double>* %163
%164 = extractelement <2 x double> %157, i64 1
%165 = insertelement <2 x double> poison, double %144, i64 0
%166 = shufflevector <2 x double> %165, <2 x double> poison, <2 x i32> zeroinitializer
%167 = insertelement <2 x double> poison, double %164, i64 0
%168 = insertelement <2 x double> %167, double %162, i64 1
%169 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %166, <2 x double> %168, <2 x double> %161)
%170 = insertelement <2 x double> poison, double %114, i64 0
%171 = insertelement <2 x double> %170, double %130, i64 1
%172 = insertelement <2 x double> %155, double %152, i64 1
%173 = fdiv <2 x double> %171, %172
%174 = extractelement <2 x double> %173, i64 0
store double %174, double* %113
%175 = insertelement <2 x double> poison, double %151, i64 0
%176 = shufflevector <2 x double> %175, <2 x double> poison, <2 x i32> zeroinitializer
%177 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %176, <2 x double> %173, <2 x double> %169)
%178 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %156, <2 x double> %177, <2 x double> %108)
%179 = add nuw nsw i64 %107, 1
%180 = icmp eq i64 %179, 3
br i1 %180, label %181, label %106
181: ; preds = %106
%182 = extractelement <2 x double> %178, i64 0
%183 = extractelement <2 x double> %178, i64 1
%184 = tail call double @atan2(double %183, double %182)
%185 = fdiv double %184, 3.000000e+00
%186 = tail call i32 @rotation_matrix_c(double* %0, double %185, double* %4)
ret void
}