int shape_tria6(double *L, double *N) {
  double L1, L2, L3;
  L1 = L[0];
  L2 = L[1];
  L3 = 1.0 - L1 - L2;
  N[0] = L1 * (2.0 * L1 - 1.0);
  N[1] = 4.0 * L1 * L2;
  N[2] = L2 * (2.0 * L2 - 1.0);
  N[3] = 4.0 * L2 * L3;
  N[4] = L3 * (2.0 * L3 - 1.0);
  N[5] = 4.0 * L1 * L3;
  return 0;
}


x86 assembly (clang, -O0):
<shape_tria6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xee1(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xeb4(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe94(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe73(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  0xe52(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe31(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  0xe10(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shape_tria6>:
movupd (%rdi),%xmm1
movsd  0xef4(%rip),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
subsd  %xmm2,%xmm0
movapd %xmm1,%xmm3
addsd  %xmm1,%xmm3
movsd  0xedc(%rip),%xmm4
addsd  %xmm4,%xmm3
movsd  0xed8(%rip),%xmm5
movapd %xmm1,%xmm6
mulsd  %xmm5,%xmm6
unpcklpd %xmm6,%xmm3
mulpd  %xmm1,%xmm3
movupd %xmm3,(%rsi)
movapd %xmm2,%xmm3
addsd  %xmm2,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm5,%xmm2
shufpd $0x1,%xmm2,%xmm1
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
movupd %xmm3,0x10(%rsi)
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm4,%xmm1
unpcklpd %xmm0,%xmm0
unpcklpd %xmm6,%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x20(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @shape_tria6(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%8 = load double*, double** %3
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
store double %10, double* %5
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
store double %13, double* %6
%14 = load double, double* %5
%15 = fsub double 1.000000e+00, %14
%16 = load double, double* %6
%17 = fsub double %15, %16
store double %17, double* %7
%18 = load double, double* %5
%19 = load double, double* %5
%20 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %19, double -1.000000e+00)
%21 = fmul double %18, %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 0
store double %21, double* %23
%24 = load double, double* %5
%25 = fmul double 4.000000e+00, %24
%26 = load double, double* %6
%27 = fmul double %25, %26
%28 = load double*, double** %4
%29 = getelementptr inbounds double, double* %28, i64 1
store double %27, double* %29
%30 = load double, double* %6
%31 = load double, double* %6
%32 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %31, double -1.000000e+00)
%33 = fmul double %30, %32
%34 = load double*, double** %4
%35 = getelementptr inbounds double, double* %34, i64 2
store double %33, double* %35
%36 = load double, double* %6
%37 = fmul double 4.000000e+00, %36
%38 = load double, double* %7
%39 = fmul double %37, %38
%40 = load double*, double** %4
%41 = getelementptr inbounds double, double* %40, i64 3
store double %39, double* %41
%42 = load double, double* %7
%43 = load double, double* %7
%44 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %43, double -1.000000e+00)
%45 = fmul double %42, %44
%46 = load double*, double** %4
%47 = getelementptr inbounds double, double* %46, i64 4
store double %45, double* %47
%48 = load double, double* %5
%49 = fmul double 4.000000e+00, %48
%50 = load double, double* %7
%51 = fmul double %49, %50
%52 = load double*, double** %4
%53 = getelementptr inbounds double, double* %52, i64 5
store double %51, double* %53
ret i32 0
}

LLVM IR (-O2):
define i32 @shape_tria6(double* nocapture %0, double* nocapture writeonly %1) {
%3 = bitcast double* %0 to <2 x double>*
%4 = load <2 x double>, <2 x double>* %3
%5 = extractelement <2 x double> %4, i64 0
%6 = fsub double 1.000000e+00, %5
%7 = extractelement <2 x double> %4, i64 1
%8 = fsub double %6, %7
%9 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e+00, double -1.000000e+00)
%10 = fmul double %5, 4.000000e+00
%11 = insertelement <2 x double> poison, double %9, i64 0
%12 = insertelement <2 x double> %11, double %10, i64 1
%13 = fmul <2 x double> %4, %12
%14 = bitcast double* %1 to <2 x double>*
store <2 x double> %13, <2 x double>* %14
%15 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double -1.000000e+00)
%16 = getelementptr inbounds double, double* %1, i64 2
%17 = fmul double %7, 4.000000e+00
%18 = insertelement <2 x double> poison, double %7, i64 0
%19 = insertelement <2 x double> %18, double %17, i64 1
%20 = insertelement <2 x double> poison, double %15, i64 0
%21 = insertelement <2 x double> %20, double %8, i64 1
%22 = fmul <2 x double> %19, %21
%23 = bitcast double* %16 to <2 x double>*
store <2 x double> %22, <2 x double>* %23
%24 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double -1.000000e+00)
%25 = getelementptr inbounds double, double* %1, i64 4
%26 = insertelement <2 x double> poison, double %8, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %24, i64 0
%29 = insertelement <2 x double> %28, double %10, i64 1
%30 = fmul <2 x double> %27, %29
%31 = bitcast double* %25 to <2 x double>*
store <2 x double> %30, <2 x double>* %31
ret i32 0
}