#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 */
double pow(double, double);
double func4(double *x, int N, void *params) {
  double f;
  f = pow((x[0] - 2.0), 4.0) + pow((x[0] - 2.0), 2.0) * x[1] * x[1] +
      (x[1] + 1.0) * (x[1] + 1.0);
  return f;
}


x86 assembly (clang, -O0):
<func4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xed5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xed1(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xeaf(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xea3(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe68(%rip),%xmm0
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xe57(%rip),%xmm2
addsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func4>:
push   %rbx
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
addsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <pow@plt>
movsd  0xecb(%rip),%xmm2
addsd  (%rbx),%xmm2
mulsd  %xmm2,%xmm2
movsd  0x8(%rbx),%xmm1
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
addsd  0xeba(%rip),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @func4(double* %0, i32 %1, i8* %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = fsub double %10, 2.000000e+00
%12 = call double @pow(double %11, double 4.000000e+00)
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = fsub double %15, 2.000000e+00
%17 = call double @pow(double %16, double 2.000000e+00)
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = fmul double %17, %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %12)
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = fadd double %28, 1.000000e+00
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = fadd double %32, 1.000000e+00
%34 = call double @llvm.fmuladd.f64(double %29, double %33, double %25)
store double %34, double* %7
%35 = load double, double* %7
ret double %35
}

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