double froth(double *x, int N, void *params) {
  double f;
  f = (-13 + x[0] + ((5 - x[1]) * x[1] - 2.0) * x[1]) *
          (-13 + x[0] + ((5 - x[1]) * x[1] - 2.0) * x[1]) +
      (-29 + x[0] + ((x[1] + 1) * x[1] - 14.0) * x[1]) *
          (-29 + x[0] + ((x[1] + 1) * x[1] - 14.0) * x[1]);
  return f;
}


x86 assembly (clang, -O0):
<froth>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xf0d(%rip),%xmm1
addsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xef5(%rip),%xmm0
subsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xed3(%rip),%xmm2
addsd  %xmm2,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0xec2(%rip),%xmm1
addsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xeaa(%rip),%xmm2
subsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe88(%rip),%xmm3
addsd  %xmm3,%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  0xe5f(%rip),%xmm3
addsd  (%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0xe47(%rip),%xmm1
addsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
mulsd  %xmm4,%xmm1
movsd  0xe25(%rip),%xmm4
addsd  %xmm4,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe14(%rip),%xmm4
addsd  (%rax),%xmm4
mov    -0x8(%rbp),%rax
movsd  0xdfc(%rip),%xmm3
addsd  0x8(%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm5
mulsd  %xmm5,%xmm3
movsd  0xdda(%rip),%xmm5
addsd  %xmm5,%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<froth>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm2
movsd  0xeef(%rip),%xmm3
addsd  %xmm1,%xmm3
movsd  0xeeb(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  0xee3(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
addsd  0xedb(%rip),%xmm1
movsd  0xedb(%rip),%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
addsd  0xed3(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
ret

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

LLVM IR (-O2):
define double @froth(double* nocapture %0, i32 %1, i8* nocapture readnone %2) {
%4 = load double, double* %0
%5 = fadd double %4, -1.300000e+01
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = fsub double 5.000000e+00, %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %7, double -2.000000e+00)
%10 = tail call double @llvm.fmuladd.f64(double %9, double %7, double %5)
%11 = fadd double %4, -2.900000e+01
%12 = fadd double %7, 1.000000e+00
%13 = tail call double @llvm.fmuladd.f64(double %12, double %7, double -1.400000e+01)
%14 = tail call double @llvm.fmuladd.f64(double %13, double %7, double %11)
%15 = fmul double %14, %14
%16 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %15)
ret double %16
}