void corner_dtrtri_2x2_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;
  if (use_inv_diag_A) {
    c_00 = inv_diag_A[0];
    c_11 = inv_diag_A[1];
  } else {
    c_00 = 1.0 / A[0 + bs * 0];
    c_11 = 1.0 / A[1 + bs * 1];
  }
  C[0 + bs * 0] = c_00;
  C[1 + bs * 1] = c_11;
  c_10 = A[1 + bs * 0];
  c_10 = -c_11 * c_10 * c_00;
  C[0 + bs * 1] = c_10;
  return;
}


x86 assembly (clang, -O0):
<corner_dtrtri_2x2_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     1144 <corner_dtrtri_2x2_lib4+0x44>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    116f <corner_dtrtri_2x2_lib4+0x6f>
mov    -0x8(%rbp),%rax
movsd  0xeb0(%rip),%xmm0
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe9b(%rip),%xmm0
divsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<corner_dtrtri_2x2_lib4>:
test   %esi,%esi
je     110a <corner_dtrtri_2x2_lib4+0xa>
movupd (%rdx),%xmm0
jmp    111f <corner_dtrtri_2x2_lib4+0x1f>
movsd  (%rdi),%xmm1
movhpd 0x28(%rdi),%xmm1
movapd 0xee5(%rip),%xmm0
divpd  %xmm1,%xmm0
movlpd %xmm0,(%rcx)
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
movhpd %xmm0,0x28(%rcx)
xorpd  0xed8(%rip),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rcx)
ret

LLVM IR (-O0):
define void @corner_dtrtri_2x2_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
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
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %4
%16 = load double*, double** %7
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
store double %18, double* %10
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
store double %21, double* %12
br label %31
22: ; preds = %4
%23 = load double*, double** %5
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load double, double* %24
%26 = fdiv double 1.000000e+00, %25
store double %26, double* %10
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 5
%29 = load double, double* %28
%30 = fdiv double 1.000000e+00, %29
store double %30, double* %12
br label %31
31: ; preds = %22, %15
%32 = load double, double* %10
%33 = load double*, double** %8
%34 = getelementptr inbounds double, double* %33, i64 0
store double %32, double* %34
%35 = load double, double* %12
%36 = load double*, double** %8
%37 = getelementptr inbounds double, double* %36, i64 5
store double %35, double* %37
%38 = load double*, double** %5
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
store double %40, double* %11
%41 = load double, double* %12
%42 = fneg double %41
%43 = load double, double* %11
%44 = fmul double %42, %43
%45 = load double, double* %10
%46 = fmul double %44, %45
store double %46, double* %11
%47 = load double, double* %11
%48 = load double*, double** %8
%49 = getelementptr inbounds double, double* %48, i64 4
store double %47, double* %49
ret void
}

LLVM IR (-O2):
define void @corner_dtrtri_2x2_lib4(double* nocapture %0, i32 %1, double* nocapture %2, double* nocapture writeonly %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = bitcast double* %2 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
br label %16
9: ; preds = %4
%10 = load double, double* %0
%11 = getelementptr inbounds double, double* %0, i64 5
%12 = load double, double* %11
%13 = insertelement <2 x double> poison, double %10, i64 0
%14 = insertelement <2 x double> %13, double %12, i64 1
%15 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %14
br label %16
16: ; preds = %9, %6
%17 = phi <2 x double> [ %8, %6 ], [ %15, %9 ]
%18 = extractelement <2 x double> %17, i64 0
store double %18, double* %3
%19 = getelementptr inbounds double, double* %3, i64 5
%20 = extractelement <2 x double> %17, i64 1
store double %20, double* %19
%21 = getelementptr inbounds double, double* %0, i64 1
%22 = load double, double* %21
%23 = fneg double %20
%24 = fmul double %22, %23
%25 = fmul double %18, %24
%26 = getelementptr inbounds double, double* %3, i64 4
store double %25, double* %26
ret void
}