#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 sin(double);
scalar_t__ tempValue(double, int, int, int);
double penalized2(double sol[], int DIM) {
  double aux = 0.0;
  double aux1 = 0.0;
  int i;
  for (i = 0; i < DIM - 1; i++) {
    aux += pow(sol[i] - 1, 2.0) *
           (1.0 + 10.0 * pow(sin(3 * 3.14159265 * sol[i + 1]), 2.0));
  }
  for (i = 0; i < DIM; i++) {
    aux1 += tempValue(sol[i], 5, 100, 4);
  }
  return ((pow(sin(3.0 * 3.14159265 * sol[0]), 2.0) + aux +
           pow(sol[DIM - 1] - 1, 2.0) *
               (1.0 + pow(sin(2.0 * 3.14159265 * sol[DIM - 1]), 2.0))) /
              10.0 +
          aux1);
}


x86 assembly (clang, -O0):
<penalized2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11fe <penalized2+0xce>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe8c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xe79(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
movsd  0xe57(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movsd  0xe32(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xe2e(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1156 <penalized2+0x26>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    124f <penalized2+0x11f>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x5,%edi
mov    $0x64,%esi
mov    $0x4,%edx
call   1040 <tempValue@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1205 <penalized2+0xd5>
mov    -0x8(%rbp),%rax
movsd  0xdc5(%rip),%xmm0
mulsd  (%rax),%xmm0
call   1030 <sin@plt>
movsd  0xda4(%rip),%xmm1
call   1050 <pow@plt>
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xd73(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd6f(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xd58(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
movsd  0xd3e(%rip),%xmm1
call   1050 <pow@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
movsd  0xd1c(%rip),%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd00(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<penalized2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %rdi,%r15
lea    -0x1(%r14),%r12d
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
cmp    $0x2,%esi
jl     1297 <penalized2+0x177>
mov    %r12d,%ebx
cmp    $0x1,%r12d
jne    115d <penalized2+0x3d>
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
jmp    1236 <penalized2+0x116>
mov    %ebx,%r13d
and    $0xfffffffe,%r13d
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,0x8(%rsp)
movsd  (%r15,%rbp,8),%xmm2
movsd  0xe7c(%rip),%xmm0
addsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm2
movsd  %xmm2,(%rsp)
movsd  0x8(%r15,%rbp,8),%xmm0
movsd  0xe68(%rip),%xmm2
mulsd  %xmm2,%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe57(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe53(%rip),%xmm0
addsd  %xmm0,%xmm1
mulsd  (%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%r15,%rbp,8),%xmm0
addsd  0xe18(%rip),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%r15,%rbp,8),%xmm0
mulsd  0xe07(%rip),%xmm0
add    $0x2,%rbp
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xdf6(%rip),%xmm1
addsd  0xdf6(%rip),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  (%rsp),%xmm1
cmp    %rbp,%r13
jne    1170 <penalized2+0x50>
test   $0x1,%bl
xorpd  %xmm0,%xmm0
je     1297 <penalized2+0x177>
movsd  (%r15,%rbp,8),%xmm2
addsd  0xdb3(%rip),%xmm2
movsd  0x8(%r15,%rbp,8),%xmm0
mulsd  %xmm2,%xmm2
movsd  %xmm2,(%rsp)
mulsd  0xda3(%rip),%xmm0
movsd  %xmm1,0x8(%rsp)
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm0
mulsd  0xd8e(%rip),%xmm0
addsd  0xd8e(%rip),%xmm0
mulsd  (%rsp),%xmm0
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm1,0x8(%rsp)
test   %r14d,%r14d
jle    12f3 <penalized2+0x1d3>
mov    %r14d,%ebp
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%r15,%rbx,8),%xmm0
mov    $0x5,%edi
mov    $0x64,%esi
mov    $0x4,%edx
call   1040 <tempValue@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    12b0 <penalized2+0x190>
movsd  %xmm0,(%rsp)
movsd  (%r15),%xmm0
mulsd  0xd03(%rip),%xmm0
call   1030 <sin@plt>
mulsd  %xmm0,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movslq %r12d,%rax
movsd  (%r15,%rax,8),%xmm0
movsd  0xcd5(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
mulsd  0xcdf(%rip),%xmm0
call   1030 <sin@plt>
mulsd  %xmm0,%xmm0
addsd  0xcc6(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
divsd  0xcaa(%rip),%xmm0
addsd  (%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @penalized2(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store i32 0, i32* %7
br label %8
8: ; preds = %33, %2
%9 = load i32, i32* %7
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %36
13: ; preds = %8
%14 = load double*, double** %3
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = fsub double %18, 1.000000e+00
%20 = call double @pow(double %19, double 2.000000e+00)
%21 = load double*, double** %3
%22 = load i32, i32* %7
%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 = fmul double 0x4022D97C7ED69FB5, %26
%28 = call double @sin(double %27)
%29 = call double @pow(double %28, double 2.000000e+00)
%30 = call double @llvm.fmuladd.f64(double 1.000000e+01, double %29, double 1.000000e+00)
%31 = load double, double* %5
%32 = call double @llvm.fmuladd.f64(double %20, double %30, double %31)
store double %32, double* %5
br label %33
33: ; preds = %13
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %8
36: ; preds = %8
store i32 0, i32* %7
br label %37
37: ; preds = %51, %36
%38 = load i32, i32* %7
%39 = load i32, i32* %4
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %54
41: ; preds = %37
%42 = load double*, double** %3
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = call i64 @tempValue(double %46, i32 5, i32 100, i32 4)
%48 = sitofp i64 %47 to double
%49 = load double, double* %6
%50 = fadd double %49, %48
store double %50, double* %6
br label %51
51: ; preds = %41
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %37
54: ; preds = %37
%55 = load double*, double** %3
%56 = getelementptr inbounds double, double* %55, i64 0
%57 = load double, double* %56
%58 = fmul double 0x4022D97C7ED69FB5, %57
%59 = call double @sin(double %58)
%60 = call double @pow(double %59, double 2.000000e+00)
%61 = load double, double* %5
%62 = fadd double %60, %61
%63 = load double*, double** %3
%64 = load i32, i32* %4
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %63, i64 %66
%68 = load double, double* %67
%69 = fsub double %68, 1.000000e+00
%70 = call double @pow(double %69, double 2.000000e+00)
%71 = load double*, double** %3
%72 = load i32, i32* %4
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %71, i64 %74
%76 = load double, double* %75
%77 = fmul double 0x401921FB53C8D4F1, %76
%78 = call double @sin(double %77)
%79 = call double @pow(double %78, double 2.000000e+00)
%80 = fadd double 1.000000e+00, %79
%81 = call double @llvm.fmuladd.f64(double %70, double %80, double %62)
%82 = fdiv double %81, 1.000000e+01
%83 = load double, double* %6
%84 = fadd double %82, %83
ret double %84
}

LLVM IR (-O2):
define double @penalized2(double* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %29
5: ; preds = %2
%6 = zext i32 %3 to i64
%7 = and i64 %6, 1
%8 = icmp eq i32 %3, 1
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = and i64 %6, 4294967294
br label %34
11: ; preds = %34, %5
%12 = phi double [ undef, %5 ], [ %61, %34 ]
%13 = phi i64 [ 0, %5 ], [ %54, %34 ]
%14 = phi double [ 0.000000e+00, %5 ], [ %61, %34 ]
%15 = icmp eq i64 %7, 0
br i1 %15, label %29, label %16
16: ; preds = %11
%17 = getelementptr inbounds double, double* %0, i64 %13
%18 = load double, double* %17
%19 = fadd double %18, -1.000000e+00
%20 = fmul double %19, %19
%21 = add nuw nsw i64 %13, 1
%22 = getelementptr inbounds double, double* %0, i64 %21
%23 = load double, double* %22
%24 = fmul double %23, 0x4022D97C7ED69FB5
%25 = tail call double @sin(double %24)
%26 = fmul double %25, %25
%27 = tail call double @llvm.fmuladd.f64(double %26, double 1.000000e+01, double 1.000000e+00)
%28 = tail call double @llvm.fmuladd.f64(double %20, double %27, double %14)
br label %29
29: ; preds = %16, %11, %2
%30 = phi double [ 0.000000e+00, %2 ], [ %12, %11 ], [ %28, %16 ]
%31 = icmp sgt i32 %1, 0
br i1 %31, label %32, label %74
32: ; preds = %29
%33 = zext i32 %1 to i64
br label %64
34: ; preds = %34, %9
%35 = phi i64 [ 0, %9 ], [ %54, %34 ]
%36 = phi double [ 0.000000e+00, %9 ], [ %61, %34 ]
%37 = phi i64 [ 0, %9 ], [ %62, %34 ]
%38 = getelementptr inbounds double, double* %0, i64 %35
%39 = load double, double* %38
%40 = fadd double %39, -1.000000e+00
%41 = fmul double %40, %40
%42 = or i64 %35, 1
%43 = getelementptr inbounds double, double* %0, i64 %42
%44 = load double, double* %43
%45 = fmul double %44, 0x4022D97C7ED69FB5
%46 = tail call double @sin(double %45)
%47 = fmul double %46, %46
%48 = tail call double @llvm.fmuladd.f64(double %47, double 1.000000e+01, double 1.000000e+00)
%49 = tail call double @llvm.fmuladd.f64(double %41, double %48, double %36)
%50 = getelementptr inbounds double, double* %0, i64 %42
%51 = load double, double* %50
%52 = fadd double %51, -1.000000e+00
%53 = fmul double %52, %52
%54 = add nuw nsw i64 %35, 2
%55 = getelementptr inbounds double, double* %0, i64 %54
%56 = load double, double* %55
%57 = fmul double %56, 0x4022D97C7ED69FB5
%58 = tail call double @sin(double %57)
%59 = fmul double %58, %58
%60 = tail call double @llvm.fmuladd.f64(double %59, double 1.000000e+01, double 1.000000e+00)
%61 = tail call double @llvm.fmuladd.f64(double %53, double %60, double %49)
%62 = add i64 %37, 2
%63 = icmp eq i64 %62, %10
br i1 %63, label %11, label %34
64: ; preds = %32, %64
%65 = phi i64 [ 0, %32 ], [ %72, %64 ]
%66 = phi double [ 0.000000e+00, %32 ], [ %71, %64 ]
%67 = getelementptr inbounds double, double* %0, i64 %65
%68 = load double, double* %67
%69 = tail call i64 @tempValue(double %68, i32 5, i32 100, i32 4)
%70 = sitofp i64 %69 to double
%71 = fadd double %66, %70
%72 = add nuw nsw i64 %65, 1
%73 = icmp eq i64 %72, %33
br i1 %73, label %74, label %64
74: ; preds = %64, %29
%75 = phi double [ 0.000000e+00, %29 ], [ %71, %64 ]
%76 = load double, double* %0
%77 = fmul double %76, 0x4022D97C7ED69FB5
%78 = tail call double @sin(double %77)
%79 = fmul double %78, %78
%80 = fadd double %30, %79
%81 = sext i32 %3 to i64
%82 = getelementptr inbounds double, double* %0, i64 %81
%83 = load double, double* %82
%84 = fadd double %83, -1.000000e+00
%85 = fmul double %84, %84
%86 = fmul double %83, 0x401921FB53C8D4F1
%87 = tail call double @sin(double %86)
%88 = fmul double %87, %87
%89 = fadd double %88, 1.000000e+00
%90 = tail call double @llvm.fmuladd.f64(double %85, double %89, double %80)
%91 = fdiv double %90, 1.000000e+01
%92 = fadd double %75, %91
ret double %92
}