#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*/ doubles_normalize(double *, int, double *);
int sqrt(double);
void doubles_mat_to_quat(const double M[16], double q[4]) {
  double T = M[0] + M[5] + M[10] + 1.0;
  double S;
  if (T > 0.0000001) {
    S = sqrt(T) * 2;
    q[0] = (double)(0.25 * S);
    q[1] = (double)((M[9] - M[6]) / S);
    q[2] = (double)((M[2] - M[8]) / S);
    q[3] = (double)((M[4] - M[1]) / S);
  } else if (M[0] > M[5] && M[0] > M[10]) {
    S = sqrt(1.0 + M[0] - M[5] - M[10]) * 2;
    q[0] = (double)((M[9] - M[6]) / S);
    q[1] = (double)(0.25 * S);
    q[2] = (double)((M[4] + M[1]) / S);
    q[3] = (double)((M[2] + M[8]) / S);
  } else if (M[5] > M[10]) {
    S = sqrt(1.0 + M[5] - M[0] - M[10]) * 2;
    q[0] = (double)((M[2] - M[8]) / S);
    q[1] = (double)((M[4] + M[1]) / S);
    q[2] = (double)(0.25 * S);
    q[3] = (double)((M[9] + M[6]) / S);
  } else {
    S = sqrt(1.0 + M[10] - M[0] - M[5]);
    q[0] = (double)((M[4] - M[1]) / S);
    q[1] = (double)((M[2] + M[8]) / S);
    q[2] = (double)((M[9] + M[6]) / S);
    q[3] = (double)(0.25 * S);
  }
  doubles_normalize(q, 4, q);
}


x86 assembly (clang, -O0):
<doubles_mat_to_quat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x50(%rax),%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1202 <doubles_mat_to_quat+0xe2>
movsd  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe80(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x30(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x40(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    1451 <doubles_mat_to_quat+0x331>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x28(%rax),%xmm0
jbe    12dd <doubles_mat_to_quat+0x1bd>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x50(%rax),%xmm0
jbe    12dd <doubles_mat_to_quat+0x1bd>
mov    -0x8(%rbp),%rax
movsd  0xdcc(%rip),%xmm0
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x50(%rax),%xmm0
call   1040 <sqrt@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x30(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd86(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x40(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    144c <doubles_mat_to_quat+0x32c>
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x50(%rax),%xmm0
jbe    13a2 <doubles_mat_to_quat+0x282>
mov    -0x8(%rbp),%rax
movsd  0xd07(%rip),%xmm0
addsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x50(%rax),%xmm0
call   1040 <sqrt@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x40(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xca1(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x30(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    1447 <doubles_mat_to_quat+0x327>
mov    -0x8(%rbp),%rax
movsd  0xc5a(%rip),%xmm0
addsd  0x50(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x28(%rax),%xmm0
call   1040 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x40(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x30(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  0xbd7(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    144c <doubles_mat_to_quat+0x32c>
jmp    1451 <doubles_mat_to_quat+0x331>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x4,%esi
call   1030 <doubles_normalize@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubles_mat_to_quat>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsd  (%rdi),%xmm1
movsd  0x28(%rdi),%xmm0
movapd %xmm1,%xmm3
addsd  %xmm0,%xmm3
movsd  0x50(%rdi),%xmm2
addsd  %xmm2,%xmm3
addsd  0xeb7(%rip),%xmm3
mov    %rsi,%r14
ucomisd 0xeb4(%rip),%xmm3
jbe    11b4 <doubles_mat_to_quat+0x94>
movapd %xmm3,%xmm0
call   1040 <sqrt@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xea0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x48(%rbx),%xmm0
subsd  0x30(%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x10(%rbx),%xmm0
subsd  0x40(%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x20(%rbx),%xmm0
subsd  0x8(%rbx),%xmm0
divsd  %xmm1,%xmm0
jmp    12fe <doubles_mat_to_quat+0x1de>
ucomisd %xmm0,%xmm1
jbe    122e <doubles_mat_to_quat+0x10e>
ucomisd %xmm2,%xmm1
jbe    122e <doubles_mat_to_quat+0x10e>
addsd  0xe38(%rip),%xmm1
subsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
call   1040 <sqrt@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x48(%rbx),%xmm0
subsd  0x30(%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0xe13(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x20(%rbx),%xmm0
addsd  0x8(%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x10(%rbx),%xmm0
addsd  0x40(%rbx),%xmm0
divsd  %xmm1,%xmm0
jmp    12fe <doubles_mat_to_quat+0x1de>
ucomisd %xmm2,%xmm0
jbe    129b <doubles_mat_to_quat+0x17b>
addsd  0xdc4(%rip),%xmm0
subsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
call   1040 <sqrt@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x10(%rbx),%xmm0
subsd  0x40(%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x20(%rbx),%xmm0
addsd  0x8(%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0xd8f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x48(%rbx),%xmm0
addsd  0x30(%rbx),%xmm0
divsd  %xmm1,%xmm0
jmp    12fe <doubles_mat_to_quat+0x1de>
addsd  0xd5d(%rip),%xmm2
subsd  %xmm1,%xmm2
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x20(%rbx),%xmm1
subsd  0x8(%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x10(%rbx),%xmm1
addsd  0x40(%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r14)
movsd  0x48(%rbx),%xmm1
addsd  0x30(%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%r14)
mulsd  0xd12(%rip),%xmm0
movsd  %xmm0,0x18(%r14)
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <doubles_normalize@plt>

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

LLVM IR (-O2):
define void @doubles_mat_to_quat(double* %0, double* %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 5
%5 = load double, double* %4
%6 = fadd double %3, %5
%7 = getelementptr inbounds double, double* %0, i64 10
%8 = load double, double* %7
%9 = fadd double %6, %8
%10 = fadd double %9, 1.000000e+00
%11 = fcmp ogt double %10, 0x3E7AD7F29ABCAF48
br i1 %11, label %12, label %37
12: ; preds = %2
%13 = tail call i32 @sqrt(double %10)
%14 = shl nsw i32 %13, 1
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 2.500000e-01
store double %16, double* %1
%17 = getelementptr inbounds double, double* %0, i64 9
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %0, i64 6
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = fdiv double %21, %15
%23 = getelementptr inbounds double, double* %1, i64 1
store double %22, double* %23
%24 = getelementptr inbounds double, double* %0, i64 2
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %0, i64 8
%27 = load double, double* %26
%28 = fsub double %25, %27
%29 = fdiv double %28, %15
%30 = getelementptr inbounds double, double* %1, i64 2
store double %29, double* %30
%31 = getelementptr inbounds double, double* %0, i64 4
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %0, i64 1
%34 = load double, double* %33
%35 = fsub double %32, %34
%36 = fdiv double %35, %15
br label %126
37: ; preds = %2
%38 = fcmp ogt double %3, %5
%39 = fcmp ogt double %3, %8
%40 = select i1 %38, i1 %39, i1 false
br i1 %40, label %41, label %69
41: ; preds = %37
%42 = fadd double %3, 1.000000e+00
%43 = fsub double %42, %5
%44 = fsub double %43, %8
%45 = tail call i32 @sqrt(double %44)
%46 = shl nsw i32 %45, 1
%47 = sitofp i32 %46 to double
%48 = getelementptr inbounds double, double* %0, i64 9
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %0, i64 6
%51 = load double, double* %50
%52 = fsub double %49, %51
%53 = fdiv double %52, %47
store double %53, double* %1
%54 = fmul double %47, 2.500000e-01
%55 = getelementptr inbounds double, double* %1, i64 1
store double %54, double* %55
%56 = getelementptr inbounds double, double* %0, i64 4
%57 = load double, double* %56
%58 = getelementptr inbounds double, double* %0, i64 1
%59 = load double, double* %58
%60 = fadd double %57, %59
%61 = fdiv double %60, %47
%62 = getelementptr inbounds double, double* %1, i64 2
store double %61, double* %62
%63 = getelementptr inbounds double, double* %0, i64 2
%64 = load double, double* %63
%65 = getelementptr inbounds double, double* %0, i64 8
%66 = load double, double* %65
%67 = fadd double %64, %66
%68 = fdiv double %67, %47
br label %126
69: ; preds = %37
%70 = fcmp ogt double %5, %8
br i1 %70, label %71, label %99
71: ; preds = %69
%72 = fadd double %5, 1.000000e+00
%73 = fsub double %72, %3
%74 = fsub double %73, %8
%75 = tail call i32 @sqrt(double %74)
%76 = shl nsw i32 %75, 1
%77 = sitofp i32 %76 to double
%78 = getelementptr inbounds double, double* %0, i64 2
%79 = load double, double* %78
%80 = getelementptr inbounds double, double* %0, i64 8
%81 = load double, double* %80
%82 = fsub double %79, %81
%83 = fdiv double %82, %77
store double %83, double* %1
%84 = getelementptr inbounds double, double* %0, i64 4
%85 = load double, double* %84
%86 = getelementptr inbounds double, double* %0, i64 1
%87 = load double, double* %86
%88 = fadd double %85, %87
%89 = fdiv double %88, %77
%90 = getelementptr inbounds double, double* %1, i64 1
store double %89, double* %90
%91 = fmul double %77, 2.500000e-01
%92 = getelementptr inbounds double, double* %1, i64 2
store double %91, double* %92
%93 = getelementptr inbounds double, double* %0, i64 9
%94 = load double, double* %93
%95 = getelementptr inbounds double, double* %0, i64 6
%96 = load double, double* %95
%97 = fadd double %94, %96
%98 = fdiv double %97, %77
br label %126
99: ; preds = %69
%100 = fadd double %8, 1.000000e+00
%101 = fsub double %100, %3
%102 = fsub double %101, %5
%103 = tail call i32 @sqrt(double %102)
%104 = sitofp i32 %103 to double
%105 = getelementptr inbounds double, double* %0, i64 4
%106 = load double, double* %105
%107 = getelementptr inbounds double, double* %0, i64 1
%108 = load double, double* %107
%109 = fsub double %106, %108
%110 = fdiv double %109, %104
store double %110, double* %1
%111 = getelementptr inbounds double, double* %0, i64 2
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %0, i64 8
%114 = load double, double* %113
%115 = fadd double %112, %114
%116 = fdiv double %115, %104
%117 = getelementptr inbounds double, double* %1, i64 1
store double %116, double* %117
%118 = getelementptr inbounds double, double* %0, i64 9
%119 = load double, double* %118
%120 = getelementptr inbounds double, double* %0, i64 6
%121 = load double, double* %120
%122 = fadd double %119, %121
%123 = fdiv double %122, %104
%124 = getelementptr inbounds double, double* %1, i64 2
store double %123, double* %124
%125 = fmul double %104, 2.500000e-01
br label %126
126: ; preds = %41, %99, %71, %12
%127 = phi double [ %68, %41 ], [ %125, %99 ], [ %98, %71 ], [ %36, %12 ]
%128 = getelementptr inbounds double, double* %1, i64 3
store double %127, double* %128
%129 = tail call i32 @doubles_normalize(double* %1, i32 4, double* %1)
ret void
}