double f(const double *restrict x, void *restrict par) {
  const double c = *((double *)par);
  return (1 - x[0]) * (1 - x[0]) +
         c * (x[1] - x[0] * x[0]) * (x[1] - x[0] * x[0]) +
         (1 - x[1]) * (1 - x[1]) +
         c * (x[2] - x[1] * x[1]) * (x[2] - x[1] * x[1]);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xedb(%rip),%xmm0
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xecb(%rip),%xmm2
subsd  (%rax),%xmm2
movsd  -0x18(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm5
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm5
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0xe36(%rip),%xmm1
subsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe25(%rip),%xmm2
subsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movsd  (%rsi),%xmm0
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm2
movsd  0xeeb(%rip),%xmm3
movapd %xmm3,%xmm4
subsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm1
movapd %xmm2,%xmm5
subsd  %xmm1,%xmm5
movapd %xmm0,%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm4,%xmm4
addsd  %xmm1,%xmm4
subsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm4,%xmm3
movsd  0x10(%rdi),%xmm1
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @f(double* noalias %0, i8* noalias %1) {
%3 = alloca double*
%4 = alloca i8*
%5 = alloca double
store double* %0, double** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
store double %8, double* %5
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = fsub double 1.000000e+00, %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = fsub double 1.000000e+00, %15
%17 = load double, double* %5
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = load double*, double** %3
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = load double*, double** %3
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = fneg double %23
%28 = call double @llvm.fmuladd.f64(double %27, double %26, double %20)
%29 = fmul double %17, %28
%30 = load double*, double** %3
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = load double*, double** %3
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = load double*, double** %3
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = fneg double %35
%40 = call double @llvm.fmuladd.f64(double %39, double %38, double %32)
%41 = fmul double %29, %40
%42 = call double @llvm.fmuladd.f64(double %12, double %16, double %41)
%43 = load double*, double** %3
%44 = getelementptr inbounds double, double* %43, i64 1
%45 = load double, double* %44
%46 = fsub double 1.000000e+00, %45
%47 = load double*, double** %3
%48 = getelementptr inbounds double, double* %47, i64 1
%49 = load double, double* %48
%50 = fsub double 1.000000e+00, %49
%51 = call double @llvm.fmuladd.f64(double %46, double %50, double %42)
%52 = load double, double* %5
%53 = load double*, double** %3
%54 = getelementptr inbounds double, double* %53, i64 2
%55 = load double, double* %54
%56 = load double*, double** %3
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = load double*, double** %3
%60 = getelementptr inbounds double, double* %59, i64 1
%61 = load double, double* %60
%62 = fneg double %58
%63 = call double @llvm.fmuladd.f64(double %62, double %61, double %55)
%64 = fmul double %52, %63
%65 = load double*, double** %3
%66 = getelementptr inbounds double, double* %65, i64 2
%67 = load double, double* %66
%68 = load double*, double** %3
%69 = getelementptr inbounds double, double* %68, i64 1
%70 = load double, double* %69
%71 = load double*, double** %3
%72 = getelementptr inbounds double, double* %71, i64 1
%73 = load double, double* %72
%74 = fneg double %70
%75 = call double @llvm.fmuladd.f64(double %74, double %73, double %67)
%76 = call double @llvm.fmuladd.f64(double %64, double %75, double %51)
ret double %76
}

LLVM IR (-O2):
define double @f(double* noalias nocapture %0, i8* noalias nocapture %1) {
%3 = bitcast i8* %1 to double*
%4 = load double, double* %3
%5 = load double, double* %0
%6 = fsub double 1.000000e+00, %5
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = fneg double %5
%10 = tail call double @llvm.fmuladd.f64(double %9, double %5, double %8)
%11 = fmul double %4, %10
%12 = fmul double %10, %11
%13 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %12)
%14 = fsub double 1.000000e+00, %8
%15 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %13)
%16 = getelementptr inbounds double, double* %0, i64 2
%17 = load double, double* %16
%18 = fneg double %8
%19 = tail call double @llvm.fmuladd.f64(double %18, double %8, double %17)
%20 = fmul double %4, %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double %15)
ret double %21
}