void bot_quat_rotate_and_translate(const double rot[4], const double t[3],
                                   const double v[3], double r[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];
  r[0] = 2 * ((ncc + ndd) * v[0] + (bc - ad) * v[1] + (ac + bd) * v[2]) + v[0] +
         t[0];
  r[1] = 2 * ((ad + bc) * v[0] + (nbb + ndd) * v[1] + (cd - ab) * v[2]) + v[1] +
         t[1];
  r[2] = 2 * ((bd - ac) * v[0] + (ab + cd) * v[1] + (nbb + ncc) * v[2]) + v[2] +
         t[2];
}


x86 assembly (clang, -O0):
<bot_quat_rotate_and_translate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x38(%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,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x50(%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,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x60(%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,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm1
addsd  -0x68(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x48(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x40(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x50(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x28(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_quat_rotate_and_translate>:
movsd  (%rdi),%xmm6
movsd  0x8(%rdi),%xmm4
movapd %xmm6,%xmm8
mulsd  %xmm4,%xmm8
movsd  0x10(%rdi),%xmm1
movapd %xmm6,%xmm9
mulsd  %xmm1,%xmm9
movsd  0x18(%rdi),%xmm5
mulsd  %xmm5,%xmm6
movapd 0xecd(%rip),%xmm3
movapd %xmm4,%xmm10
xorpd  %xmm3,%xmm10
mulsd  %xmm4,%xmm10
movapd %xmm4,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm5,%xmm4
movapd %xmm1,%xmm2
xorpd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm5,%xmm1
xorpd  %xmm5,%xmm3
mulsd  %xmm5,%xmm3
movapd %xmm2,%xmm5
addsd  %xmm3,%xmm5
movapd %xmm0,%xmm7
subsd  %xmm6,%xmm7
mulsd  0x8(%rdx),%xmm7
movsd  (%rdx),%xmm11
mulsd  %xmm11,%xmm5
addsd  %xmm7,%xmm5
movapd %xmm9,%xmm7
addsd  %xmm4,%xmm7
mulsd  0x10(%rdx),%xmm7
addsd  %xmm5,%xmm7
addsd  %xmm7,%xmm7
addsd  %xmm11,%xmm7
addsd  (%rsi),%xmm7
movsd  %xmm7,(%rcx)
addsd  %xmm6,%xmm0
addsd  %xmm10,%xmm3
movsd  0x8(%rdx),%xmm5
mulsd  %xmm5,%xmm3
mulsd  (%rdx),%xmm0
addsd  %xmm3,%xmm0
movapd %xmm1,%xmm3
subsd  %xmm8,%xmm3
mulsd  0x10(%rdx),%xmm3
addsd  %xmm0,%xmm3
addsd  %xmm3,%xmm3
addsd  %xmm5,%xmm3
addsd  0x8(%rsi),%xmm3
movsd  %xmm3,0x8(%rcx)
subsd  %xmm9,%xmm4
addsd  %xmm8,%xmm1
mulsd  0x8(%rdx),%xmm1
mulsd  (%rdx),%xmm4
addsd  %xmm1,%xmm4
addsd  %xmm10,%xmm2
movsd  0x10(%rdx),%xmm0
mulsd  %xmm0,%xmm2
addsd  %xmm4,%xmm2
addsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
addsd  0x10(%rsi),%xmm2
movsd  %xmm2,0x10(%rcx)
ret

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

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