#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*/ checkisLbUb(double *, int const, int, int);
int /*<<< orphan*/ memcpy(double *, double *, int const);
double objfunc(double *, int const *, int const *, int *);
void neighborhoodChange(double *x, double *y, double *fx, const int DIM, int *k,
                        const int FUNCTION, int *best_aval, int *aval,
                        double *fy, int lb, int ub) {
  checkisLbUb(y, DIM, lb, ub);
  *fy = objfunc(y, &FUNCTION, &DIM, aval);
  if (*fy < *fx) {
    *best_aval = *aval;
    memcpy(x, y, DIM * sizeof(double));
    *fx = *fy;
    *k = 1;
  } else {
    *k += 1;
  }
}


x86 assembly (clang, -O0):
<neighborhoodChange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x28(%rbp),%edx
mov    0x30(%rbp),%ecx
call   1050 <checkisLbUb@plt>
mov    -0x10(%rbp),%rdi
mov    0x18(%rbp),%rcx
lea    -0x2c(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <objfunc@plt>
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ec <neighborhoodChange+0xbc>
mov    0x18(%rbp),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    11f7 <neighborhoodChange+0xc7>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neighborhoodChange>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
mov    0x50(%rsp),%rbp
mov    0x48(%rsp),%r13
mov    0x58(%rsp),%edx
mov    0x60(%rsp),%eax
mov    %ecx,(%rsp)
mov    %r9d,0x4(%rsp)
mov    %rsi,%rdi
mov    %ecx,%esi
mov    %eax,%ecx
call   1050 <checkisLbUb@plt>
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r13,%rcx
call   1030 <objfunc@plt>
movsd  %xmm0,0x0(%rbp)
movsd  (%r15),%xmm1
ucomisd %xmm0,%xmm1
jbe    11bd <neighborhoodChange+0x8d>
mov    0x40(%rsp),%rax
mov    0x0(%r13),%ecx
mov    %ecx,(%rax)
mov    (%rsp),%edx
shl    $0x3,%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <memcpy@plt>
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,(%r15)
mov    $0x1,%eax
jmp    11c3 <neighborhoodChange+0x93>
mov    (%r14),%eax
add    $0x1,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @neighborhoodChange(double* %0, double* %1, double* %2, i32 %3, i32* %4, i32 %5, i32* %6, i32* %7, double* %8, i32 %9, i32 %10) {
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
store double* %0, double** %12
store double* %1, double** %13
store double* %2, double** %14
store i32 %3, i32* %15
store i32* %4, i32** %16
store i32 %5, i32* %17
store i32* %6, i32** %18
store i32* %7, i32** %19
store double* %8, double** %20
store i32 %9, i32* %21
store i32 %10, i32* %22
%23 = load double*, double** %13
%24 = load i32, i32* %15
%25 = load i32, i32* %21
%26 = load i32, i32* %22
%27 = call i32 @checkisLbUb(double* %23, i32 %24, i32 %25, i32 %26)
%28 = load double*, double** %13
%29 = load i32*, i32** %19
%30 = call double @objfunc(double* %28, i32* %17, i32* %15, i32* %29)
%31 = load double*, double** %20
store double %30, double* %31
%32 = load double*, double** %20
%33 = load double, double* %32
%34 = load double*, double** %14
%35 = load double, double* %34
%36 = fcmp olt double %33, %35
br i1 %36, label %37, label %52
37: ; preds = %11
%38 = load i32*, i32** %19
%39 = load i32, i32* %38
%40 = load i32*, i32** %18
store i32 %39, i32* %40
%41 = load double*, double** %12
%42 = load double*, double** %13
%43 = load i32, i32* %15
%44 = sext i32 %43 to i64
%45 = mul i64 %44, 8
%46 = trunc i64 %45 to i32
%47 = call i32 @memcpy(double* %41, double* %42, i32 %46)
%48 = load double*, double** %20
%49 = load double, double* %48
%50 = load double*, double** %14
store double %49, double* %50
%51 = load i32*, i32** %16
store i32 1, i32* %51
br label %56
52: ; preds = %11
%53 = load i32*, i32** %16
%54 = load i32, i32* %53
%55 = add nsw i32 %54, 1
store i32 %55, i32* %53
br label %56
56: ; preds = %52, %37
ret void
}

LLVM IR (-O2):
define void @neighborhoodChange(double* %0, double* %1, double* nocapture %2, i32 %3, i32* nocapture %4, i32 %5, i32* nocapture writeonly %6, i32* %7, double* nocapture %8, i32 %9, i32 %10) {
%12 = alloca i32
%13 = alloca i32
store i32 %3, i32* %12
store i32 %5, i32* %13
%14 = tail call i32 @checkisLbUb(double* %1, i32 %3, i32 %9, i32 %10)
%15 = call double @objfunc(double* %1, i32* %13, i32* %12, i32* %7)
store double %15, double* %8
%16 = load double, double* %2
%17 = fcmp olt double %15, %16
br i1 %17, label %18, label %24
18: ; preds = %11
%19 = load i32, i32* %7
store i32 %19, i32* %6
%20 = load i32, i32* %12
%21 = shl i32 %20, 3
%22 = call i32 @memcpy(double* %0, double* %1, i32 %21)
%23 = load double, double* %8
store double %23, double* %2
br label %27
24: ; preds = %11
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
br label %27
27: ; preds = %24, %18
%28 = phi i32 [ %26, %24 ], [ 1, %18 ]
store i32 %28, i32* %4
ret void
}