#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, void *params) {
  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    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xee1(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeb3(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe92(%rip),%xmm1
addsd  %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,-0x48(%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  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%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>
movsd  -0x40(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x28(%rbp),%xmm0
addsd  %xmm4,%xmm3
movsd  0xda5(%rip),%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x50,%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, 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 = fmul double 1.000000e+04, %10
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = call double @llvm.fmuladd.f64(double %11, double %14, double -1.000000e+00)
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = fmul double 1.000000e+04, %18
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = call double @llvm.fmuladd.f64(double %19, double %22, double -1.000000e+00)
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = fneg double %26
%28 = call double @exp(double %27)
%29 = load double*, double** %4
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = fneg double %31
%33 = call double @exp(double %32)
%34 = fadd double %28, %33
%35 = fsub double %34, 1.000100e+00
%36 = load double*, double** %4
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = fneg double %38
%40 = call double @exp(double %39)
%41 = load double*, double** %4
%42 = getelementptr inbounds double, double* %41, i64 1
%43 = load double, double* %42
%44 = fneg double %43
%45 = call double @exp(double %44)
%46 = fadd double %40, %45
%47 = fsub double %46, 1.000100e+00
%48 = fmul double %35, %47
%49 = call double @llvm.fmuladd.f64(double %15, double %23, double %48)
store double %49, double* %7
%50 = load double, double* %7
ret double %50
}

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