#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 */
int /*<<< orphan*/ fabs(double);
double sin(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int /*<<< orphan*/);
double egg_holder(double sol[], int DIM) {
  double aux;
  int i;
  aux = 0.0;
  for (i = 0; i < DIM - 1; i++) {
    aux += -(sol[i + 1] + 47.0) *
               sin(sqrt(fabs(sol[i + 1] + sol[i] * 0.5 + 47.0))) +
           sin(sqrt(fabs(sol[i] - (sol[i + 1] + 47.0)))) * (-sol[i]);
  }
  return (aux);
}


x86 assembly (clang, -O0):
<egg_holder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    127b <egg_holder+0x14b>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xe8c(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe4c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe34(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xdf6(%rip),%xmm1
addsd  (%rax,%rcx,8),%xmm1
subsd  %xmm1,%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114e <egg_holder+0x1e>
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<egg_holder>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
xorpd  %xmm0,%xmm0
cmp    $0x2,%esi
jl     1214 <egg_holder+0xe4>
mov    %esi,%r14d
mov    %rdi,%r15
add    $0xffffffff,%r14d
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
lea    0x1(%rbx),%r12
movsd  0x8(%r15,%rbx,8),%xmm1
movsd  (%r15,%rbx,8),%xmm0
mulsd  0xe89(%rip),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
movsd  0xe71(%rip),%xmm1
addsd  %xmm1,%xmm2
xorpd  0xe75(%rip),%xmm2
movapd %xmm2,0x10(%rsp)
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  (%r15,%rbx,8),%xmm0
movsd  0x8(%r15,%rbx,8),%xmm1
addsd  0xe2e(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
mulsd  (%r15,%rbx,8),%xmm0
movsd  (%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
mov    %r12,%rbx
cmp    %r12,%r14
jne    1160 <egg_holder+0x30>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @egg_holder(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %7
7: ; preds = %63, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %66
12: ; preds = %7
%13 = load double*, double** %3
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %13, i64 %16
%18 = load double, double* %17
%19 = fadd double %18, 4.700000e+01
%20 = fneg double %19
%21 = load double*, double** %3
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %21, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %3
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = call double @llvm.fmuladd.f64(double %31, double 5.000000e-01, double %26)
%33 = fadd double %32, 4.700000e+01
%34 = call i32 @fabs(double %33)
%35 = call i32 @sqrt(i32 %34)
%36 = call double @sin(i32 %35)
%37 = load double*, double** %3
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %3
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %42, i64 %45
%47 = load double, double* %46
%48 = fadd double %47, 4.700000e+01
%49 = fsub double %41, %48
%50 = call i32 @fabs(double %49)
%51 = call i32 @sqrt(i32 %50)
%52 = call double @sin(i32 %51)
%53 = load double*, double** %3
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = fneg double %57
%59 = fmul double %52, %58
%60 = call double @llvm.fmuladd.f64(double %20, double %36, double %59)
%61 = load double, double* %5
%62 = fadd double %61, %60
store double %62, double* %5
br label %63
63: ; preds = %12
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %7
66: ; preds = %7
%67 = load double, double* %5
ret double %67
}

LLVM IR (-O2):
define double @egg_holder(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %35
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %10, %7 ]
%9 = phi double [ 0.000000e+00, %4 ], [ %33, %7 ]
%10 = add nuw nsw i64 %8, 1
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fadd double %12, 4.700000e+01
%14 = fneg double %13
%15 = getelementptr inbounds double, double* %0, i64 %8
%16 = load double, double* %15
%17 = tail call double @llvm.fmuladd.f64(double %16, double 5.000000e-01, double %12)
%18 = fadd double %17, 4.700000e+01
%19 = tail call i32 @fabs(double %18)
%20 = tail call i32 @sqrt(i32 %19)
%21 = tail call double @sin(i32 %20)
%22 = load double, double* %15
%23 = load double, double* %11
%24 = fadd double %23, 4.700000e+01
%25 = fsub double %22, %24
%26 = tail call i32 @fabs(double %25)
%27 = tail call i32 @sqrt(i32 %26)
%28 = tail call double @sin(i32 %27)
%29 = load double, double* %15
%30 = fneg double %29
%31 = fmul double %28, %30
%32 = tail call double @llvm.fmuladd.f64(double %14, double %21, double %31)
%33 = fadd double %9, %32
%34 = icmp eq i64 %10, %6
br i1 %34, label %35, label %7
35: ; preds = %7, %2
%36 = phi double [ 0.000000e+00, %2 ], [ %33, %7 ]
ret double %36
}