#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 func3(double *x, int N, double *jac, double *hess) {
  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);
  jac[0] = 4.0 * pow((x[0] - 2.0), 3.0) + 2.0 * (x[0] - 2.0) * x[1] * x[1];
  jac[1] = 2.0 * pow((x[0] - 2.0), 2.0) * x[1] + 2.0 * (x[1] + 1.0);
  hess[0] = 12.0 * pow((x[0] - 2.0), 2.0) + 2.0 * x[1] * x[1];
  hess[3] = 2.0 * pow((x[0] - 2.0), 2.0) + 2.0;
  hess[1] = 4.0 * (x[0] - 2.0) * x[1];
  hess[2] = hess[1];
  return f;
}


x86 assembly (clang, -O0):
<func3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xed1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xebd(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xeab(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%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  0xe7c(%rip),%xmm0
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xe6b(%rip),%xmm2
addsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe39(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe45(%rip),%xmm1
call   1030 <pow@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  0xe18(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xe0c(%rip),%xmm1
mulsd  %xmm2,%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movsd  0xde6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdce(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdc2(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xdb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0xda9(%rip),%xmm3
addsd  0x8(%rax),%xmm3
movsd  0xd8c(%rip),%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd67(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd5b(%rip),%xmm1
call   1030 <pow@plt>
mov    -0x8(%rbp),%rax
movsd  0xd4a(%rip),%xmm1
mulsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movsd  0xd3c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd14(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd08(%rip),%xmm1
call   1030 <pow@plt>
addsd  %xmm0,%xmm0
movsd  0xcf7(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  0xcda(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xcc6(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func3>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
addsd  0xed2(%rip),%xmm0
movsd  0xed2(%rip),%xmm1
call   1030 <pow@plt>
movapd %xmm0,%xmm3
movsd  (%rbx),%xmm0
addsd  0xeb5(%rip),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rbx),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm3
addsd  0xea4(%rip),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
movsd  0xe96(%rip),%xmm1
call   1030 <pow@plt>
movsd  (%rbx),%xmm1
movsd  0xe6d(%rip),%xmm3
addsd  %xmm3,%xmm1
addsd  %xmm1,%xmm1
movsd  0x8(%rbx),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe58(%rip),%xmm4
mulsd  %xmm4,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
movsd  (%rbx),%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0xe36(%rip),%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%r15)
movsd  (%rbx),%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm0,%xmm0
movsd  0x8(%rbx),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xe0b(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,(%r14)
movsd  (%rbx),%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm0
addsd  0xdf2(%rip),%xmm0
movsd  %xmm0,0x18(%r14)
movapd %xmm3,%xmm0
addsd  (%rbx),%xmm0
mulsd  %xmm4,%xmm0
mulsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  %xmm0,0x10(%r14)
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @func3(double* %0, i32 %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fsub double %12, 2.000000e+00
%14 = call double @pow(double %13, double 4.000000e+00)
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = fsub double %17, 2.000000e+00
%19 = call double @pow(double %18, double 2.000000e+00)
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = fmul double %19, %22
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = call double @llvm.fmuladd.f64(double %23, double %26, double %14)
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 1
%30 = load double, double* %29
%31 = fadd double %30, 1.000000e+00
%32 = load double*, double** %5
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = fadd double %34, 1.000000e+00
%36 = call double @llvm.fmuladd.f64(double %31, double %35, double %27)
store double %36, double* %9
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 0
%39 = load double, double* %38
%40 = fsub double %39, 2.000000e+00
%41 = call double @pow(double %40, double 3.000000e+00)
%42 = load double*, double** %5
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = fsub double %44, 2.000000e+00
%46 = fmul double 2.000000e+00, %45
%47 = load double*, double** %5
%48 = getelementptr inbounds double, double* %47, i64 1
%49 = load double, double* %48
%50 = fmul double %46, %49
%51 = load double*, double** %5
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
%54 = fmul double %50, %53
%55 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %41, double %54)
%56 = load double*, double** %7
%57 = getelementptr inbounds double, double* %56, i64 0
store double %55, double* %57
%58 = load double*, double** %5
%59 = getelementptr inbounds double, double* %58, i64 0
%60 = load double, double* %59
%61 = fsub double %60, 2.000000e+00
%62 = call double @pow(double %61, double 2.000000e+00)
%63 = fmul double 2.000000e+00, %62
%64 = load double*, double** %5
%65 = getelementptr inbounds double, double* %64, i64 1
%66 = load double, double* %65
%67 = load double*, double** %5
%68 = getelementptr inbounds double, double* %67, i64 1
%69 = load double, double* %68
%70 = fadd double %69, 1.000000e+00
%71 = fmul double 2.000000e+00, %70
%72 = call double @llvm.fmuladd.f64(double %63, double %66, double %71)
%73 = load double*, double** %7
%74 = getelementptr inbounds double, double* %73, i64 1
store double %72, double* %74
%75 = load double*, double** %5
%76 = getelementptr inbounds double, double* %75, i64 0
%77 = load double, double* %76
%78 = fsub double %77, 2.000000e+00
%79 = call double @pow(double %78, double 2.000000e+00)
%80 = load double*, double** %5
%81 = getelementptr inbounds double, double* %80, i64 1
%82 = load double, double* %81
%83 = fmul double 2.000000e+00, %82
%84 = load double*, double** %5
%85 = getelementptr inbounds double, double* %84, i64 1
%86 = load double, double* %85
%87 = fmul double %83, %86
%88 = call double @llvm.fmuladd.f64(double 1.200000e+01, double %79, double %87)
%89 = load double*, double** %8
%90 = getelementptr inbounds double, double* %89, i64 0
store double %88, double* %90
%91 = load double*, double** %5
%92 = getelementptr inbounds double, double* %91, i64 0
%93 = load double, double* %92
%94 = fsub double %93, 2.000000e+00
%95 = call double @pow(double %94, double 2.000000e+00)
%96 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %95, double 2.000000e+00)
%97 = load double*, double** %8
%98 = getelementptr inbounds double, double* %97, i64 3
store double %96, double* %98
%99 = load double*, double** %5
%100 = getelementptr inbounds double, double* %99, i64 0
%101 = load double, double* %100
%102 = fsub double %101, 2.000000e+00
%103 = fmul double 4.000000e+00, %102
%104 = load double*, double** %5
%105 = getelementptr inbounds double, double* %104, i64 1
%106 = load double, double* %105
%107 = fmul double %103, %106
%108 = load double*, double** %8
%109 = getelementptr inbounds double, double* %108, i64 1
store double %107, double* %109
%110 = load double*, double** %8
%111 = getelementptr inbounds double, double* %110, i64 1
%112 = load double, double* %111
%113 = load double*, double** %8
%114 = getelementptr inbounds double, double* %113, i64 2
store double %112, double* %114
%115 = load double, double* %9
ret double %115
}

LLVM IR (-O2):
define double @func3(double* nocapture %0, i32 %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = load double, double* %0
%6 = fadd double %5, -2.000000e+00
%7 = tail call double @pow(double %6, double 4.000000e+00)
%8 = load double, double* %0
%9 = fadd double %8, -2.000000e+00
%10 = fmul double %9, %9
%11 = getelementptr inbounds double, double* %0, i64 1
%12 = load double, double* %11
%13 = fmul double %12, %10
%14 = tail call double @llvm.fmuladd.f64(double %13, double %12, double %7)
%15 = fadd double %12, 1.000000e+00
%16 = tail call double @llvm.fmuladd.f64(double %15, double %15, double %14)
%17 = tail call double @pow(double %9, double 3.000000e+00)
%18 = load double, double* %0
%19 = fadd double %18, -2.000000e+00
%20 = fmul double %19, 2.000000e+00
%21 = load double, double* %11
%22 = fmul double %21, %20
%23 = fmul double %21, %22
%24 = tail call double @llvm.fmuladd.f64(double %17, double 4.000000e+00, double %23)
store double %24, double* %2
%25 = load double, double* %0
%26 = fadd double %25, -2.000000e+00
%27 = fmul double %26, %26
%28 = fmul double %27, 2.000000e+00
%29 = load double, double* %11
%30 = fadd double %29, 1.000000e+00
%31 = fmul double %30, 2.000000e+00
%32 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %31)
%33 = getelementptr inbounds double, double* %2, i64 1
store double %32, double* %33
%34 = load double, double* %0
%35 = fadd double %34, -2.000000e+00
%36 = fmul double %35, %35
%37 = load double, double* %11
%38 = fmul double %37, 2.000000e+00
%39 = fmul double %37, %38
%40 = tail call double @llvm.fmuladd.f64(double %36, double 1.200000e+01, double %39)
store double %40, double* %3
%41 = load double, double* %0
%42 = fadd double %41, -2.000000e+00
%43 = fmul double %42, %42
%44 = tail call double @llvm.fmuladd.f64(double %43, double 2.000000e+00, double 2.000000e+00)
%45 = getelementptr inbounds double, double* %3, i64 3
store double %44, double* %45
%46 = load double, double* %0
%47 = fadd double %46, -2.000000e+00
%48 = fmul double %47, 4.000000e+00
%49 = load double, double* %11
%50 = fmul double %49, %48
%51 = getelementptr inbounds double, double* %3, i64 1
store double %50, double* %51
%52 = getelementptr inbounds double, double* %3, i64 2
store double %50, double* %52
ret double %16
}