#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) {
  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    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xed9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xed5(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xeb3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xea7(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%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  0xe6c(%rip),%xmm0
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xe5b(%rip),%xmm2
addsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%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) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fsub double %8, 2.000000e+00
%10 = call double @pow(double %9, double 4.000000e+00)
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
%14 = fsub double %13, 2.000000e+00
%15 = call double @pow(double %14, double 2.000000e+00)
%16 = load double*, double** %3
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = fmul double %15, %18
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = call double @llvm.fmuladd.f64(double %19, double %22, double %10)
%24 = load double*, double** %3
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fadd double %26, 1.000000e+00
%28 = load double*, double** %3
%29 = getelementptr inbounds double, double* %28, i64 1
%30 = load double, double* %29
%31 = fadd double %30, 1.000000e+00
%32 = call double @llvm.fmuladd.f64(double %27, double %31, double %23)
store double %32, double* %5
%33 = load double, double* %5
ret double %33
}

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