double rosenbrock(double *x, int N, void *params) {
  double f, alpha, alpha2;
  alpha = 1;
  alpha2 = alpha * alpha;
  f = 100 * (x[0] * x[0] * alpha2 - x[1] / alpha) *
          (x[0] * x[0] * alpha2 - x[1] / alpha) +
      (1 - x[0] * alpha) * (1 - x[0] * alpha);
  return f;
}


x86 assembly (clang, -O0):
<rosenbrock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe93(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm2
movsd  -0x30(%rbp),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
divsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x28(%rbp),%xmm3
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
movsd  0xe15(%rip),%xmm3
addsd  %xmm3,%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm3
movsd  -0x28(%rbp),%xmm4
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm3
movsd  0xde1(%rip),%xmm4
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):
<rosenbrock>:
movsd  (%rdi),%xmm0
movsd  0xefc(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
subsd  0x8(%rdi),%xmm2
movsd  0xedb(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @rosenbrock(double* nocapture %0, i32 %1, i8* nocapture readnone %2) {
%4 = load double, double* %0
%5 = fmul double %4, %4
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = fsub double %5, %7
%9 = fmul double %8, 1.000000e+02
%10 = fsub double 1.000000e+00, %4
%11 = fmul double %10, %10
%12 = tail call double @llvm.fmuladd.f64(double %9, double %8, double %11)
ret double %12
}