void set_box(double box[3][3], double *h, double *h_inv) {
  h[0] = box[1][0] - box[0][0];
  h[1] = box[1][1] - box[0][1];
  h[2] = box[1][2] - box[0][2];
  h_inv[0] = 1.0 / h[0];
  h_inv[1] = 1.0 / h[1];
  h_inv[2] = 1.0 / h[2];
  h[3] = box[2][2];
  h[4] = box[2][1];
  h[5] = box[2][0];
  h_inv[3] = -h[3] / (h[1] * h[2]);
  h_inv[4] = (h[3] * h[5] - h[1] * h[4]) / (h[0] * h[1] * h[2]);
  h_inv[5] = -h[5] / (h[0] * h[1]);
}


x86 assembly (clang, -O0):
<set_box>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe95(%rip),%xmm0
divsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe7d(%rip),%xmm0
divsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe63(%rip),%xmm0
divsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_box>:
movsd  0x18(%rdi),%xmm0
subsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x20(%rdi),%xmm1
subsd  0x8(%rdi),%xmm1
movsd  %xmm1,0x8(%rsi)
movsd  0x28(%rdi),%xmm1
subsd  0x10(%rdi),%xmm1
movsd  %xmm1,0x10(%rsi)
movsd  0xecd(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,(%rdx)
movapd %xmm1,%xmm0
divsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
divsd  0x10(%rsi),%xmm1
movsd  %xmm1,0x10(%rdx)
movsd  0x40(%rdi),%xmm0
movsd  %xmm0,0x18(%rsi)
movsd  0x38(%rdi),%xmm1
movsd  %xmm1,0x20(%rsi)
movsd  0x30(%rdi),%xmm1
movsd  %xmm1,0x28(%rsi)
movapd 0xe93(%rip),%xmm1
xorpd  %xmm1,%xmm0
movsd  0x8(%rsi),%xmm2
mulsd  0x10(%rsi),%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rdx)
movsd  0x8(%rsi),%xmm0
movsd  0x18(%rsi),%xmm2
movsd  0x20(%rsi),%xmm3
mulsd  %xmm0,%xmm3
mulsd  0x28(%rsi),%xmm2
mulsd  (%rsi),%xmm0
subsd  %xmm3,%xmm2
mulsd  0x10(%rsi),%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,0x20(%rdx)
movsd  0x28(%rsi),%xmm0
xorpd  %xmm1,%xmm0
movsd  (%rsi),%xmm1
mulsd  0x8(%rsi),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rdx)
ret

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

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