#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 */
int /*<<< orphan*/ VecToso3(double *, double **);
double acos(double);
double fabs(double);
int /*<<< orphan*/ memset(double **, int /*<<< orphan*/, int);
double sin(double);
double sqrt(int);
void MatrixLog3(double R[3][3], double so3Mat[3][3]) {
  double omg[3] = {0};
  double acosinput = (R[0][0] + R[1][1] + R[2][2] - 1.0) / 2.0;
  if (fabs(acosinput - 1.0) < 1.0E-6) {
    memset(so3Mat, 0, 9 * sizeof(double));
  } else if (acosinput <= -1.0) {
    if ((1.0 + R[2][2]) >= 1.0E-6) {
      omg[0] = 1.0 / sqrt(2 * (1.0 + R[2][2])) * R[0][2];
      omg[1] = 1.0 / sqrt(2 * (1.0 + R[2][2])) * R[1][2];
      omg[2] = 1.0 / sqrt(2 * (1.0 + R[2][2])) * (1.0 + R[2][2]);
    } else if ((1.0 + R[1][1] >= 1.0E-6)) {
      omg[0] = 1.0 / sqrt(2 * (1.0 + R[1][1])) * R[0][1];
      omg[1] = 1.0 / sqrt(2 * (1.0 + R[1][1])) * (1.0 + R[1][1]);
      omg[2] = 1.0 / sqrt(2 * (1.0 + R[1][1])) * R[2][1];
    } else {
      omg[0] = 1.0 / sqrt(2 * (1.0 + R[0][0])) * (1.0 + R[0][0]);
      omg[1] = 1.0 / sqrt(2 * (1.0 + R[0][0])) * R[1][0];
      omg[2] = 1.0 / sqrt(2 * (1.0 + R[0][0])) * R[2][0];
    }
    omg[0] = 3.14159265358979323846 * omg[0];
    omg[1] = 3.14159265358979323846 * omg[1];
    omg[2] = 3.14159265358979323846 * omg[2];
    VecToso3(omg, so3Mat);
  } else {
    int i;
    int j;
    double theta = acos(acosinput);
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        so3Mat[i][j] = 1.0 / (2.0 * sin(theta)) * (R[i][j] - R[j][i]) * theta;
      }
    }
  }
  return;
}


x86 assembly (clang, -O0):
<MatrixLog3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x40(%rax),%xmm0
movsd  0xe76(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xe54(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xe71(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe35(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ea <MatrixLog3+0x9a>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
jmp    15e4 <MatrixLog3+0x494>
movsd  0xe26(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     1515 <MatrixLog3+0x3c5>
mov    -0x8(%rbp),%rax
movsd  0xdff(%rip),%xmm0
addsd  0x40(%rax),%xmm0
movsd  0xdea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12fa <MatrixLog3+0x1aa>
mov    -0x8(%rbp),%rax
movsd  0xddc(%rip),%xmm1
addsd  0x40(%rax),%xmm1
movsd  0xdd7(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xdb7(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xd99(%rip),%xmm1
addsd  0x40(%rax),%xmm1
movsd  0xd94(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd74(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xd56(%rip),%xmm1
addsd  0x40(%rax),%xmm1
movsd  0xd51(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd31(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0xd21(%rip),%xmm1
addsd  0x40(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    14cd <MatrixLog3+0x37d>
mov    -0x8(%rbp),%rax
movsd  0xd02(%rip),%xmm0
addsd  0x20(%rax),%xmm0
movsd  0xced(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     13f7 <MatrixLog3+0x2a7>
mov    -0x8(%rbp),%rax
movsd  0xcdf(%rip),%xmm1
addsd  0x20(%rax),%xmm1
movsd  0xcda(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xcba(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xc9c(%rip),%xmm1
addsd  0x20(%rax),%xmm1
movsd  0xc97(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xc77(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0xc67(%rip),%xmm1
addsd  0x20(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xc4d(%rip),%xmm1
addsd  0x20(%rax),%xmm1
movsd  0xc48(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xc28(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    14c8 <MatrixLog3+0x378>
mov    -0x8(%rbp),%rax
movsd  0xc05(%rip),%xmm1
addsd  (%rax),%xmm1
movsd  0xc01(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xbe1(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0xbd1(%rip),%xmm1
addsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xbb8(%rip),%xmm1
addsd  (%rax),%xmm1
movsd  0xbb4(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xb94(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xb76(%rip),%xmm1
addsd  (%rax),%xmm1
movsd  0xb72(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xb52(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    14cd <MatrixLog3+0x37d>
movsd  0xb4b(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xb39(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xb27(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <VecToso3@plt>
jmp    15df <MatrixLog3+0x48f>
movsd  -0x38(%rbp),%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    15da <MatrixLog3+0x48a>
movl   $0x0,-0x40(%rbp)
cmpl   $0x3,-0x40(%rbp)
jge    15c7 <MatrixLog3+0x477>
movsd  -0x48(%rbp),%xmm0
call   1060 <sin@plt>
movsd  0xab8(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xaa4(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x3c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    153c <MatrixLog3+0x3ec>
jmp    15cc <MatrixLog3+0x47c>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    152b <MatrixLog3+0x3db>
jmp    15df <MatrixLog3+0x48f>
jmp    15e4 <MatrixLog3+0x494>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MatrixLog3>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movsd  (%rdi),%xmm1
movsd  0x20(%rdi),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  0x40(%rdi),%xmm3
addsd  %xmm3,%xmm0
movsd  0xe87(%rip),%xmm4
addsd  %xmm4,%xmm0
mulsd  0xe83(%rip),%xmm0
movapd %xmm0,%xmm5
addsd  %xmm4,%xmm5
andpd  0xe9b(%rip),%xmm5
mov    %rsi,%r14
movsd  0xe70(%rip),%xmm6
ucomisd %xmm5,%xmm6
jbe    11bc <MatrixLog3+0x6c>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x48,%edx
add    $0x38,%rsp
pop    %rbx
pop    %r14
jmp    1050 <memset@plt>
mov    %rdi,%rbx
ucomisd %xmm0,%xmm4
jae    1391 <MatrixLog3+0x241>
call   1040 <acos@plt>
movsd  %xmm0,(%rsp)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xe34(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rbx),%xmm2
subsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xe05(%rip),%xmm1
movsd  0x8(%rbx),%xmm2
subsd  0x18(%rbx),%xmm2
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xdd3(%rip),%xmm1
movsd  0x10(%rbx),%xmm2
subsd  0x30(%rbx),%xmm2
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xda1(%rip),%xmm1
movsd  0x18(%rbx),%xmm2
subsd  0x8(%rbx),%xmm2
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xd6f(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0x20(%rbx),%xmm2
subsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x20(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xd3e(%rip),%xmm1
movsd  0x28(%rbx),%xmm2
subsd  0x38(%rbx),%xmm2
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x28(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xd0c(%rip),%xmm1
movsd  0x30(%rbx),%xmm2
subsd  0x10(%rbx),%xmm2
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x30(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xcda(%rip),%xmm1
movsd  0x38(%rbx),%xmm2
subsd  0x28(%rbx),%xmm2
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x38(%r14)
call   1060 <sin@plt>
addsd  %xmm0,%xmm0
movsd  0xca8(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0x40(%rbx),%xmm0
subsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x40(%r14)
jmp    15a2 <MatrixLog3+0x452>
addsd  0xc7f(%rip),%xmm3
ucomisd 0xc6f(%rip),%xmm3
jae    144e <MatrixLog3+0x2fe>
addsd  0xc69(%rip),%xmm2
ucomisd 0xc59(%rip),%xmm2
jae    14ea <MatrixLog3+0x39a>
addsd  0xc53(%rip),%xmm1
addsd  %xmm1,%xmm1
cvttsd2si %xmm1,%edi
call   1070 <sqrt@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
addsd  0xc34(%rip),%xmm0
movapd %xmm0,(%rsp)
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xc38(%rip),%xmm0
divpd  %xmm1,%xmm0
movapd (%rsp),%xmm1
movhpd 0x18(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  (%rbx),%xmm0
addsd  0xbed(%rip),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movsd  0xbd8(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  0x30(%rbx),%xmm1
jmp    1574 <MatrixLog3+0x424>
addsd  %xmm3,%xmm3
cvttsd2si %xmm3,%edi
call   1070 <sqrt@plt>
movapd %xmm0,0x10(%rsp)
movsd  0x40(%rbx),%xmm0
addsd  0xbaa(%rip),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
movsd  0x10(%rbx),%xmm0
movapd %xmm0,(%rsp)
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xba9(%rip),%xmm0
divpd  %xmm1,%xmm0
movapd (%rsp),%xmm1
movhpd 0x28(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  0x40(%rbx),%xmm0
addsd  0xb5d(%rip),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movsd  0xb48(%rip),%xmm2
movapd %xmm2,%xmm1
divsd  %xmm0,%xmm1
addsd  0x40(%rbx),%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm1
jmp    1574 <MatrixLog3+0x424>
addsd  %xmm2,%xmm2
cvttsd2si %xmm2,%edi
call   1070 <sqrt@plt>
movapd %xmm0,0x10(%rsp)
movsd  0x20(%rbx),%xmm0
addsd  0xb0e(%rip),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
movsd  0x8(%rbx),%xmm0
movapd %xmm0,(%rsp)
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xb0d(%rip),%xmm0
divpd  %xmm1,%xmm0
movsd  0x20(%rbx),%xmm1
addsd  0xad4(%rip),%xmm1
movapd (%rsp),%xmm2
unpcklpd %xmm1,%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,(%rsp)
addsd  %xmm1,%xmm1
cvttsd2si %xmm1,%edi
call   1070 <sqrt@plt>
movsd  0xaad(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  0x38(%rbx),%xmm1
movapd (%rsp),%xmm0
mulpd  0xacf(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
mulsd  0xa91(%rip),%xmm1
movsd  %xmm1,0x30(%rsp)
lea    0x20(%rsp),%rdi
mov    %r14,%rsi
call   1030 <VecToso3@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @MatrixLog3([3 x double]* %0, [3 x double]* %1) {
%3 = alloca [3 x double]*
%4 = alloca [3 x double]*
%5 = alloca [3 x double]
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store [3 x double]* %0, [3 x double]** %3
store [3 x double]* %1, [3 x double]** %4
%10 = bitcast [3 x double]* %5 to i8*
%11 = load [3 x double]*, [3 x double]** %3
%12 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0
%13 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
%14 = load double, double* %13
%15 = load [3 x double]*, [3 x double]** %3
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 1
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 1
%18 = load double, double* %17
%19 = fadd double %14, %18
%20 = load [3 x double]*, [3 x double]** %3
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 2
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 2
%23 = load double, double* %22
%24 = fadd double %19, %23
%25 = fsub double %24, 1.000000e+00
%26 = fdiv double %25, 2.000000e+00
store double %26, double* %6
%27 = load double, double* %6
%28 = fsub double %27, 1.000000e+00
%29 = call double @llvm.fabs.f64(double %28)
%30 = fcmp olt double %29, 0x3EB0C6F7A0B5ED8D
br i1 %30, label %31, label %35
31: ; preds = %2
%32 = load [3 x double]*, [3 x double]** %4
%33 = bitcast [3 x double]* %32 to double**
%34 = call i32 @memset(double** %33, i32 0, i32 72)
br label %262
35: ; preds = %2
%36 = load double, double* %6
%37 = fcmp ole double %36, -1.000000e+00
br i1 %37, label %38, label %211
38: ; preds = %35
%39 = load [3 x double]*, [3 x double]** %3
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 2
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 0, i64 2
%42 = load double, double* %41
%43 = fadd double 1.000000e+00, %42
%44 = fcmp oge double %43, 0x3EB0C6F7A0B5ED8D
br i1 %44, label %45, label %92
45: ; preds = %38
%46 = load [3 x double]*, [3 x double]** %3
%47 = getelementptr inbounds [3 x double], [3 x double]* %46, i64 2
%48 = getelementptr inbounds [3 x double], [3 x double]* %47, i64 0, i64 2
%49 = load double, double* %48
%50 = fadd double 1.000000e+00, %49
%51 = fmul double 2.000000e+00, %50
%52 = fptosi double %51 to i32
%53 = call double @sqrt(i32 %52)
%54 = fdiv double 1.000000e+00, %53
%55 = load [3 x double]*, [3 x double]** %3
%56 = getelementptr inbounds [3 x double], [3 x double]* %55, i64 0
%57 = getelementptr inbounds [3 x double], [3 x double]* %56, i64 0, i64 2
%58 = load double, double* %57
%59 = fmul double %54, %58
%60 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
store double %59, double* %60
%61 = load [3 x double]*, [3 x double]** %3
%62 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 2
%63 = getelementptr inbounds [3 x double], [3 x double]* %62, i64 0, i64 2
%64 = load double, double* %63
%65 = fadd double 1.000000e+00, %64
%66 = fmul double 2.000000e+00, %65
%67 = fptosi double %66 to i32
%68 = call double @sqrt(i32 %67)
%69 = fdiv double 1.000000e+00, %68
%70 = load [3 x double]*, [3 x double]** %3
%71 = getelementptr inbounds [3 x double], [3 x double]* %70, i64 1
%72 = getelementptr inbounds [3 x double], [3 x double]* %71, i64 0, i64 2
%73 = load double, double* %72
%74 = fmul double %69, %73
%75 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
store double %74, double* %75
%76 = load [3 x double]*, [3 x double]** %3
%77 = getelementptr inbounds [3 x double], [3 x double]* %76, i64 2
%78 = getelementptr inbounds [3 x double], [3 x double]* %77, i64 0, i64 2
%79 = load double, double* %78
%80 = fadd double 1.000000e+00, %79
%81 = fmul double 2.000000e+00, %80
%82 = fptosi double %81 to i32
%83 = call double @sqrt(i32 %82)
%84 = fdiv double 1.000000e+00, %83
%85 = load [3 x double]*, [3 x double]** %3
%86 = getelementptr inbounds [3 x double], [3 x double]* %85, i64 2
%87 = getelementptr inbounds [3 x double], [3 x double]* %86, i64 0, i64 2
%88 = load double, double* %87
%89 = fadd double 1.000000e+00, %88
%90 = fmul double %84, %89
%91 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %90, double* %91
br label %194
92: ; preds = %38
%93 = load [3 x double]*, [3 x double]** %3
%94 = getelementptr inbounds [3 x double], [3 x double]* %93, i64 1
%95 = getelementptr inbounds [3 x double], [3 x double]* %94, i64 0, i64 1
%96 = load double, double* %95
%97 = fadd double 1.000000e+00, %96
%98 = fcmp oge double %97, 0x3EB0C6F7A0B5ED8D
br i1 %98, label %99, label %146
99: ; preds = %92
%100 = load [3 x double]*, [3 x double]** %3
%101 = getelementptr inbounds [3 x double], [3 x double]* %100, i64 1
%102 = getelementptr inbounds [3 x double], [3 x double]* %101, i64 0, i64 1
%103 = load double, double* %102
%104 = fadd double 1.000000e+00, %103
%105 = fmul double 2.000000e+00, %104
%106 = fptosi double %105 to i32
%107 = call double @sqrt(i32 %106)
%108 = fdiv double 1.000000e+00, %107
%109 = load [3 x double]*, [3 x double]** %3
%110 = getelementptr inbounds [3 x double], [3 x double]* %109, i64 0
%111 = getelementptr inbounds [3 x double], [3 x double]* %110, i64 0, i64 1
%112 = load double, double* %111
%113 = fmul double %108, %112
%114 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
store double %113, double* %114
%115 = load [3 x double]*, [3 x double]** %3
%116 = getelementptr inbounds [3 x double], [3 x double]* %115, i64 1
%117 = getelementptr inbounds [3 x double], [3 x double]* %116, i64 0, i64 1
%118 = load double, double* %117
%119 = fadd double 1.000000e+00, %118
%120 = fmul double 2.000000e+00, %119
%121 = fptosi double %120 to i32
%122 = call double @sqrt(i32 %121)
%123 = fdiv double 1.000000e+00, %122
%124 = load [3 x double]*, [3 x double]** %3
%125 = getelementptr inbounds [3 x double], [3 x double]* %124, i64 1
%126 = getelementptr inbounds [3 x double], [3 x double]* %125, i64 0, i64 1
%127 = load double, double* %126
%128 = fadd double 1.000000e+00, %127
%129 = fmul double %123, %128
%130 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
store double %129, double* %130
%131 = load [3 x double]*, [3 x double]** %3
%132 = getelementptr inbounds [3 x double], [3 x double]* %131, i64 1
%133 = getelementptr inbounds [3 x double], [3 x double]* %132, i64 0, i64 1
%134 = load double, double* %133
%135 = fadd double 1.000000e+00, %134
%136 = fmul double 2.000000e+00, %135
%137 = fptosi double %136 to i32
%138 = call double @sqrt(i32 %137)
%139 = fdiv double 1.000000e+00, %138
%140 = load [3 x double]*, [3 x double]** %3
%141 = getelementptr inbounds [3 x double], [3 x double]* %140, i64 2
%142 = getelementptr inbounds [3 x double], [3 x double]* %141, i64 0, i64 1
%143 = load double, double* %142
%144 = fmul double %139, %143
%145 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %144, double* %145
br label %193
146: ; preds = %92
%147 = load [3 x double]*, [3 x double]** %3
%148 = getelementptr inbounds [3 x double], [3 x double]* %147, i64 0
%149 = getelementptr inbounds [3 x double], [3 x double]* %148, i64 0, i64 0
%150 = load double, double* %149
%151 = fadd double 1.000000e+00, %150
%152 = fmul double 2.000000e+00, %151
%153 = fptosi double %152 to i32
%154 = call double @sqrt(i32 %153)
%155 = fdiv double 1.000000e+00, %154
%156 = load [3 x double]*, [3 x double]** %3
%157 = getelementptr inbounds [3 x double], [3 x double]* %156, i64 0
%158 = getelementptr inbounds [3 x double], [3 x double]* %157, i64 0, i64 0
%159 = load double, double* %158
%160 = fadd double 1.000000e+00, %159
%161 = fmul double %155, %160
%162 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
store double %161, double* %162
%163 = load [3 x double]*, [3 x double]** %3
%164 = getelementptr inbounds [3 x double], [3 x double]* %163, i64 0
%165 = getelementptr inbounds [3 x double], [3 x double]* %164, i64 0, i64 0
%166 = load double, double* %165
%167 = fadd double 1.000000e+00, %166
%168 = fmul double 2.000000e+00, %167
%169 = fptosi double %168 to i32
%170 = call double @sqrt(i32 %169)
%171 = fdiv double 1.000000e+00, %170
%172 = load [3 x double]*, [3 x double]** %3
%173 = getelementptr inbounds [3 x double], [3 x double]* %172, i64 1
%174 = getelementptr inbounds [3 x double], [3 x double]* %173, i64 0, i64 0
%175 = load double, double* %174
%176 = fmul double %171, %175
%177 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
store double %176, double* %177
%178 = load [3 x double]*, [3 x double]** %3
%179 = getelementptr inbounds [3 x double], [3 x double]* %178, i64 0
%180 = getelementptr inbounds [3 x double], [3 x double]* %179, i64 0, i64 0
%181 = load double, double* %180
%182 = fadd double 1.000000e+00, %181
%183 = fmul double 2.000000e+00, %182
%184 = fptosi double %183 to i32
%185 = call double @sqrt(i32 %184)
%186 = fdiv double 1.000000e+00, %185
%187 = load [3 x double]*, [3 x double]** %3
%188 = getelementptr inbounds [3 x double], [3 x double]* %187, i64 2
%189 = getelementptr inbounds [3 x double], [3 x double]* %188, i64 0, i64 0
%190 = load double, double* %189
%191 = fmul double %186, %190
%192 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %191, double* %192
br label %193
193: ; preds = %146, %99
br label %194
194: ; preds = %193, %45
%195 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%196 = load double, double* %195
%197 = fmul double 0x400921FB54442D18, %196
%198 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
store double %197, double* %198
%199 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%200 = load double, double* %199
%201 = fmul double 0x400921FB54442D18, %200
%202 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
store double %201, double* %202
%203 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%204 = load double, double* %203
%205 = fmul double 0x400921FB54442D18, %204
%206 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %205, double* %206
%207 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%208 = load [3 x double]*, [3 x double]** %4
%209 = bitcast [3 x double]* %208 to double**
%210 = call i32 @VecToso3(double* %207, double** %209)
br label %261
211: ; preds = %35
%212 = load double, double* %6
%213 = call double @acos(double %212)
store double %213, double* %9
store i32 0, i32* %7
br label %214
214: ; preds = %257, %211
%215 = load i32, i32* %7
%216 = icmp slt i32 %215, 3
br i1 %216, label %217, label %260
217: ; preds = %214
store i32 0, i32* %8
br label %218
218: ; preds = %253, %217
%219 = load i32, i32* %8
%220 = icmp slt i32 %219, 3
br i1 %220, label %221, label %256
221: ; preds = %218
%222 = load double, double* %9
%223 = call double @sin(double %222)
%224 = fmul double 2.000000e+00, %223
%225 = fdiv double 1.000000e+00, %224
%226 = load [3 x double]*, [3 x double]** %3
%227 = load i32, i32* %7
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [3 x double], [3 x double]* %226, i64 %228
%230 = load i32, i32* %8
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [3 x double], [3 x double]* %229, i64 0, i64 %231
%233 = load double, double* %232
%234 = load [3 x double]*, [3 x double]** %3
%235 = load i32, i32* %8
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds [3 x double], [3 x double]* %234, i64 %236
%238 = load i32, i32* %7
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds [3 x double], [3 x double]* %237, i64 0, i64 %239
%241 = load double, double* %240
%242 = fsub double %233, %241
%243 = fmul double %225, %242
%244 = load double, double* %9
%245 = fmul double %243, %244
%246 = load [3 x double]*, [3 x double]** %4
%247 = load i32, i32* %7
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds [3 x double], [3 x double]* %246, i64 %248
%250 = load i32, i32* %8
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds [3 x double], [3 x double]* %249, i64 0, i64 %251
store double %245, double* %252
br label %253
253: ; preds = %221
%254 = load i32, i32* %8
%255 = add nsw i32 %254, 1
store i32 %255, i32* %8
br label %218
256: ; preds = %218
br label %257
257: ; preds = %256
%258 = load i32, i32* %7
%259 = add nsw i32 %258, 1
store i32 %259, i32* %7
br label %214
260: ; preds = %214
br label %261
261: ; preds = %260, %194
br label %262
262: ; preds = %261, %31
ret void
}

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