#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 s1;
  double s2;
  double s3;
  double t1;
  double t2;
  double t3;
  double t4;
  double t5;
  set_funevals(__fun_evals, get_funevals(__fun_evals) + 1);
  s1 = x[1] - x[0] * x[0];
  s2 = 1 - x[0];
  s3 = x[1] - 1;
  t1 = x[3] - x[2] * x[2];
  t2 = 1 - x[2];
  t3 = x[3] - 1;
  t4 = s3 + t3;
  t5 = s3 - t3;
  return (100 * (s1 * s1) + s2 * s2 + 90 * (t1 * t1) + t2 * t2 +
          10 * (t4 * t4) + t5 * t5 / 10.);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <get_funevals@plt>
mov    -0x60(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1040 <set_funevals@plt>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe7b(%rip),%xmm0
subsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xe61(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe0d(%rip),%xmm0
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  0xdf2(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xda7(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xd85(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xd51(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  0xd37(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1030 <get_funevals@plt>
lea    0x1(%rax),%rsi
mov    %r14,%rdi
call   1040 <set_funevals@plt>
movsd  (%rbx),%xmm2
movsd  0x8(%rbx),%xmm0
movsd  0xeb1(%rip),%xmm1
movapd %xmm1,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm2
movapd %xmm0,%xmm4
subsd  %xmm2,%xmm4
movsd  0xe9d(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  0x18(%rbx),%xmm5
movsd  0x10(%rbx),%xmm6
subsd  %xmm6,%xmm1
mulsd  %xmm6,%xmm6
movapd %xmm5,%xmm7
subsd  %xmm6,%xmm7
addsd  %xmm2,%xmm5
movapd %xmm0,%xmm2
addsd  %xmm5,%xmm2
subsd  %xmm5,%xmm0
mulsd  %xmm4,%xmm4
mulsd  %xmm3,%xmm3
mulsd  0xe67(%rip),%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm7,%xmm7
mulsd  0xe5f(%rip),%xmm7
addsd  %xmm4,%xmm7
mulsd  %xmm1,%xmm1
addsd  %xmm7,%xmm1
mulsd  %xmm2,%xmm2
movsd  0xe4f(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm0
divsd  %xmm3,%xmm0
addsd  %xmm2,%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
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%15 = load i8*, i8** %6
%16 = load i8*, i8** %6
%17 = call i64 @get_funevals(i8* %16)
%18 = add nsw i64 %17, 1
%19 = call i32 @set_funevals(i8* %15, i64 %18)
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load double, double* %24
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = fneg double %25
%30 = call double @llvm.fmuladd.f64(double %29, double %28, double %22)
store double %30, double* %7
%31 = load double*, double** %4
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
%34 = fsub double 1.000000e+00, %33
store double %34, double* %8
%35 = load double*, double** %4
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
%38 = fsub double %37, 1.000000e+00
store double %38, double* %9
%39 = load double*, double** %4
%40 = getelementptr inbounds double, double* %39, i64 3
%41 = load double, double* %40
%42 = load double*, double** %4
%43 = getelementptr inbounds double, double* %42, i64 2
%44 = load double, double* %43
%45 = load double*, double** %4
%46 = getelementptr inbounds double, double* %45, i64 2
%47 = load double, double* %46
%48 = fneg double %44
%49 = call double @llvm.fmuladd.f64(double %48, double %47, double %41)
store double %49, double* %10
%50 = load double*, double** %4
%51 = getelementptr inbounds double, double* %50, i64 2
%52 = load double, double* %51
%53 = fsub double 1.000000e+00, %52
store double %53, double* %11
%54 = load double*, double** %4
%55 = getelementptr inbounds double, double* %54, i64 3
%56 = load double, double* %55
%57 = fsub double %56, 1.000000e+00
store double %57, double* %12
%58 = load double, double* %9
%59 = load double, double* %12
%60 = fadd double %58, %59
store double %60, double* %13
%61 = load double, double* %9
%62 = load double, double* %12
%63 = fsub double %61, %62
store double %63, double* %14
%64 = load double, double* %7
%65 = load double, double* %7
%66 = fmul double %64, %65
%67 = load double, double* %8
%68 = load double, double* %8
%69 = fmul double %67, %68
%70 = call double @llvm.fmuladd.f64(double 1.000000e+02, double %66, double %69)
%71 = load double, double* %10
%72 = load double, double* %10
%73 = fmul double %71, %72
%74 = call double @llvm.fmuladd.f64(double 9.000000e+01, double %73, double %70)
%75 = load double, double* %11
%76 = load double, double* %11
%77 = call double @llvm.fmuladd.f64(double %75, double %76, double %74)
%78 = load double, double* %13
%79 = load double, double* %13
%80 = fmul double %78, %79
%81 = call double @llvm.fmuladd.f64(double 1.000000e+01, double %80, double %77)
%82 = load double, double* %14
%83 = load double, double* %14
%84 = fmul double %82, %83
%85 = fdiv double %84, 1.000000e+01
%86 = fadd double %81, %85
ret double %86
}

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 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = load double, double* %0
%10 = fneg double %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double %9, double %8)
%12 = fsub double 1.000000e+00, %9
%13 = fadd double %8, -1.000000e+00
%14 = getelementptr inbounds double, double* %0, i64 3
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %0, i64 2
%17 = load double, double* %16
%18 = fneg double %17
%19 = tail call double @llvm.fmuladd.f64(double %18, double %17, double %15)
%20 = fsub double 1.000000e+00, %17
%21 = fadd double %15, -1.000000e+00
%22 = fadd double %13, %21
%23 = fsub double %13, %21
%24 = fmul double %11, %11
%25 = fmul double %12, %12
%26 = tail call double @llvm.fmuladd.f64(double %24, double 1.000000e+02, double %25)
%27 = fmul double %19, %19
%28 = tail call double @llvm.fmuladd.f64(double %27, double 9.000000e+01, double %26)
%29 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %28)
%30 = fmul double %22, %22
%31 = tail call double @llvm.fmuladd.f64(double %30, double 1.000000e+01, double %29)
%32 = fmul double %23, %23
%33 = fdiv double %32, 1.000000e+01
%34 = fadd double %33, %31
ret double %34
}