void corner_dtrtri_3x3_lib4(double *A, int use_inv_diag_A, double *inv_diag_A,
                            double *C) {
  const int bs = 4;
  double c_00, c_10, c_11, c_20, c_21, c_22;
  if (use_inv_diag_A) {
    c_00 = inv_diag_A[0];
    c_11 = inv_diag_A[1];
    c_22 = inv_diag_A[2];
  } else {
    c_00 = 1.0 / A[0 + bs * 0];
    c_11 = 1.0 / A[1 + bs * 1];
    c_22 = 1.0 / A[2 + bs * 2];
  }
  C[0 + bs * 0] = c_00;
  C[1 + bs * 1] = c_11;
  C[2 + bs * 2] = c_22;
  c_10 = A[1 + bs * 0];
  c_10 = -c_11 * c_10 * c_00;
  C[0 + bs * 1] = c_10;
  c_20 = A[2 + bs * 0];
  c_21 = A[2 + bs * 1];
  c_20 = -c_22 * c_20;
  c_21 = -c_22 * c_21;
  c_20 = c_20 * c_00 + c_21 * c_10;
  c_21 = c_21 * c_11;
  C[0 + 2 * bs] = c_20;
  C[1 + 2 * bs] = c_21;
  return;
}


x86 assembly (clang, -O0):
<corner_dtrtri_3x3_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x4,-0x24(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1152 <corner_dtrtri_3x3_lib4+0x52>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1193 <corner_dtrtri_3x3_lib4+0x93>
mov    -0x8(%rbp),%rax
movsd  0xea2(%rip),%xmm0
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe8d(%rip),%xmm0
divsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe77(%rip),%xmm0
divsd  0x50(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x50(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x40(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x48(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<corner_dtrtri_3x3_lib4>:
test   %esi,%esi
je     110f <corner_dtrtri_3x3_lib4+0xf>
movupd (%rdx),%xmm0
movsd  0x10(%rdx),%xmm1
jmp    1131 <corner_dtrtri_3x3_lib4+0x31>
movsd  (%rdi),%xmm1
movhpd 0x28(%rdi),%xmm1
movapd 0xee0(%rip),%xmm0
divpd  %xmm1,%xmm0
movsd  0xef4(%rip),%xmm1
divsd  0x50(%rdi),%xmm1
movlpd %xmm0,(%rcx)
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
movhpd %xmm0,0x28(%rcx)
movsd  %xmm1,0x50(%rcx)
movapd 0xec1(%rip),%xmm3
movapd %xmm2,%xmm4
xorpd  %xmm3,%xmm4
mulsd  0x8(%rdi),%xmm4
mulsd  %xmm0,%xmm4
movsd  %xmm4,0x20(%rcx)
xorpd  %xmm1,%xmm3
mulsd  0x10(%rdi),%xmm1
mulsd  0x30(%rdi),%xmm3
mulsd  %xmm3,%xmm4
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm4
mulsd  %xmm2,%xmm3
movsd  %xmm4,0x40(%rcx)
movsd  %xmm3,0x48(%rcx)
ret

LLVM IR (-O0):
define void @corner_dtrtri_3x3_lib4(double* %0, i32 %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
store i32 4, i32* %9
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %4
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
store double %21, double* %10
%22 = load double*, double** %7
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
store double %24, double* %12
%25 = load double*, double** %7
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
store double %27, double* %15
br label %41
28: ; preds = %4
%29 = load double*, double** %5
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = fdiv double 1.000000e+00, %31
store double %32, double* %10
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 5
%35 = load double, double* %34
%36 = fdiv double 1.000000e+00, %35
store double %36, double* %12
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 10
%39 = load double, double* %38
%40 = fdiv double 1.000000e+00, %39
store double %40, double* %15
br label %41
41: ; preds = %28, %18
%42 = load double, double* %10
%43 = load double*, double** %8
%44 = getelementptr inbounds double, double* %43, i64 0
store double %42, double* %44
%45 = load double, double* %12
%46 = load double*, double** %8
%47 = getelementptr inbounds double, double* %46, i64 5
store double %45, double* %47
%48 = load double, double* %15
%49 = load double*, double** %8
%50 = getelementptr inbounds double, double* %49, i64 10
store double %48, double* %50
%51 = load double*, double** %5
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
store double %53, double* %11
%54 = load double, double* %12
%55 = fneg double %54
%56 = load double, double* %11
%57 = fmul double %55, %56
%58 = load double, double* %10
%59 = fmul double %57, %58
store double %59, double* %11
%60 = load double, double* %11
%61 = load double*, double** %8
%62 = getelementptr inbounds double, double* %61, i64 4
store double %60, double* %62
%63 = load double*, double** %5
%64 = getelementptr inbounds double, double* %63, i64 2
%65 = load double, double* %64
store double %65, double* %13
%66 = load double*, double** %5
%67 = getelementptr inbounds double, double* %66, i64 6
%68 = load double, double* %67
store double %68, double* %14
%69 = load double, double* %15
%70 = fneg double %69
%71 = load double, double* %13
%72 = fmul double %70, %71
store double %72, double* %13
%73 = load double, double* %15
%74 = fneg double %73
%75 = load double, double* %14
%76 = fmul double %74, %75
store double %76, double* %14
%77 = load double, double* %13
%78 = load double, double* %10
%79 = load double, double* %14
%80 = load double, double* %11
%81 = fmul double %79, %80
%82 = call double @llvm.fmuladd.f64(double %77, double %78, double %81)
store double %82, double* %13
%83 = load double, double* %14
%84 = load double, double* %12
%85 = fmul double %83, %84
store double %85, double* %14
%86 = load double, double* %13
%87 = load double*, double** %8
%88 = getelementptr inbounds double, double* %87, i64 8
store double %86, double* %88
%89 = load double, double* %14
%90 = load double*, double** %8
%91 = getelementptr inbounds double, double* %90, i64 9
store double %89, double* %91
ret void
}

LLVM IR (-O2):
define void @corner_dtrtri_3x3_lib4(double* nocapture %0, i32 %1, double* nocapture %2, double* nocapture writeonly %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = bitcast double* %2 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = getelementptr inbounds double, double* %2, i64 2
%10 = load double, double* %9
br label %21
11: ; preds = %4
%12 = load double, double* %0
%13 = getelementptr inbounds double, double* %0, i64 5
%14 = load double, double* %13
%15 = insertelement <2 x double> poison, double %12, i64 0
%16 = insertelement <2 x double> %15, double %14, i64 1
%17 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %16
%18 = getelementptr inbounds double, double* %0, i64 10
%19 = load double, double* %18
%20 = fdiv double 1.000000e+00, %19
br label %21
21: ; preds = %11, %6
%22 = phi double [ %10, %6 ], [ %20, %11 ]
%23 = phi <2 x double> [ %8, %6 ], [ %17, %11 ]
%24 = extractelement <2 x double> %23, i64 0
store double %24, double* %3
%25 = getelementptr inbounds double, double* %3, i64 5
%26 = extractelement <2 x double> %23, i64 1
store double %26, double* %25
%27 = getelementptr inbounds double, double* %3, i64 10
store double %22, double* %27
%28 = getelementptr inbounds double, double* %0, i64 1
%29 = load double, double* %28
%30 = fneg double %26
%31 = fmul double %29, %30
%32 = fmul double %24, %31
%33 = getelementptr inbounds double, double* %3, i64 4
store double %32, double* %33
%34 = getelementptr inbounds double, double* %0, i64 2
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %0, i64 6
%37 = load double, double* %36
%38 = fneg double %22
%39 = fmul double %35, %38
%40 = fmul double %37, %38
%41 = fmul double %32, %40
%42 = tail call double @llvm.fmuladd.f64(double %39, double %24, double %41)
%43 = fmul double %26, %40
%44 = getelementptr inbounds double, double* %3, i64 8
store double %42, double* %44
%45 = getelementptr inbounds double, double* %3, i64 9
store double %43, double* %45
ret void
}