double rosenbrock(double *x, int N) {
  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)
movsd  0xeed(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm1
movsd  -0x28(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe97(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm2
movsd  -0x28(%rbp),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
divsd  -0x20(%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  -0x20(%rbp),%xmm3
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
movsd  0xe19(%rip),%xmm3
addsd  %xmm3,%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm3
movsd  -0x20(%rbp),%xmm4
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm3
movsd  0xde5(%rip),%xmm4
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):
<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) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
store double 1.000000e+00, double* %6
%8 = load double, double* %6
%9 = load double, double* %6
%10 = fmul double %8, %9
store double %10, double* %7
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = load double, double* %7
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double, double* %6
%23 = fdiv double %21, %22
%24 = fneg double %23
%25 = call double @llvm.fmuladd.f64(double %17, double %18, double %24)
%26 = fmul double 1.000000e+02, %25
%27 = load double*, double** %3
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
%30 = load double*, double** %3
%31 = getelementptr inbounds double, double* %30, i64 0
%32 = load double, double* %31
%33 = fmul double %29, %32
%34 = load double, double* %7
%35 = load double*, double** %3
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
%38 = load double, double* %6
%39 = fdiv double %37, %38
%40 = fneg double %39
%41 = call double @llvm.fmuladd.f64(double %33, double %34, double %40)
%42 = load double*, double** %3
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = load double, double* %6
%46 = fneg double %44
%47 = call double @llvm.fmuladd.f64(double %46, double %45, double 1.000000e+00)
%48 = load double*, double** %3
%49 = getelementptr inbounds double, double* %48, i64 0
%50 = load double, double* %49
%51 = load double, double* %6
%52 = fneg double %50
%53 = call double @llvm.fmuladd.f64(double %52, double %51, double 1.000000e+00)
%54 = fmul double %47, %53
%55 = call double @llvm.fmuladd.f64(double %26, double %41, double %54)
store double %55, double* %5
%56 = load double, double* %5
ret double %56
}

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