void shape1d3(double x, double *N, double *dN) {
  N[0] = .5 * x * (x - 1);
  N[1] = -(x + 1) * (x - 1);
  N[2] = .5 * x * (x + 1);
  dN[0] = x - .5;
  dN[1] = -2 * x;
  dN[2] = x + .5;
}


x86 assembly (clang, -O0):
<shape1d3>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  0xee7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xee5(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xecd(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xea4(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xe7b(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe43(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xe25(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<shape1d3>:
movsd  0xef8(%rip),%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xef0(%rip),%xmm3
addsd  %xmm0,%xmm3
movsd  0xeec(%rip),%xmm4
addsd  %xmm0,%xmm4
movapd 0xf00(%rip),%xmm5
xorpd  %xmm4,%xmm5
unpcklpd %xmm3,%xmm3
mulsd  %xmm2,%xmm4
unpcklpd %xmm5,%xmm2
mulpd  %xmm3,%xmm2
movupd %xmm2,(%rdi)
movsd  %xmm4,0x10(%rdi)
movsd  0xec3(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rsi)
movsd  0xebb(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsi)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsi)
ret

LLVM IR (-O0):
define void @shape1d3(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double, double* %4
%8 = fmul double 5.000000e-01, %7
%9 = load double, double* %4
%10 = fsub double %9, 1.000000e+00
%11 = fmul double %8, %10
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 0
store double %11, double* %13
%14 = load double, double* %4
%15 = fadd double %14, 1.000000e+00
%16 = fneg double %15
%17 = load double, double* %4
%18 = fsub double %17, 1.000000e+00
%19 = fmul double %16, %18
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 1
store double %19, double* %21
%22 = load double, double* %4
%23 = fmul double 5.000000e-01, %22
%24 = load double, double* %4
%25 = fadd double %24, 1.000000e+00
%26 = fmul double %23, %25
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 2
store double %26, double* %28
%29 = load double, double* %4
%30 = fsub double %29, 5.000000e-01
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 0
store double %30, double* %32
%33 = load double, double* %4
%34 = fmul double -2.000000e+00, %33
%35 = load double*, double** %6
%36 = getelementptr inbounds double, double* %35, i64 1
store double %34, double* %36
%37 = load double, double* %4
%38 = fadd double %37, 5.000000e-01
%39 = load double*, double** %6
%40 = getelementptr inbounds double, double* %39, i64 2
store double %38, double* %40
ret void
}

LLVM IR (-O2):
define void @shape1d3(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = fmul double %0, 5.000000e-01
%5 = fadd double %0, -1.000000e+00
%6 = fadd double %0, 1.000000e+00
%7 = fneg double %6
%8 = insertelement <2 x double> poison, double %5, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%10 = insertelement <2 x double> poison, double %4, i64 0
%11 = insertelement <2 x double> %10, double %7, i64 1
%12 = fmul <2 x double> %9, %11
%13 = bitcast double* %1 to <2 x double>*
store <2 x double> %12, <2 x double>* %13
%14 = fmul double %4, %6
%15 = getelementptr inbounds double, double* %1, i64 2
store double %14, double* %15
%16 = fadd double %0, -5.000000e-01
store double %16, double* %2
%17 = fmul double %0, -2.000000e+00
%18 = getelementptr inbounds double, double* %2, i64 1
store double %17, double* %18
%19 = fadd double %0, 5.000000e-01
%20 = getelementptr inbounds double, double* %2, i64 2
store double %19, double* %20
ret void
}