#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 exp(double);
double powell(double *x, int N) {
  double f;
  f = (10000 * x[0] * x[1] - 1) * (10000 * x[0] * x[1] - 1) +
      (exp(-x[0]) + exp(-x[1]) - 1.0001) * (exp(-x[0]) + exp(-x[1]) - 1.0001);
  return f;
}


x86 assembly (clang, -O0):
<powell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xee5(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeb7(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe23(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  -0x38(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x20(%rbp),%xmm0
addsd  %xmm4,%xmm3
movsd  0xda9(%rip),%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<powell>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  0xedc(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x8(%rdi),%xmm1
addsd  0xed3(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
xorpd  0xecd(%rip),%xmm0
call   1030 <exp@plt>
movapd %xmm0,0x30(%rsp)
movsd  0x8(%rbx),%xmm0
xorps  0xeb6(%rip),%xmm0
call   1030 <exp@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rbx),%xmm0
xorps  0xea1(%rip),%xmm0
call   1030 <exp@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rbx),%xmm0
xorpd  0xe8a(%rip),%xmm0
call   1030 <exp@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd 0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
addpd  %xmm1,%xmm2
addpd  0xe73(%rip),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @powell(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 = fmul double 1.000000e+04, %8
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = call double @llvm.fmuladd.f64(double %9, double %12, double -1.000000e+00)
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = fmul double 1.000000e+04, %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = call double @llvm.fmuladd.f64(double %17, double %20, double -1.000000e+00)
%22 = load double*, double** %3
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = fneg double %24
%26 = call double @exp(double %25)
%27 = load double*, double** %3
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = fneg double %29
%31 = call double @exp(double %30)
%32 = fadd double %26, %31
%33 = fsub double %32, 1.000100e+00
%34 = load double*, double** %3
%35 = getelementptr inbounds double, double* %34, i64 0
%36 = load double, double* %35
%37 = fneg double %36
%38 = call double @exp(double %37)
%39 = load double*, double** %3
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %40
%42 = fneg double %41
%43 = call double @exp(double %42)
%44 = fadd double %38, %43
%45 = fsub double %44, 1.000100e+00
%46 = fmul double %33, %45
%47 = call double @llvm.fmuladd.f64(double %13, double %21, double %46)
store double %47, double* %5
%48 = load double, double* %5
ret double %48
}

LLVM IR (-O2):
define double @powell(double* nocapture %0, i32 %1) {
%3 = load double, double* %0
%4 = fmul double %3, 1.000000e+04
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = tail call double @llvm.fmuladd.f64(double %4, double %6, double -1.000000e+00)
%8 = fneg double %3
%9 = tail call double @exp(double %8)
%10 = load double, double* %5
%11 = fneg double %10
%12 = tail call double @exp(double %11)
%13 = load double, double* %0
%14 = fneg double %13
%15 = tail call double @exp(double %14)
%16 = load double, double* %5
%17 = fneg double %16
%18 = tail call double @exp(double %17)
%19 = insertelement <2 x double> poison, double %9, i64 0
%20 = insertelement <2 x double> %19, double %15, i64 1
%21 = insertelement <2 x double> poison, double %12, i64 0
%22 = insertelement <2 x double> %21, double %18, i64 1
%23 = fadd <2 x double> %20, %22
%24 = fadd <2 x double> %23, <double -1.000100e+00, double -1.000100e+00>
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%26 = fmul <2 x double> %24, %25
%27 = extractelement <2 x double> %26, i64 0
%28 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %27)
ret double %28
}