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


x86 assembly (clang, -O0):
<g_schwefels>:
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,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bd <g_schwefels+0x8d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  0xe96(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <g_schwefels+0x1e>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_schwefels>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    1155 <g_schwefels+0x25>
mov    %rdi,%r15
mov    %esi,%r14d
cmp    $0x1,%esi
jne    115e <g_schwefels+0x2e>
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
jmp    1202 <g_schwefels+0xd2>
xorpd  %xmm0,%xmm0
jmp    1247 <g_schwefels+0x117>
mov    %r14d,%r12d
and    $0xfffffffe,%r12d
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  (%r15,%rbx,8),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%r15,%rbx,8),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x2,%rbx
cmp    %rbx,%r12
jne    1170 <g_schwefels+0x40>
test   $0x1,%r14b
je     1247 <g_schwefels+0x117>
movsd  (%r15,%rbx,8),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movaps %xmm1,%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <sin@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @g_schwefels(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %6
store i32 0, i32* %5
br label %7
7: ; preds = %29, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %32
11: ; preds = %7
%12 = load double*, double** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = fmul double -1.000000e+00, %16
%18 = load double*, double** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = call i32 @fabs(double %22)
%24 = call i32 @sqrt(i32 %23)
%25 = call i32 @sin(i32 %24)
%26 = sitofp i32 %25 to double
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double %17, double %26, double %27)
store double %28, double* %6
br label %29
29: ; preds = %11
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %7
32: ; preds = %7
%33 = load double, double* %6
ret double %33
}

LLVM IR (-O2):
define double @g_schwefels(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %48
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = and i64 %5, 1
%7 = icmp eq i32 %1, 1
br i1 %7, label %34, label %8
8: ; preds = %4
%9 = and i64 %5, 4294967294
br label %10
10: ; preds = %10, %8
%11 = phi i64 [ 0, %8 ], [ %31, %10 ]
%12 = phi double [ 0.000000e+00, %8 ], [ %30, %10 ]
%13 = phi i64 [ 0, %8 ], [ %32, %10 ]
%14 = getelementptr inbounds double, double* %0, i64 %11
%15 = load double, double* %14
%16 = fneg double %15
%17 = tail call i32 @fabs(double %15)
%18 = tail call i32 @sqrt(i32 %17)
%19 = tail call i32 @sin(i32 %18)
%20 = sitofp i32 %19 to double
%21 = tail call double @llvm.fmuladd.f64(double %16, double %20, double %12)
%22 = or i64 %11, 1
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = load double, double* %23
%25 = fneg double %24
%26 = tail call i32 @fabs(double %24)
%27 = tail call i32 @sqrt(i32 %26)
%28 = tail call i32 @sin(i32 %27)
%29 = sitofp i32 %28 to double
%30 = tail call double @llvm.fmuladd.f64(double %25, double %29, double %21)
%31 = add nuw nsw i64 %11, 2
%32 = add i64 %13, 2
%33 = icmp eq i64 %32, %9
br i1 %33, label %34, label %10
34: ; preds = %10, %4
%35 = phi double [ undef, %4 ], [ %30, %10 ]
%36 = phi i64 [ 0, %4 ], [ %31, %10 ]
%37 = phi double [ 0.000000e+00, %4 ], [ %30, %10 ]
%38 = icmp eq i64 %6, 0
br i1 %38, label %48, label %39
39: ; preds = %34
%40 = getelementptr inbounds double, double* %0, i64 %36
%41 = load double, double* %40
%42 = fneg double %41
%43 = tail call i32 @fabs(double %41)
%44 = tail call i32 @sqrt(i32 %43)
%45 = tail call i32 @sin(i32 %44)
%46 = sitofp i32 %45 to double
%47 = tail call double @llvm.fmuladd.f64(double %42, double %46, double %37)
br label %48
48: ; preds = %39, %34, %2
%49 = phi double [ 0.000000e+00, %2 ], [ %35, %34 ], [ %47, %39 ]
ret double %49
}