double froth(double *x, int N) {
  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    -0x8(%rbp),%rax
movsd  0xf11(%rip),%xmm1
addsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xef9(%rip),%xmm0
subsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xed7(%rip),%xmm2
addsd  %xmm2,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0xec6(%rip),%xmm1
addsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xeae(%rip),%xmm2
subsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe8c(%rip),%xmm3
addsd  %xmm3,%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  0xe63(%rip),%xmm3
addsd  (%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0xe4b(%rip),%xmm1
addsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
mulsd  %xmm4,%xmm1
movsd  0xe29(%rip),%xmm4
addsd  %xmm4,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm4
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe18(%rip),%xmm4
addsd  (%rax),%xmm4
mov    -0x8(%rbp),%rax
movsd  0xe00(%rip),%xmm3
addsd  0x8(%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm5
mulsd  %xmm5,%xmm3
movsd  0xdde(%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,-0x18(%rbp)
movsd  -0x18(%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) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fadd double -1.300000e+01, %8
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = fsub double 5.000000e+00, %12
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = call double @llvm.fmuladd.f64(double %13, double %16, double -2.000000e+00)
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = call double @llvm.fmuladd.f64(double %17, double %20, double %9)
%22 = load double*, double** %3
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = fadd double -1.300000e+01, %24
%26 = load double*, double** %3
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = fsub double 5.000000e+00, %28
%30 = load double*, double** %3
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = call double @llvm.fmuladd.f64(double %29, double %32, double -2.000000e+00)
%34 = load double*, double** %3
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = call double @llvm.fmuladd.f64(double %33, double %36, double %25)
%38 = load double*, double** %3
%39 = getelementptr inbounds double, double* %38, i64 0
%40 = load double, double* %39
%41 = fadd double -2.900000e+01, %40
%42 = load double*, double** %3
%43 = getelementptr inbounds double, double* %42, i64 1
%44 = load double, double* %43
%45 = fadd double %44, 1.000000e+00
%46 = load double*, double** %3
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = call double @llvm.fmuladd.f64(double %45, double %48, double -1.400000e+01)
%50 = load double*, double** %3
%51 = getelementptr inbounds double, double* %50, i64 1
%52 = load double, double* %51
%53 = call double @llvm.fmuladd.f64(double %49, double %52, double %41)
%54 = load double*, double** %3
%55 = getelementptr inbounds double, double* %54, i64 0
%56 = load double, double* %55
%57 = fadd double -2.900000e+01, %56
%58 = load double*, double** %3
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = fadd double %60, 1.000000e+00
%62 = load double*, double** %3
%63 = getelementptr inbounds double, double* %62, i64 1
%64 = load double, double* %63
%65 = call double @llvm.fmuladd.f64(double %61, double %64, double -1.400000e+01)
%66 = load double*, double** %3
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = call double @llvm.fmuladd.f64(double %65, double %68, double %57)
%70 = fmul double %53, %69
%71 = call double @llvm.fmuladd.f64(double %21, double %37, double %70)
store double %71, double* %5
%72 = load double, double* %5
ret double %72
}

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