#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*/ normq(double *);
int pow(double, int);
int /*<<< orphan*/ quatinv(double *, double *);
int /*<<< orphan*/ quatmul(double *, double *, double *);
scalar_t__ sign(double);
double sqrt(double);
int QuaternionFromAccel(double dQuatResult[4], double dAccel[3],
                        double dMag[3]) {
  double cos_theta, cos_theta_2, sin_theta_2, cos_phi, cos_phi_2, sin_phi_2;
  double dMag2[4];
  double dq[4], dqinv[4];
  double dq1[4];
  double dq2[4];
  double dq3[4];
  cos_theta = 1 / (sqrt(1 + pow((dAccel[0] / -dAccel[2]), 2)));
  cos_theta_2 = sqrt(0.5 * (1 + cos_theta));
  sin_theta_2 = sqrt(0.5 * (1 - cos_theta)) * (double)sign(dAccel[0]);
  cos_phi =
      1 /
      (sqrt(1 + pow((-dAccel[1] / sqrt(pow(dAccel[0], 2) + pow(dAccel[2], 2))),
                    2)));
  cos_phi_2 = sqrt(0.5 * (1 + cos_phi));
  sin_phi_2 = sqrt(0.5 * (1 - cos_phi)) * (double)sign(-dAccel[1]);
  dq[0] = cos_theta_2 * cos_phi_2;
  dq[1] = cos_theta_2 * sin_phi_2;
  dq[2] = sin_theta_2 * cos_phi_2;
  dq[3] = -sin_theta_2 * sin_phi_2;
  normq(dq);
  dMag2[0] = 0;
  dMag2[1] = dMag[0];
  dMag2[2] = dMag[1];
  dMag2[3] = dMag[2];
  normq(dMag2);
  quatinv(dqinv, dq);
  quatmul(dq1, dqinv, dMag2);
  quatmul(dq2, dq1, dq);
  normq(dq2);
  dq3[0] = -atan2(dq2[2], dq2[1]);
  dq3[1] = 0;
  dq3[2] = 0;
  dq3[3] = 1;
  quatmul(dQuatResult, dq, dq3);
  normq(dQuatResult);
  return 0;
}


x86 assembly (clang, -O0):
<QuaternionFromAccel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe2c(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe1b(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe16(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xdf8(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  0xdf3(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x130(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <sign@plt>
movsd  -0x130(%rbp),%xmm0
ff
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
mov    %eax,-0x124(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
mov    %eax,%ecx
mov    -0x124(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x120(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd21(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd10(%rip),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xd0b(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xced(%rip),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  0xce8(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x118(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1060 <sign@plt>
movsd  -0x118(%rbp),%xmm0
ff
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0x90(%rbp),%rdi
call   1070 <normq@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x70(%rbp),%rdi
call   1070 <normq@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1050 <quatinv@plt>
lea    -0xd0(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1040 <quatmul@plt>
lea    -0xf0(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1040 <quatmul@plt>
lea    -0xf0(%rbp),%rdi
call   1070 <normq@plt>
movsd  -0xe0(%rbp),%xmm0
ff
movsd  -0xe8(%rbp),%xmm1
ff
call   1030 <atan2@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  0xb53(%rip),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0x110(%rbp),%rdx
call   1040 <quatmul@plt>
mov    -0x8(%rbp),%rdi
call   1070 <normq@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QuaternionFromAccel>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  (%rsi),%xmm0
movsd  0x10(%rsi),%xmm1
xorpd  0xe67(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     11c1 <QuaternionFromAccel+0x51>
sqrtsd %xmm0,%xmm0
jmp    11ca <QuaternionFromAccel+0x5a>
call   1090 <sqrt@plt>
xorpd  %xmm2,%xmm2
movsd  0xe3e(%rip),%xmm1
movapd %xmm1,%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe2e(%rip),%xmm0
ucomisd %xmm2,%xmm0
jb     11f6 <QuaternionFromAccel+0x86>
sqrtsd %xmm0,%xmm0
jmp    120f <QuaternionFromAccel+0x9f>
movsd  %xmm3,0x10(%rsp)
call   1090 <sqrt@plt>
movsd  0x10(%rsp),%xmm3
movsd  0xe01(%rip),%xmm1
movapd %xmm0,0x40(%rsp)
movapd %xmm1,%xmm0
subsd  %xmm3,%xmm0
mulsd  0xdf3(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1235 <QuaternionFromAccel+0xc5>
sqrtsd %xmm0,%xmm0
jmp    123a <QuaternionFromAccel+0xca>
call   1090 <sqrt@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
call   1060 <sign@plt>
mov    %rax,%r12
movsd  0x8(%rbx),%xmm0
xorps  0xda8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movsd  (%rbx),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
mov    %eax,%ebp
movsd  0x10(%rbx),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd 0xd93(%rip),%xmm0
jb     1295 <QuaternionFromAccel+0x125>
sqrtsd %xmm0,%xmm0
jmp    129a <QuaternionFromAccel+0x12a>
call   1090 <sqrt@plt>
movapd 0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
jb     12cc <QuaternionFromAccel+0x15c>
sqrtsd %xmm0,%xmm0
jmp    12d5 <QuaternionFromAccel+0x165>
call   1090 <sqrt@plt>
xorpd  %xmm4,%xmm4
movsd  0xd33(%rip),%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %r12,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xd1b(%rip),%xmm0
ucomisd %xmm4,%xmm0
jb     1309 <QuaternionFromAccel+0x199>
sqrtsd %xmm0,%xmm0
jmp    132e <QuaternionFromAccel+0x1be>
movsd  %xmm2,0x8(%rsp)
movsd  %xmm3,0x38(%rsp)
call   1090 <sqrt@plt>
movsd  0x38(%rsp),%xmm3
movsd  0x8(%rsp),%xmm2
movsd  0xce2(%rip),%xmm1
movapd %xmm0,0x20(%rsp)
subsd  %xmm3,%xmm1
mulsd  0xcd8(%rip),%xmm1
movapd 0x10(%rsp),%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     1363 <QuaternionFromAccel+0x1f3>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    136c <QuaternionFromAccel+0x1fc>
movapd %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx),%xmm0
xorps  0xc82(%rip),%xmm0
call   1060 <sign@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mulsd  0x8(%rsp),%xmm0
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm2,%xmm2
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm1
movapd 0x20(%rsp),%xmm4
mulsd  %xmm4,%xmm1
unpcklpd %xmm0,%xmm4
mulpd  %xmm2,%xmm4
movapd %xmm4,0x70(%rsp)
movsd  %xmm1,0x80(%rsp)
xorpd  0xc32(%rip),%xmm3
mulsd  %xmm0,%xmm3
movsd  %xmm3,0x88(%rsp)
lea    0x70(%rsp),%r12
mov    %r12,%rdi
call   1070 <normq@plt>
movq   $0x0,0x90(%rsp)
movups (%r15),%xmm0
movups %xmm0,0x98(%rsp)
movsd  0x10(%r15),%xmm0
movsd  %xmm0,0xa8(%rsp)
lea    0x90(%rsp),%r15
mov    %r15,%rdi
call   1070 <normq@plt>
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <quatinv@plt>
lea    0xd0(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <quatmul@plt>
lea    0xb0(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1040 <quatmul@plt>
mov    %rbx,%rdi
call   1070 <normq@plt>
movsd  0xb8(%rsp),%xmm1
movsd  0xc0(%rsp),%xmm0
call   1030 <atan2@plt>
xorps  0xb7c(%rip),%xmm0
movlps %xmm0,0x50(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x58(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x68(%rsp)
lea    0x50(%rsp),%rdx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <quatmul@plt>
mov    %r14,%rdi
call   1070 <normq@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @QuaternionFromAccel(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca [4 x double]
%14 = alloca [4 x double]
%15 = alloca [4 x double]
%16 = alloca [4 x double]
%17 = alloca [4 x double]
%18 = alloca [4 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load double*, double** %5
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = fneg double %24
%26 = fdiv double %21, %25
%27 = call i32 @pow(double %26, i32 2)
%28 = add nsw i32 1, %27
%29 = sitofp i32 %28 to double
%30 = call double @sqrt(double %29)
%31 = fdiv double 1.000000e+00, %30
store double %31, double* %7
%32 = load double, double* %7
%33 = fadd double 1.000000e+00, %32
%34 = fmul double 5.000000e-01, %33
%35 = call double @sqrt(double %34)
store double %35, double* %8
%36 = load double, double* %7
%37 = fsub double 1.000000e+00, %36
%38 = fmul double 5.000000e-01, %37
%39 = call double @sqrt(double %38)
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = call i64 @sign(double %42)
%44 = sitofp i64 %43 to double
%45 = fmul double %39, %44
store double %45, double* %9
%46 = load double*, double** %5
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = fneg double %48
%50 = load double*, double** %5
%51 = getelementptr inbounds double, double* %50, i64 0
%52 = load double, double* %51
%53 = call i32 @pow(double %52, i32 2)
%54 = load double*, double** %5
%55 = getelementptr inbounds double, double* %54, i64 2
%56 = load double, double* %55
%57 = call i32 @pow(double %56, i32 2)
%58 = add nsw i32 %53, %57
%59 = sitofp i32 %58 to double
%60 = call double @sqrt(double %59)
%61 = fdiv double %49, %60
%62 = call i32 @pow(double %61, i32 2)
%63 = add nsw i32 1, %62
%64 = sitofp i32 %63 to double
%65 = call double @sqrt(double %64)
%66 = fdiv double 1.000000e+00, %65
store double %66, double* %10
%67 = load double, double* %10
%68 = fadd double 1.000000e+00, %67
%69 = fmul double 5.000000e-01, %68
%70 = call double @sqrt(double %69)
store double %70, double* %11
%71 = load double, double* %10
%72 = fsub double 1.000000e+00, %71
%73 = fmul double 5.000000e-01, %72
%74 = call double @sqrt(double %73)
%75 = load double*, double** %5
%76 = getelementptr inbounds double, double* %75, i64 1
%77 = load double, double* %76
%78 = fneg double %77
%79 = call i64 @sign(double %78)
%80 = sitofp i64 %79 to double
%81 = fmul double %74, %80
store double %81, double* %12
%82 = load double, double* %8
%83 = load double, double* %11
%84 = fmul double %82, %83
%85 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
store double %84, double* %85
%86 = load double, double* %8
%87 = load double, double* %12
%88 = fmul double %86, %87
%89 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 1
store double %88, double* %89
%90 = load double, double* %9
%91 = load double, double* %11
%92 = fmul double %90, %91
%93 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 2
store double %92, double* %93
%94 = load double, double* %9
%95 = fneg double %94
%96 = load double, double* %12
%97 = fmul double %95, %96
%98 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 3
store double %97, double* %98
%99 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%100 = call i32 @normq(double* %99)
%101 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
store double 0.000000e+00, double* %101
%102 = load double*, double** %6
%103 = getelementptr inbounds double, double* %102, i64 0
%104 = load double, double* %103
%105 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 1
store double %104, double* %105
%106 = load double*, double** %6
%107 = getelementptr inbounds double, double* %106, i64 1
%108 = load double, double* %107
%109 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 2
store double %108, double* %109
%110 = load double*, double** %6
%111 = getelementptr inbounds double, double* %110, i64 2
%112 = load double, double* %111
%113 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 3
store double %112, double* %113
%114 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%115 = call i32 @normq(double* %114)
%116 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%117 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%118 = call i32 @quatinv(double* %116, double* %117)
%119 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%120 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%121 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%122 = call i32 @quatmul(double* %119, double* %120, double* %121)
%123 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0, i64 0
%124 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%125 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%126 = call i32 @quatmul(double* %123, double* %124, double* %125)
%127 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0, i64 0
%128 = call i32 @normq(double* %127)
%129 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0, i64 2
%130 = load double, double* %129
%131 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0, i64 1
%132 = load double, double* %131
%133 = call double @atan2(double %130, double %132)
%134 = fneg double %133
%135 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 0
store double %134, double* %135
%136 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 1
store double 0.000000e+00, double* %136
%137 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 2
store double 0.000000e+00, double* %137
%138 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 3
store double 1.000000e+00, double* %138
%139 = load double*, double** %4
%140 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%141 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 0
%142 = call i32 @quatmul(double* %139, double* %140, double* %141)
%143 = load double*, double** %4
%144 = call i32 @normq(double* %143)
ret i32 0
}

LLVM IR (-O2):
define i32 @QuaternionFromAccel(double* %0, double* nocapture %1, double* nocapture %2) {
%4 = alloca [4 x double]
%5 = alloca [4 x double]
%6 = alloca [4 x double]
%7 = alloca [4 x double]
%8 = alloca [4 x double]
%9 = alloca [4 x double]
%10 = bitcast [4 x double]* %4 to i8*
%11 = bitcast [4 x double]* %5 to i8*
%12 = bitcast [4 x double]* %6 to i8*
%13 = bitcast [4 x double]* %7 to i8*
%14 = bitcast [4 x double]* %8 to i8*
%15 = bitcast [4 x double]* %9 to i8*
%16 = load double, double* %1
%17 = getelementptr inbounds double, double* %1, i64 2
%18 = load double, double* %17
%19 = fneg double %18
%20 = fdiv double %16, %19
%21 = tail call i32 @pow(double %20, i32 2)
%22 = add nsw i32 %21, 1
%23 = sitofp i32 %22 to double
%24 = tail call double @sqrt(double %23)
%25 = fdiv double 1.000000e+00, %24
%26 = fadd double %25, 1.000000e+00
%27 = fmul double %26, 5.000000e-01
%28 = tail call double @sqrt(double %27)
%29 = fsub double 1.000000e+00, %25
%30 = fmul double %29, 5.000000e-01
%31 = tail call double @sqrt(double %30)
%32 = load double, double* %1
%33 = tail call i64 @sign(double %32)
%34 = sitofp i64 %33 to double
%35 = fmul double %31, %34
%36 = getelementptr inbounds double, double* %1, i64 1
%37 = load double, double* %36
%38 = fneg double %37
%39 = load double, double* %1
%40 = tail call i32 @pow(double %39, i32 2)
%41 = load double, double* %17
%42 = tail call i32 @pow(double %41, i32 2)
%43 = add nsw i32 %42, %40
%44 = sitofp i32 %43 to double
%45 = tail call double @sqrt(double %44)
%46 = fdiv double %38, %45
%47 = tail call i32 @pow(double %46, i32 2)
%48 = add nsw i32 %47, 1
%49 = sitofp i32 %48 to double
%50 = tail call double @sqrt(double %49)
%51 = fdiv double 1.000000e+00, %50
%52 = fadd double %51, 1.000000e+00
%53 = fmul double %52, 5.000000e-01
%54 = tail call double @sqrt(double %53)
%55 = fsub double 1.000000e+00, %51
%56 = fmul double %55, 5.000000e-01
%57 = tail call double @sqrt(double %56)
%58 = load double, double* %36
%59 = fneg double %58
%60 = tail call i64 @sign(double %59)
%61 = sitofp i64 %60 to double
%62 = fmul double %57, %61
%63 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%64 = insertelement <2 x double> poison, double %28, i64 0
%65 = shufflevector <2 x double> %64, <2 x double> poison, <2 x i32> zeroinitializer
%66 = insertelement <2 x double> poison, double %54, i64 0
%67 = insertelement <2 x double> %66, double %62, i64 1
%68 = fmul <2 x double> %65, %67
%69 = bitcast [4 x double]* %5 to <2 x double>*
store <2 x double> %68, <2 x double>* %69
%70 = fmul double %35, %54
%71 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
store double %70, double* %71
%72 = fneg double %35
%73 = fmul double %62, %72
%74 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 3
store double %73, double* %74
%75 = call i32 @normq(double* %63)
%76 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
store double 0.000000e+00, double* %76
%77 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 1
%78 = bitcast double* %2 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = bitcast double* %77 to <2 x double>*
store <2 x double> %79, <2 x double>* %80
%81 = getelementptr inbounds double, double* %2, i64 2
%82 = load double, double* %81
%83 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 3
store double %82, double* %83
%84 = call i32 @normq(double* %76)
%85 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%86 = call i32 @quatinv(double* %85, double* %63)
%87 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%88 = call i32 @quatmul(double* %87, double* %85, double* %76)
%89 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
%90 = call i32 @quatmul(double* %89, double* %87, double* %63)
%91 = call i32 @normq(double* %89)
%92 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 2
%93 = load double, double* %92
%94 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 1
%95 = load double, double* %94
%96 = call double @atan2(double %93, double %95)
%97 = fneg double %96
%98 = getelementptr inbounds [4 x double], [4 x double]* %9, i64 0, i64 0
store double %97, double* %98
%99 = getelementptr inbounds [4 x double], [4 x double]* %9, i64 0, i64 1
%100 = getelementptr inbounds [4 x double], [4 x double]* %9, i64 0, i64 3
%101 = bitcast double* %99 to i8*
store double 1.000000e+00, double* %100
%102 = call i32 @quatmul(double* %0, double* %63, double* %98)
%103 = call i32 @normq(double* %0)
ret i32 0
}