#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 */
scalar_t__ f_10(double, double);
double Extended_f_10NoDesplazamiento(double sol[], int DIM) {
  double suma = 0.0;
  int i;
  for (i = 0; i < DIM - 1; i++)
    suma += f_10(sol[i], sol[i + 1]);
  suma += f_10(sol[DIM - 1], sol[0]);
  return suma;
}


x86 assembly (clang, -O0):
<Extended_f_10NoDesplazamiento>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    1180 <Extended_f_10NoDesplazamiento+0x70>
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  (%rax,%rcx,8),%xmm1
call   1030 <f_10@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <Extended_f_10NoDesplazamiento+0x1e>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <f_10@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Extended_f_10NoDesplazamiento>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    -0x1(%rsi),%r14d
xorps  %xmm0,%xmm0
cmp    $0x2,%esi
jl     116c <Extended_f_10NoDesplazamiento+0x5c>
mov    %r14d,%r15d
xorps  %xmm0,%xmm0
xor    %eax,%eax
xchg   %ax,%ax
movsd  %xmm0,(%rsp)
lea    0x1(%rax),%rbp
movsd  (%rbx,%rax,8),%xmm0
movsd  0x8(%rbx,%rax,8),%xmm1
call   1030 <f_10@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
mov    %rbp,%rax
cmp    %rbp,%r15
jne    1130 <Extended_f_10NoDesplazamiento+0x20>
movsd  %xmm0,(%rsp)
movslq %r14d,%rax
movsd  (%rbx,%rax,8),%xmm0
movsd  (%rbx),%xmm1
call   1030 <f_10@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @Extended_f_10NoDesplazamiento(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 = %28, %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 %31
12: ; preds = %7
%13 = load double*, double** %3
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %18, i64 %21
%23 = load double, double* %22
%24 = call i64 @f_10(double %17, double %23)
%25 = sitofp i64 %24 to double
%26 = load double, double* %5
%27 = fadd double %26, %25
store double %27, double* %5
br label %28
28: ; preds = %12
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %7
31: ; preds = %7
%32 = load double*, double** %3
%33 = load i32, i32* %4
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %32, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %3
%39 = getelementptr inbounds double, double* %38, i64 0
%40 = load double, double* %39
%41 = call i64 @f_10(double %37, double %40)
%42 = sitofp i64 %41 to double
%43 = load double, double* %5
%44 = fadd double %43, %42
store double %44, double* %5
%45 = load double, double* %5
ret double %45
}

LLVM IR (-O2):
define double @Extended_f_10NoDesplazamiento(double* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = phi double [ 0.000000e+00, %5 ], [ %17, %7 ]
%10 = getelementptr inbounds double, double* %0, i64 %8
%11 = load double, double* %10
%12 = add nuw nsw i64 %8, 1
%13 = getelementptr inbounds double, double* %0, i64 %12
%14 = load double, double* %13
%15 = tail call i64 @f_10(double %11, double %14)
%16 = sitofp i64 %15 to double
%17 = fadd double %9, %16
%18 = icmp eq i64 %12, %6
br i1 %18, label %19, label %7
19: ; preds = %7, %2
%20 = phi double [ 0.000000e+00, %2 ], [ %17, %7 ]
%21 = sext i32 %3 to i64
%22 = getelementptr inbounds double, double* %0, i64 %21
%23 = load double, double* %22
%24 = load double, double* %0
%25 = tail call i64 @f_10(double %23, double %24)
%26 = sitofp i64 %25 to double
%27 = fadd double %20, %26
ret double %27
}