void corner_dlauum_nt_3x3_lib4(double *A, double *B, int alg, double *C,
                               double *D) {
  const int bs = 4;
  double a_0, a_1, a_2, b_0, b_1, b_2, d_00, d_10, d_11, d_20, d_21, d_22;
  a_0 = A[0 + bs * 0];
  b_0 = B[0 + bs * 0];
  d_00 = a_0 * b_0;
  a_0 = A[0 + bs * 1];
  a_1 = A[1 + bs * 1];
  b_0 = B[0 + bs * 1];
  b_1 = B[1 + bs * 1];
  d_00 += a_0 * b_0;
  d_10 = a_1 * b_0;
  d_11 = a_1 * b_1;
  a_0 = A[0 + bs * 2];
  a_1 = A[1 + bs * 2];
  a_2 = A[2 + bs * 2];
  b_0 = B[0 + bs * 2];
  b_1 = B[1 + bs * 2];
  b_2 = B[2 + bs * 2];
  d_00 += a_0 * b_0;
  d_10 += a_1 * b_0;
  d_11 += a_1 * b_1;
  d_20 = a_2 * b_0;
  d_21 = a_2 * b_1;
  d_22 = a_2 * b_2;
  if (alg != 0) {
    if (alg == 1) {
      d_00 = C[0 + bs * 0] + d_00;
      d_10 = C[1 + bs * 0] + d_10;
      d_11 = C[1 + bs * 1] + d_11;
      d_20 = C[2 + bs * 0] + d_20;
      d_21 = C[2 + bs * 1] + d_21;
      d_22 = C[2 + bs * 2] + d_22;
    } else {
      d_00 = C[0 + bs * 0] - d_00;
      d_10 = C[1 + bs * 0] - d_10;
      d_11 = C[1 + bs * 1] - d_11;
      d_20 = C[2 + bs * 0] - d_20;
      d_21 = C[2 + bs * 1] - d_21;
      d_22 = C[2 + bs * 2] - d_22;
    }
  }
  D[0 + bs * 0] = d_00;
  D[1 + bs * 0] = d_10;
  D[1 + bs * 1] = d_11;
  D[2 + bs * 0] = d_20;
  D[2 + bs * 1] = d_21;
  D[2 + bs * 2] = d_22;
}


x86 assembly (clang, -O0):
<corner_dlauum_nt_3x3_lib4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x4,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x50(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
cmpl   $0x0,-0x14(%rbp)
je     13b0 <corner_dlauum_nt_3x3_lib4+0x2b0>
cmpl   $0x1,-0x14(%rbp)
jne    132e <corner_dlauum_nt_3x3_lib4+0x22e>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x28(%rax),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x30(%rax),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  0x50(%rax),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
jmp    13ab <corner_dlauum_nt_3x3_lib4+0x2ab>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x28(%rax),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
subsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x30(%rax),%xmm0
subsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  0x50(%rax),%xmm0
subsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
jmp    13b0 <corner_dlauum_nt_3x3_lib4+0x2b0>
movsd  -0x68(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x78(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x80(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x50(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<corner_dlauum_nt_3x3_lib4>:
movsd  (%rdi),%xmm0
movsd  0x28(%rdi),%xmm3
mulsd  (%rsi),%xmm0
movsd  0x20(%rsi),%xmm1
movsd  0x20(%rdi),%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm3,%xmm1
unpcklpd %xmm1,%xmm4
mulsd  0x28(%rsi),%xmm3
movupd 0x40(%rdi),%xmm1
movsd  0x50(%rdi),%xmm5
movsd  0x48(%rsi),%xmm6
movsd  0x40(%rsi),%xmm0
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm4,%xmm2
unpckhpd %xmm1,%xmm1
mulsd  %xmm6,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm5,%xmm6
unpcklpd %xmm6,%xmm1
unpcklpd %xmm5,%xmm5
movhpd 0x50(%rsi),%xmm0
mulpd  %xmm5,%xmm0
test   %edx,%edx
je     11c6 <corner_dlauum_nt_3x3_lib4+0xc6>
cmp    $0x1,%edx
jne    119b <corner_dlauum_nt_3x3_lib4+0x9b>
movupd (%rcx),%xmm3
addpd  %xmm3,%xmm2
movupd 0x28(%rcx),%xmm3
addpd  %xmm3,%xmm1
movsd  0x10(%rcx),%xmm3
movhpd 0x50(%rcx),%xmm3
addpd  %xmm3,%xmm0
jmp    11c6 <corner_dlauum_nt_3x3_lib4+0xc6>
movupd (%rcx),%xmm3
subpd  %xmm2,%xmm3
movupd 0x28(%rcx),%xmm4
subpd  %xmm1,%xmm4
movsd  0x10(%rcx),%xmm5
movhpd 0x50(%rcx),%xmm5
subpd  %xmm0,%xmm5
movapd %xmm3,%xmm2
movapd %xmm4,%xmm1
movapd %xmm5,%xmm0
movupd %xmm2,(%r8)
movlpd %xmm0,0x10(%r8)
movupd %xmm1,0x28(%r8)
movhpd %xmm0,0x50(%r8)
ret

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

LLVM IR (-O2):
define void @corner_dlauum_nt_3x3_lib4(double* nocapture %0, double* nocapture %1, i32 %2, double* nocapture %3, double* nocapture writeonly %4) {
%6 = load double, double* %0
%7 = load double, double* %1
%8 = fmul double %6, %7
%9 = getelementptr inbounds double, double* %0, i64 4
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %0, i64 5
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 4
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 5
%16 = load double, double* %15
%17 = tail call double @llvm.fmuladd.f64(double %10, double %14, double %8)
%18 = fmul double %12, %14
%19 = fmul double %12, %16
%20 = getelementptr inbounds double, double* %0, i64 8
%21 = bitcast double* %20 to <2 x double>*
%22 = load <2 x double>, <2 x double>* %21
%23 = getelementptr inbounds double, double* %0, i64 10
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %1, i64 8
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %1, i64 9
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %1, i64 10
%30 = load double, double* %29
%31 = insertelement <2 x double> poison, double %26, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = insertelement <2 x double> poison, double %17, i64 0
%34 = insertelement <2 x double> %33, double %18, i64 1
%35 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %32, <2 x double> %34)
%36 = extractelement <2 x double> %22, i64 1
%37 = tail call double @llvm.fmuladd.f64(double %36, double %28, double %19)
%38 = fmul double %24, %28
%39 = insertelement <2 x double> poison, double %24, i64 0
%40 = shufflevector <2 x double> %39, <2 x double> poison, <2 x i32> zeroinitializer
%41 = insertelement <2 x double> %31, double %30, i64 1
%42 = fmul <2 x double> %40, %41
%43 = insertelement <2 x double> poison, double %37, i64 0
%44 = insertelement <2 x double> %43, double %38, i64 1
switch i32 %2, label %60 [
i32 0, label %75
i32 1, label %45
]
45: ; preds = %5
%46 = bitcast double* %3 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = fadd <2 x double> %35, %47
%49 = getelementptr inbounds double, double* %3, i64 5
%50 = getelementptr inbounds double, double* %3, i64 2
%51 = load double, double* %50
%52 = bitcast double* %49 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = fadd <2 x double> %44, %53
%55 = getelementptr inbounds double, double* %3, i64 10
%56 = load double, double* %55
%57 = insertelement <2 x double> poison, double %51, i64 0
%58 = insertelement <2 x double> %57, double %56, i64 1
%59 = fadd <2 x double> %42, %58
br label %75
60: ; preds = %5
%61 = bitcast double* %3 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = fsub <2 x double> %62, %35
%64 = getelementptr inbounds double, double* %3, i64 5
%65 = getelementptr inbounds double, double* %3, i64 2
%66 = load double, double* %65
%67 = bitcast double* %64 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = fsub <2 x double> %68, %44
%70 = getelementptr inbounds double, double* %3, i64 10
%71 = load double, double* %70
%72 = insertelement <2 x double> poison, double %66, i64 0
%73 = insertelement <2 x double> %72, double %71, i64 1
%74 = fsub <2 x double> %73, %42
br label %75
75: ; preds = %5, %45, %60
%76 = phi <2 x double> [ %48, %45 ], [ %63, %60 ], [ %35, %5 ]
%77 = phi <2 x double> [ %54, %45 ], [ %69, %60 ], [ %44, %5 ]
%78 = phi <2 x double> [ %59, %45 ], [ %74, %60 ], [ %42, %5 ]
%79 = bitcast double* %4 to <2 x double>*
store <2 x double> %76, <2 x double>* %79
%80 = getelementptr inbounds double, double* %4, i64 5
%81 = getelementptr inbounds double, double* %4, i64 2
%82 = extractelement <2 x double> %78, i64 0
store double %82, double* %81
%83 = bitcast double* %80 to <2 x double>*
store <2 x double> %77, <2 x double>* %83
%84 = getelementptr inbounds double, double* %4, i64 10
%85 = extractelement <2 x double> %78, i64 1
store double %85, double* %84
ret void
}