#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*/ memcpy(double *, double *, int);
void bot_quat_rotate(const double rot[4], double v[3]) {
  double ab = rot[0] * rot[1], ac = rot[0] * rot[2], ad = rot[0] * rot[3];
  double nbb = -rot[1] * rot[1], bc = rot[1] * rot[2], bd = rot[1] * rot[3];
  double ncc = -rot[2] * rot[2], cd = rot[2] * rot[3], ndd = -rot[3] * rot[3];
  double result[] = {
      2 * ((ncc + ndd) * v[0] + (bc - ad) * v[1] + (ac + bd) * v[2]) + v[0],
      2 * ((ad + bc) * v[0] + (nbb + ndd) * v[1] + (cd - ab) * v[2]) + v[1],
      2 * ((bd - ac) * v[0] + (ab + cd) * v[1] + (nbb + ncc) * v[2]) + v[2]};
  memcpy(v, result, 3 * sizeof(double));
}


x86 assembly (clang, -O0):
<bot_quat_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm1
addsd  -0x58(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x38(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x28(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x30(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x18(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_quat_rotate>:
sub    $0x18,%rsp
mov    %rsi,%rax
movupd (%rdi),%xmm3
movupd 0x10(%rdi),%xmm5
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
movapd 0xecf(%rip),%xmm8
movapd %xmm1,%xmm10
xorpd  %xmm8,%xmm10
mulsd  %xmm1,%xmm10
movapd %xmm5,%xmm7
unpckhpd %xmm5,%xmm7
movapd %xmm3,%xmm1
unpckhpd %xmm5,%xmm1
mulpd  %xmm3,%xmm1
movapd %xmm1,%xmm9
shufpd $0x1,%xmm1,%xmm9
movapd %xmm3,%xmm6
shufpd $0x1,%xmm5,%xmm6
movapd %xmm5,%xmm2
movapd %xmm5,%xmm4
shufpd $0x1,%xmm3,%xmm4
unpcklpd %xmm5,%xmm3
mulpd  %xmm5,%xmm3
xorpd  %xmm8,%xmm7
shufpd $0x2,%xmm5,%xmm7
xorpd  %xmm8,%xmm5
unpcklpd %xmm5,%xmm2
mulpd  %xmm6,%xmm2
movapd %xmm2,%xmm6
shufpd $0x1,%xmm2,%xmm6
mulpd  %xmm4,%xmm7
movupd (%rsi),%xmm5
movsd  0x10(%rsi),%xmm8
addpd  %xmm7,%xmm6
movapd %xmm2,%xmm4
unpcklpd %xmm10,%xmm4
shufpd $0x1,%xmm7,%xmm7
movapd %xmm2,%xmm0
subpd  %xmm7,%xmm0
addpd  %xmm4,%xmm7
movsd  %xmm0,%xmm7
movapd %xmm5,%xmm0
unpckhpd %xmm5,%xmm0
mulpd  %xmm7,%xmm0
movapd %xmm5,%xmm7
unpcklpd %xmm5,%xmm7
mulpd  %xmm6,%xmm7
addpd  %xmm0,%xmm7
movapd %xmm3,%xmm6
unpckhpd %xmm1,%xmm1
subsd  %xmm3,%xmm1
addpd  %xmm9,%xmm3
subpd  %xmm9,%xmm6
movsd  %xmm3,%xmm6
mulpd  %xmm5,%xmm3
unpckhpd %xmm3,%xmm3
mulsd  %xmm5,%xmm1
addsd  %xmm3,%xmm1
unpckhpd %xmm2,%xmm2
addsd  %xmm10,%xmm2
mulsd  %xmm8,%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm2
addsd  %xmm8,%xmm2
unpcklpd %xmm8,%xmm8
mulpd  %xmm6,%xmm8
addpd  %xmm7,%xmm8
addpd  %xmm8,%xmm8
addpd  %xmm5,%xmm8
movapd %xmm8,(%rsp)
movsd  %xmm2,0x10(%rsp)
mov    %rsp,%rsi
mov    %rax,%rdi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @bot_quat_rotate(double* %0, double* %1) {
%3 = alloca double*
%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 double
%14 = alloca [3 x double]
store double* %0, double** %3
store double* %1, double** %4
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = fmul double %17, %20
store double %21, double* %5
%22 = load double*, double** %3
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double*, double** %3
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = fmul double %24, %27
store double %28, double* %6
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = load double*, double** %3
%33 = getelementptr inbounds double, double* %32, i64 3
%34 = load double, double* %33
%35 = fmul double %31, %34
store double %35, double* %7
%36 = load double*, double** %3
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
%39 = fneg double %38
%40 = load double*, double** %3
%41 = getelementptr inbounds double, double* %40, i64 1
%42 = load double, double* %41
%43 = fmul double %39, %42
store double %43, double* %8
%44 = load double*, double** %3
%45 = getelementptr inbounds double, double* %44, i64 1
%46 = load double, double* %45
%47 = load double*, double** %3
%48 = getelementptr inbounds double, double* %47, i64 2
%49 = load double, double* %48
%50 = fmul double %46, %49
store double %50, double* %9
%51 = load double*, double** %3
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
%54 = load double*, double** %3
%55 = getelementptr inbounds double, double* %54, i64 3
%56 = load double, double* %55
%57 = fmul double %53, %56
store double %57, double* %10
%58 = load double*, double** %3
%59 = getelementptr inbounds double, double* %58, i64 2
%60 = load double, double* %59
%61 = fneg double %60
%62 = load double*, double** %3
%63 = getelementptr inbounds double, double* %62, i64 2
%64 = load double, double* %63
%65 = fmul double %61, %64
store double %65, double* %11
%66 = load double*, double** %3
%67 = getelementptr inbounds double, double* %66, i64 2
%68 = load double, double* %67
%69 = load double*, double** %3
%70 = getelementptr inbounds double, double* %69, i64 3
%71 = load double, double* %70
%72 = fmul double %68, %71
store double %72, double* %12
%73 = load double*, double** %3
%74 = getelementptr inbounds double, double* %73, i64 3
%75 = load double, double* %74
%76 = fneg double %75
%77 = load double*, double** %3
%78 = getelementptr inbounds double, double* %77, i64 3
%79 = load double, double* %78
%80 = fmul double %76, %79
store double %80, double* %13
%81 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%82 = load double, double* %11
%83 = load double, double* %13
%84 = fadd double %82, %83
%85 = load double*, double** %4
%86 = getelementptr inbounds double, double* %85, i64 0
%87 = load double, double* %86
%88 = load double, double* %9
%89 = load double, double* %7
%90 = fsub double %88, %89
%91 = load double*, double** %4
%92 = getelementptr inbounds double, double* %91, i64 1
%93 = load double, double* %92
%94 = fmul double %90, %93
%95 = call double @llvm.fmuladd.f64(double %84, double %87, double %94)
%96 = load double, double* %6
%97 = load double, double* %10
%98 = fadd double %96, %97
%99 = load double*, double** %4
%100 = getelementptr inbounds double, double* %99, i64 2
%101 = load double, double* %100
%102 = call double @llvm.fmuladd.f64(double %98, double %101, double %95)
%103 = load double*, double** %4
%104 = getelementptr inbounds double, double* %103, i64 0
%105 = load double, double* %104
%106 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %102, double %105)
store double %106, double* %81
%107 = getelementptr inbounds double, double* %81, i64 1
%108 = load double, double* %7
%109 = load double, double* %9
%110 = fadd double %108, %109
%111 = load double*, double** %4
%112 = getelementptr inbounds double, double* %111, i64 0
%113 = load double, double* %112
%114 = load double, double* %8
%115 = load double, double* %13
%116 = fadd double %114, %115
%117 = load double*, double** %4
%118 = getelementptr inbounds double, double* %117, i64 1
%119 = load double, double* %118
%120 = fmul double %116, %119
%121 = call double @llvm.fmuladd.f64(double %110, double %113, double %120)
%122 = load double, double* %12
%123 = load double, double* %5
%124 = fsub double %122, %123
%125 = load double*, double** %4
%126 = getelementptr inbounds double, double* %125, i64 2
%127 = load double, double* %126
%128 = call double @llvm.fmuladd.f64(double %124, double %127, double %121)
%129 = load double*, double** %4
%130 = getelementptr inbounds double, double* %129, i64 1
%131 = load double, double* %130
%132 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %128, double %131)
store double %132, double* %107
%133 = getelementptr inbounds double, double* %107, i64 1
%134 = load double, double* %10
%135 = load double, double* %6
%136 = fsub double %134, %135
%137 = load double*, double** %4
%138 = getelementptr inbounds double, double* %137, i64 0
%139 = load double, double* %138
%140 = load double, double* %5
%141 = load double, double* %12
%142 = fadd double %140, %141
%143 = load double*, double** %4
%144 = getelementptr inbounds double, double* %143, i64 1
%145 = load double, double* %144
%146 = fmul double %142, %145
%147 = call double @llvm.fmuladd.f64(double %136, double %139, double %146)
%148 = load double, double* %8
%149 = load double, double* %11
%150 = fadd double %148, %149
%151 = load double*, double** %4
%152 = getelementptr inbounds double, double* %151, i64 2
%153 = load double, double* %152
%154 = call double @llvm.fmuladd.f64(double %150, double %153, double %147)
%155 = load double*, double** %4
%156 = getelementptr inbounds double, double* %155, i64 2
%157 = load double, double* %156
%158 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %154, double %157)
store double %158, double* %133
%159 = load double*, double** %4
%160 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%161 = call i32 @memcpy(double* %159, double* %160, i32 24)
ret void
}

LLVM IR (-O2):
define void @bot_quat_rotate(double* nocapture %0, double* %1) {
%3 = alloca [3 x double]
%4 = bitcast double* %0 to <2 x double>*
%5 = load <2 x double>, <2 x double>* %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = bitcast double* %6 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = extractelement <2 x double> %5, i64 1
%10 = fneg double %9
%11 = fmul double %9, %10
%12 = shufflevector <2 x double> %5, <2 x double> undef, <2 x i32> <i32 1, i32 undef>
%13 = extractelement <2 x double> %8, i64 1
%14 = shufflevector <2 x double> %12, <2 x double> %8, <2 x i32> <i32 0, i32 3>
%15 = fmul <2 x double> %5, %14
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%17 = extractelement <2 x double> %8, i64 0
%18 = fneg double %17
%19 = shufflevector <2 x double> %12, <2 x double> %8, <2 x i32> <i32 0, i32 2>
%20 = insertelement <2 x double> %8, double %18, i64 1
%21 = fmul <2 x double> %19, %20
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%23 = shufflevector <2 x double> %5, <2 x double> %8, <2 x i32> <i32 0, i32 2>
%24 = fmul <2 x double> %23, %8
%25 = fneg double %13
%26 = shufflevector <2 x double> %8, <2 x double> %5, <2 x i32> <i32 1, i32 2>
%27 = insertelement <2 x double> %8, double %25, i64 0
%28 = fmul <2 x double> %26, %27
%29 = bitcast [3 x double]* %3 to i8*
%30 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%31 = bitcast double* %1 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = getelementptr inbounds double, double* %1, i64 2
%34 = load double, double* %33
%35 = fadd <2 x double> %22, %28
%36 = insertelement <2 x double> %21, double %11, i64 1
%37 = shufflevector <2 x double> %28, <2 x double> undef, <2 x i32> <i32 1, i32 0>
%38 = fsub <2 x double> %36, %37
%39 = fadd <2 x double> %36, %37
%40 = shufflevector <2 x double> %38, <2 x double> %39, <2 x i32> <i32 0, i32 3>
%41 = shufflevector <2 x double> %32, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%42 = fmul <2 x double> %40, %41
%43 = extractelement <2 x double> %32, i64 0
%44 = shufflevector <2 x double> %32, <2 x double> undef, <2 x i32> zeroinitializer
%45 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %35, <2 x double> %44, <2 x double> %42)
%46 = fadd <2 x double> %24, %16
%47 = fsub <2 x double> %24, %16
%48 = shufflevector <2 x double> %46, <2 x double> %47, <2 x i32> <i32 0, i32 3>
%49 = insertelement <2 x double> poison, double %34, i64 0
%50 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
%51 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %50, <2 x double> %45)
%52 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %32)
%53 = bitcast [3 x double]* %3 to <2 x double>*
store <2 x double> %52, <2 x double>* %53
%54 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%55 = fsub <2 x double> %16, %24
%56 = extractelement <2 x double> %55, i64 0
%57 = fadd <2 x double> %16, %24
%58 = fmul <2 x double> %57, %32
%59 = extractelement <2 x double> %58, i64 1
%60 = tail call double @llvm.fmuladd.f64(double %56, double %43, double %59)
%61 = extractelement <2 x double> %21, i64 1
%62 = fadd double %11, %61
%63 = tail call double @llvm.fmuladd.f64(double %62, double %34, double %60)
%64 = tail call double @llvm.fmuladd.f64(double %63, double 2.000000e+00, double %34)
store double %64, double* %54
%65 = call i32 @memcpy(double* %1, double* %30, i32 24)
ret void
}