void bbox_3_tfm(double *out, const double x0[3], const double Ji[9],
                const double *x, const double *y, const double *z, unsigned n) {
  unsigned i;
  for (i = 0; i < n; ++i) {
    const double dx = x[i] - x0[0], dy = y[i] - x0[1], dz = z[i] - x0[2];
    out[i] = Ji[0] * dx + Ji[1] * dy + Ji[2] * dz;
    out[n + i] = Ji[3] * dx + Ji[4] * dy + Ji[5] * dz;
    out[2 * n + i] = Ji[6] * dx + Ji[7] * dy + Ji[8] * dz;
  }
}


x86 assembly (clang, -O0):
<bbox_3_tfm>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jae    126b <bbox_3_tfm+0x16b>
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    0x10(%rbp),%ecx
add    -0x34(%rbp),%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    0x10(%rbp),%ecx
shl    $0x1,%ecx
add    -0x34(%rbp),%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1126 <bbox_3_tfm+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbox_3_tfm>:
push   %rbx
mov    0x10(%rsp),%r10d
test   %r10d,%r10d
je     11bf <bbox_3_tfm+0xbf>
mov    %r10d,%r11d
add    %r10d,%r10d
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movsd  (%rcx,%rax,8),%xmm0
subsd  (%rsi),%xmm0
movsd  (%r8,%rax,8),%xmm2
subsd  0x8(%rsi),%xmm2
movsd  (%r9,%rax,8),%xmm1
subsd  0x10(%rsi),%xmm1
movsd  0x8(%rdx),%xmm3
mulsd  %xmm2,%xmm3
movsd  (%rdx),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
movsd  0x10(%rdx),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm3
movsd  %xmm3,(%rdi,%rax,8)
movsd  0x20(%rdx),%xmm3
mulsd  %xmm2,%xmm3
movsd  0x18(%rdx),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
movsd  0x28(%rdx),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm3
lea    (%r11,%rax,1),%ebx
movsd  %xmm3,(%rdi,%rbx,8)
mulsd  0x38(%rdx),%xmm2
mulsd  0x30(%rdx),%xmm0
addsd  %xmm2,%xmm0
mulsd  0x40(%rdx),%xmm1
addsd  %xmm0,%xmm1
lea    (%r10,%rax,1),%ebx
movsd  %xmm1,(%rdi,%rbx,8)
add    $0x1,%rax
cmp    %rax,%r11
jne    1120 <bbox_3_tfm+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @bbox_3_tfm(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, i32 %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
store i32 %6, i32* %14
store i32 0, i32* %15
br label %19
19: ; preds = %113, %7
%20 = load i32, i32* %15
%21 = load i32, i32* %14
%22 = icmp ult i32 %20, %21
br i1 %22, label %23, label %116
23: ; preds = %19
%24 = load double*, double** %11
%25 = load i32, i32* %15
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %9
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = fsub double %28, %31
store double %32, double* %16
%33 = load double*, double** %12
%34 = load i32, i32* %15
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %9
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
%41 = fsub double %37, %40
store double %41, double* %17
%42 = load double*, double** %13
%43 = load i32, i32* %15
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = load double*, double** %9
%48 = getelementptr inbounds double, double* %47, i64 2
%49 = load double, double* %48
%50 = fsub double %46, %49
store double %50, double* %18
%51 = load double*, double** %10
%52 = getelementptr inbounds double, double* %51, i64 0
%53 = load double, double* %52
%54 = load double, double* %16
%55 = load double*, double** %10
%56 = getelementptr inbounds double, double* %55, i64 1
%57 = load double, double* %56
%58 = load double, double* %17
%59 = fmul double %57, %58
%60 = call double @llvm.fmuladd.f64(double %53, double %54, double %59)
%61 = load double*, double** %10
%62 = getelementptr inbounds double, double* %61, i64 2
%63 = load double, double* %62
%64 = load double, double* %18
%65 = call double @llvm.fmuladd.f64(double %63, double %64, double %60)
%66 = load double*, double** %8
%67 = load i32, i32* %15
%68 = zext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %65, double* %69
%70 = load double*, double** %10
%71 = getelementptr inbounds double, double* %70, i64 3
%72 = load double, double* %71
%73 = load double, double* %16
%74 = load double*, double** %10
%75 = getelementptr inbounds double, double* %74, i64 4
%76 = load double, double* %75
%77 = load double, double* %17
%78 = fmul double %76, %77
%79 = call double @llvm.fmuladd.f64(double %72, double %73, double %78)
%80 = load double*, double** %10
%81 = getelementptr inbounds double, double* %80, i64 5
%82 = load double, double* %81
%83 = load double, double* %18
%84 = call double @llvm.fmuladd.f64(double %82, double %83, double %79)
%85 = load double*, double** %8
%86 = load i32, i32* %14
%87 = load i32, i32* %15
%88 = add i32 %86, %87
%89 = zext i32 %88 to i64
%90 = getelementptr inbounds double, double* %85, i64 %89
store double %84, double* %90
%91 = load double*, double** %10
%92 = getelementptr inbounds double, double* %91, i64 6
%93 = load double, double* %92
%94 = load double, double* %16
%95 = load double*, double** %10
%96 = getelementptr inbounds double, double* %95, i64 7
%97 = load double, double* %96
%98 = load double, double* %17
%99 = fmul double %97, %98
%100 = call double @llvm.fmuladd.f64(double %93, double %94, double %99)
%101 = load double*, double** %10
%102 = getelementptr inbounds double, double* %101, i64 8
%103 = load double, double* %102
%104 = load double, double* %18
%105 = call double @llvm.fmuladd.f64(double %103, double %104, double %100)
%106 = load double*, double** %8
%107 = load i32, i32* %14
%108 = mul i32 2, %107
%109 = load i32, i32* %15
%110 = add i32 %108, %109
%111 = zext i32 %110 to i64
%112 = getelementptr inbounds double, double* %106, i64 %111
store double %105, double* %112
br label %113
113: ; preds = %23
%114 = load i32, i32* %15
%115 = add i32 %114, 1
store i32 %115, i32* %15
br label %19
116: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @bbox_3_tfm(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, i32 %6) {
%8 = icmp eq i32 %6, 0
br i1 %8, label %64, label %9
9: ; preds = %7
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = getelementptr inbounds double, double* %2, i64 1
%13 = getelementptr inbounds double, double* %2, i64 2
%14 = getelementptr inbounds double, double* %2, i64 3
%15 = getelementptr inbounds double, double* %2, i64 4
%16 = getelementptr inbounds double, double* %2, i64 5
%17 = getelementptr inbounds double, double* %2, i64 6
%18 = getelementptr inbounds double, double* %2, i64 7
%19 = getelementptr inbounds double, double* %2, i64 8
%20 = shl i32 %6, 1
%21 = zext i32 %6 to i64
br label %22
22: ; preds = %9, %22
%23 = phi i64 [ 0, %9 ], [ %62, %22 ]
%24 = getelementptr inbounds double, double* %3, i64 %23
%25 = load double, double* %24
%26 = load double, double* %1
%27 = fsub double %25, %26
%28 = getelementptr inbounds double, double* %4, i64 %23
%29 = load double, double* %28
%30 = load double, double* %10
%31 = fsub double %29, %30
%32 = getelementptr inbounds double, double* %5, i64 %23
%33 = load double, double* %32
%34 = load double, double* %11
%35 = fsub double %33, %34
%36 = load double, double* %2
%37 = load double, double* %12
%38 = fmul double %31, %37
%39 = tail call double @llvm.fmuladd.f64(double %36, double %27, double %38)
%40 = load double, double* %13
%41 = tail call double @llvm.fmuladd.f64(double %40, double %35, double %39)
%42 = getelementptr inbounds double, double* %0, i64 %23
store double %41, double* %42
%43 = load double, double* %14
%44 = load double, double* %15
%45 = fmul double %31, %44
%46 = tail call double @llvm.fmuladd.f64(double %43, double %27, double %45)
%47 = load double, double* %16
%48 = tail call double @llvm.fmuladd.f64(double %47, double %35, double %46)
%49 = trunc i64 %23 to i32
%50 = add i32 %49, %6
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds double, double* %0, i64 %51
store double %48, double* %52
%53 = load double, double* %17
%54 = load double, double* %18
%55 = fmul double %31, %54
%56 = tail call double @llvm.fmuladd.f64(double %53, double %27, double %55)
%57 = load double, double* %19
%58 = tail call double @llvm.fmuladd.f64(double %57, double %35, double %56)
%59 = add i32 %20, %49
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds double, double* %0, i64 %60
store double %58, double* %61
%62 = add nuw nsw i64 %23, 1
%63 = icmp eq i64 %62, %21
br i1 %63, label %64, label %22
64: ; preds = %22, %7
ret void
}