#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ get_funevals(void *);
int /*<<< orphan*/ set_funevals(void *, scalar_t__);
double f(const double *x, const unsigned int n, void *__fun_evals) {
  double a;
  double b;
  double c;
  set_funevals(__fun_evals, get_funevals(__fun_evals) + 1);
  a = x[0];
  b = x[1];
  c = 100.0 * (b - (a * a)) * (b - (a * a));
  return (c + ((1.0 - a) * (1.0 - a)));
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <get_funevals@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1040 <set_funevals@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe63(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  0xe13(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe06(%rip),%xmm2
subsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rdx,%rdi
call   1030 <get_funevals@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
call   1040 <set_funevals@plt>
movsd  (%r14),%xmm1
movsd  0x8(%r14),%xmm2
movsd  0xeb7(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm1
subsd  %xmm1,%xmm2
movsd  0xe9b(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @f(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
%10 = load i8*, i8** %6
%11 = load i8*, i8** %6
%12 = call i64 @get_funevals(i8* %11)
%13 = add nsw i64 %12, 1
%14 = call i32 @set_funevals(i8* %10, i64 %13)
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
store double %17, double* %7
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
store double %20, double* %8
%21 = load double, double* %8
%22 = load double, double* %7
%23 = load double, double* %7
%24 = fneg double %22
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %21)
%26 = fmul double 1.000000e+02, %25
%27 = load double, double* %8
%28 = load double, double* %7
%29 = load double, double* %7
%30 = fneg double %28
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double %27)
%32 = fmul double %26, %31
store double %32, double* %9
%33 = load double, double* %9
%34 = load double, double* %7
%35 = fsub double 1.000000e+00, %34
%36 = load double, double* %7
%37 = fsub double 1.000000e+00, %36
%38 = call double @llvm.fmuladd.f64(double %35, double %37, double %33)
ret double %38
}

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