#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 */
float abs(float);
float sqrt(float);
void Quaternion_FromRotationMatrix(float *R, float *Q) {
  float fq0sq;
  float recip4q0;
  float fmag;
  float SMALLQ0 = 0.01f;
  fq0sq = 0.25f * (1.0f + R[0] + R[4] + R[8]);
  Q[0] = (float)sqrt(abs(fq0sq));
  if (Q[0] > SMALLQ0) {
    recip4q0 = 0.25f / Q[0];
    Q[1] = recip4q0 * (R[5] - R[7]);
    Q[2] = recip4q0 * (R[6] - R[2]);
    Q[3] = recip4q0 * (R[1] - R[3]);
  } else {
    Q[1] = sqrt(abs(0.5f * (1.0f + R[0]) - fq0sq));
    Q[2] = sqrt(abs(0.5f * (1.0f + R[4]) - fq0sq));
    Q[3] = sqrt(abs(0.5f * (1.0f + R[8]) - fq0sq));
    if ((R[1] + R[3]) < 0.0f) {
      Q[2] = -Q[2];
      if ((R[5] + R[7]) > 0.0f) {
        Q[3] = -Q[3];
      }
    } else if ((R[1] + R[3]) > 0.0f) {
      if ((R[5] + R[7]) < 0.0f) {
        Q[3] = -Q[3];
      }
    }
    if ((R[5] - R[7]) < 0.0f) {
      Q[1] = -Q[1];
      Q[2] = -Q[2];
      Q[3] = -Q[3];
    }
  }
  fmag = sqrt(Q[0] * Q[0] + Q[1] * Q[1] + Q[2] * Q[2] + Q[3] * Q[3]);
  Q[0] /= fmag;
  Q[1] /= fmag;
  Q[2] /= fmag;
  Q[3] /= fmag;
}


x86 assembly (clang, -O0):
<Quaternion_FromRotationMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xed0(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  0xebb(%rip),%xmm1
addss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
addss  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
addss  0x20(%rax),%xmm1
movss  0xe99(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <abs@plt>
call   1040 <sqrt@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    121f <Quaternion_FromRotationMatrix+0xff>
mov    -0x10(%rbp),%rax
movss  0xe5b(%rip),%xmm0
divss  (%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm1
mov    -0x8(%rbp),%rax
subss  0x1c(%rax),%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
subss  0x8(%rax),%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x8(%rbp),%rax
subss  0xc(%rax),%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
jmp    1454 <Quaternion_FromRotationMatrix+0x334>
mov    -0x8(%rbp),%rax
movss  0xdd9(%rip),%xmm0
addss  (%rax),%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xdc3(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <abs@plt>
call   1040 <sqrt@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0xd94(%rip),%xmm0
addss  0x10(%rax),%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xd7d(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <abs@plt>
call   1040 <sqrt@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xd4e(%rip),%xmm0
addss  0x20(%rax),%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xd37(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <abs@plt>
call   1040 <sqrt@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x8(%rbp),%rax
addss  0xc(%rax),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    136f <Quaternion_FromRotationMatrix+0x24f>
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm0
mov    -0x8(%rbp),%rax
addss  0x1c(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    136a <Quaternion_FromRotationMatrix+0x24a>
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
jmp    13d4 <Quaternion_FromRotationMatrix+0x2b4>
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
addss  0xc(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    13cf <Quaternion_FromRotationMatrix+0x2af>
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm1
mov    -0x8(%rbp),%rax
addss  0x1c(%rax),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    13ca <Quaternion_FromRotationMatrix+0x2aa>
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
jmp    13cf <Quaternion_FromRotationMatrix+0x2af>
jmp    13d4 <Quaternion_FromRotationMatrix+0x2b4>
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm1
mov    -0x8(%rbp),%rax
subss  0x1c(%rax),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    144f <Quaternion_FromRotationMatrix+0x32f>
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
jmp    1454 <Quaternion_FromRotationMatrix+0x334>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x4(%rax)
movss  -0x1c(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x8(%rax)
movss  -0x1c(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Quaternion_FromRotationMatrix>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm0
addss  0xec7(%rip),%xmm0
addss  0x10(%rdi),%xmm0
addss  0x20(%rdi),%xmm0
mulss  0xeb9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
call   1030 <abs@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1163 <Quaternion_FromRotationMatrix+0x43>
sqrtss %xmm0,%xmm0
jmp    1168 <Quaternion_FromRotationMatrix+0x48>
call   1040 <sqrt@plt>
movss  %xmm0,(%r14)
ucomiss 0xe94(%rip),%xmm0
jbe    11bd <Quaternion_FromRotationMatrix+0x9d>
movss  0xe86(%rip),%xmm3
divss  %xmm0,%xmm3
movss  0x14(%rbx),%xmm1
subss  0x1c(%rbx),%xmm1
mulss  %xmm3,%xmm1
movss  %xmm1,0x4(%r14)
movss  0x18(%rbx),%xmm2
subss  0x8(%rbx),%xmm2
mulss  %xmm3,%xmm2
movss  %xmm2,0x8(%r14)
movss  0x4(%rbx),%xmm0
subss  0xc(%rbx),%xmm0
mulss  %xmm3,%xmm0
jmp    130e <Quaternion_FromRotationMatrix+0x1ee>
movss  (%rbx),%xmm0
addss  0xe37(%rip),%xmm0
movaps 0xe50(%rip),%xmm1
movaps 0x10(%rsp),%xmm2
xorps  %xmm2,%xmm1
movaps %xmm1,(%rsp)
mulss  0xe28(%rip),%xmm0
subss  %xmm2,%xmm0
call   1030 <abs@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11fb <Quaternion_FromRotationMatrix+0xdb>
sqrtss %xmm0,%xmm0
jmp    1200 <Quaternion_FromRotationMatrix+0xe0>
call   1040 <sqrt@plt>
movss  %xmm0,0x4(%r14)
movss  0x10(%rbx),%xmm0
addss  0xded(%rip),%xmm0
mulss  0xdf1(%rip),%xmm0
addss  (%rsp),%xmm0
call   1030 <abs@plt>
ucomiss 0xde4(%rip),%xmm0
jb     1234 <Quaternion_FromRotationMatrix+0x114>
sqrtss %xmm0,%xmm0
jmp    1239 <Quaternion_FromRotationMatrix+0x119>
call   1040 <sqrt@plt>
movss  %xmm0,0x8(%r14)
movss  0x20(%rbx),%xmm0
addss  0xdb4(%rip),%xmm0
mulss  0xdb8(%rip),%xmm0
addss  (%rsp),%xmm0
call   1030 <abs@plt>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jb     126c <Quaternion_FromRotationMatrix+0x14c>
sqrtss %xmm0,%xmm0
jmp    1274 <Quaternion_FromRotationMatrix+0x154>
call   1040 <sqrt@plt>
xorps  %xmm2,%xmm2
movss  %xmm0,0xc(%r14)
movss  0x4(%rbx),%xmm1
addss  0xc(%rbx),%xmm1
ucomiss %xmm1,%xmm2
jbe    12b0 <Quaternion_FromRotationMatrix+0x190>
movss  0x8(%r14),%xmm1
xorps  0xd8a(%rip),%xmm1
movss  %xmm1,0x8(%r14)
movss  0x14(%rbx),%xmm1
addss  0x1c(%rbx),%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
ja     12c7 <Quaternion_FromRotationMatrix+0x1a7>
jmp    12d4 <Quaternion_FromRotationMatrix+0x1b4>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jbe    12d4 <Quaternion_FromRotationMatrix+0x1b4>
movss  0x14(%rbx),%xmm1
addss  0x1c(%rbx),%xmm1
ucomiss %xmm1,%xmm2
jbe    12d4 <Quaternion_FromRotationMatrix+0x1b4>
xorps  0xd52(%rip),%xmm0
movss  %xmm0,0xc(%r14)
movss  0x14(%rbx),%xmm1
subss  0x1c(%rbx),%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
movss  0x4(%r14),%xmm1
jbe    1316 <Quaternion_FromRotationMatrix+0x1f6>
movaps 0xd2d(%rip),%xmm3
xorps  %xmm3,%xmm1
movss  %xmm1,0x4(%r14)
movss  0x8(%r14),%xmm2
xorps  %xmm3,%xmm2
movss  %xmm2,0x8(%r14)
xorps  %xmm3,%xmm0
movss  %xmm0,0xc(%r14)
jmp    131c <Quaternion_FromRotationMatrix+0x1fc>
movss  0x8(%r14),%xmm2
movss  (%r14),%xmm3
mulss  %xmm1,%xmm1
mulss  %xmm3,%xmm3
addss  %xmm1,%xmm3
mulss  %xmm2,%xmm2
addss  %xmm3,%xmm2
mulss  %xmm0,%xmm0
addss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     134b <Quaternion_FromRotationMatrix+0x22b>
sqrtss %xmm0,%xmm0
jmp    1350 <Quaternion_FromRotationMatrix+0x230>
call   1040 <sqrt@plt>
movups (%r14),%xmm1
shufps $0x0,%xmm0,%xmm0
divps  %xmm0,%xmm1
movups %xmm1,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @Quaternion_FromRotationMatrix(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = fadd float %3, 1.000000e+00
%5 = getelementptr inbounds float, float* %0, i64 4
%6 = load float, float* %5
%7 = fadd float %4, %6
%8 = getelementptr inbounds float, float* %0, i64 8
%9 = load float, float* %8
%10 = fadd float %7, %9
%11 = fmul float %10, 2.500000e-01
%12 = tail call float @abs(float %11)
%13 = tail call float @sqrt(float %12)
store float %13, float* %1
%14 = fcmp ogt float %13, 0x3F847AE140000000
br i1 %14, label %15, label %38
15: ; preds = %2
%16 = fdiv float 2.500000e-01, %13
%17 = getelementptr inbounds float, float* %0, i64 5
%18 = load float, float* %17
%19 = getelementptr inbounds float, float* %0, i64 7
%20 = load float, float* %19
%21 = fsub float %18, %20
%22 = fmul float %16, %21
%23 = getelementptr inbounds float, float* %1, i64 1
store float %22, float* %23
%24 = getelementptr inbounds float, float* %0, i64 6
%25 = load float, float* %24
%26 = getelementptr inbounds float, float* %0, i64 2
%27 = load float, float* %26
%28 = fsub float %25, %27
%29 = fmul float %16, %28
%30 = getelementptr inbounds float, float* %1, i64 2
store float %29, float* %30
%31 = getelementptr inbounds float, float* %0, i64 1
%32 = load float, float* %31
%33 = getelementptr inbounds float, float* %0, i64 3
%34 = load float, float* %33
%35 = fsub float %32, %34
%36 = fmul float %16, %35
%37 = getelementptr inbounds float, float* %1, i64 3
store float %36, float* %37
br label %100
38: ; preds = %2
%39 = load float, float* %0
%40 = fadd float %39, 1.000000e+00
%41 = fneg float %11
%42 = tail call float @llvm.fmuladd.f32(float %40, float 5.000000e-01, float %41)
%43 = tail call float @abs(float %42)
%44 = tail call float @sqrt(float %43)
%45 = getelementptr inbounds float, float* %1, i64 1
store float %44, float* %45
%46 = load float, float* %5
%47 = fadd float %46, 1.000000e+00
%48 = tail call float @llvm.fmuladd.f32(float %47, float 5.000000e-01, float %41)
%49 = tail call float @abs(float %48)
%50 = tail call float @sqrt(float %49)
%51 = getelementptr inbounds float, float* %1, i64 2
store float %50, float* %51
%52 = load float, float* %8
%53 = fadd float %52, 1.000000e+00
%54 = tail call float @llvm.fmuladd.f32(float %53, float 5.000000e-01, float %41)
%55 = tail call float @abs(float %54)
%56 = tail call float @sqrt(float %55)
%57 = getelementptr inbounds float, float* %1, i64 3
store float %56, float* %57
%58 = getelementptr inbounds float, float* %0, i64 1
%59 = load float, float* %58
%60 = getelementptr inbounds float, float* %0, i64 3
%61 = load float, float* %60
%62 = fadd float %59, %61
%63 = fcmp olt float %62, 0.000000e+00
br i1 %63, label %64, label %73
64: ; preds = %38
%65 = load float, float* %51
%66 = fneg float %65
store float %66, float* %51
%67 = getelementptr inbounds float, float* %0, i64 5
%68 = load float, float* %67
%69 = getelementptr inbounds float, float* %0, i64 7
%70 = load float, float* %69
%71 = fadd float %68, %70
%72 = fcmp ogt float %71, 0.000000e+00
br i1 %72, label %82, label %84
73: ; preds = %38
%74 = fcmp ogt float %62, 0.000000e+00
br i1 %74, label %75, label %84
75: ; preds = %73
%76 = getelementptr inbounds float, float* %0, i64 5
%77 = load float, float* %76
%78 = getelementptr inbounds float, float* %0, i64 7
%79 = load float, float* %78
%80 = fadd float %77, %79
%81 = fcmp olt float %80, 0.000000e+00
br i1 %81, label %82, label %84
82: ; preds = %75, %64
%83 = fneg float %56
store float %83, float* %57
br label %84
84: ; preds = %82, %73, %75, %64
%85 = phi float [ %56, %73 ], [ %56, %75 ], [ %56, %64 ], [ %83, %82 ]
%86 = getelementptr inbounds float, float* %0, i64 5
%87 = load float, float* %86
%88 = getelementptr inbounds float, float* %0, i64 7
%89 = load float, float* %88
%90 = fsub float %87, %89
%91 = fcmp olt float %90, 0.000000e+00
%92 = load float, float* %45
br i1 %91, label %95, label %93
93: ; preds = %84
%94 = load float, float* %51
br label %100
95: ; preds = %84
%96 = fneg float %92
store float %96, float* %45
%97 = load float, float* %51
%98 = fneg float %97
store float %98, float* %51
%99 = fneg float %85
store float %99, float* %57
br label %100
100: ; preds = %93, %95, %15
%101 = phi float [ %85, %93 ], [ %99, %95 ], [ %36, %15 ]
%102 = phi float [ %94, %93 ], [ %98, %95 ], [ %29, %15 ]
%103 = phi float [ %92, %93 ], [ %96, %95 ], [ %22, %15 ]
%104 = load float, float* %1
%105 = fmul float %103, %103
%106 = tail call float @llvm.fmuladd.f32(float %104, float %104, float %105)
%107 = tail call float @llvm.fmuladd.f32(float %102, float %102, float %106)
%108 = tail call float @llvm.fmuladd.f32(float %101, float %101, float %107)
%109 = tail call float @sqrt(float %108)
%110 = bitcast float* %1 to <4 x float>*
%111 = load <4 x float>, <4 x float>* %110
%112 = insertelement <4 x float> poison, float %109, i64 0
%113 = shufflevector <4 x float> %112, <4 x float> poison, <4 x i32> zeroinitializer
%114 = fdiv <4 x float> %111, %113
%115 = bitcast float* %1 to <4 x float>*
store <4 x float> %114, <4 x float>* %115
ret void
}