// File: /workspace/github_cpp_makefile_star2_O2/mateuz[P]MTS-LS1/source/F6.cpp
// Function: F6::compute(double*)
double F6::compute(double*x){
  int    i;
  double result = 0.0;

  if(Ovector == NULL) {
    Ovector = readOvector();
    Pvector = readPermVector();
    r25 = readR(25);
    r50 = readR(50);
    r100 = readR(100);
    s = readS(s_size);
    w = readW(s_size);
  }

  for(i = 0; i < dimension; i++) {
    anotherz[i] = x[i] - Ovector[i];
  }

  // cout<<"non"<<endl;
  
  // s_size non-separable part with rotation
  int c = 0;
  for (i = 0; i < s_size; i++)
    {
      // cout<<"c="<<c<<", i="<<i<<endl;
      anotherz1 = rotateVector(i, c);
      // cout<<"done rot"<<endl;
      result += w[i] * ackley(anotherz1, s[i]);
      delete []anotherz1;
      // cout<<result<<endl;
    }
  
  // one separable part without rotation
  double* z = new double[dimension-c];
  for (i = c; i < dimension; i++)
    {
      // cout<<i-c<<" "<<Pvector[i]<<" "<<anotherz[Pvector[i]]<<endl;
      z[i-c] = anotherz[Pvector[i]];
    }
  result += ackley(z, dimension-c);
  delete []z;
  
  return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x48(%rdi), %rax
testq %rax, %rax
jne 0x77be
movq %rbx, %rdi
callq 0x3a5e
movq %rax, 0x48(%rbx)
movq %rbx, %rdi
callq 0x42a8
movq %rax, 0x58(%rbx)
pushq $0x19
popq %rsi
movq %rbx, %rdi
callq 0x46d2
movq %rax, 0xd8(%rbx)
pushq $0x32
popq %rsi
movq %rbx, %rdi
callq 0x46d2
movq %rax, 0xe0(%rbx)
pushq $0x64
popq %rsi
movq %rbx, %rdi
callq 0x46d2
movq %rax, 0xe8(%rbx)
movl 0x3c(%rbx), %esi
movq %rbx, %rdi
callq 0x4978
movq %rax, 0xf0(%rbx)
movl 0x3c(%rbx), %esi
movq %rbx, %rdi
callq 0x4afe
movq %rax, 0xf8(%rbx)
movq 0x48(%rbx), %rax
movl 0xb8(%rbx), %ecx
movq 0x70(%rbx), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
cmpq %rsi, %rcx
je 0x77e9
movsd (%r14,%rsi,8), %xmm0
subsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rdx,%rsi,8)
incq %rsi
jmp 0x77cf
leaq -0x3c(%rbp), %r14
andl $0x0, (%r14)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
xorl %r15d, %r15d
movslq 0x3c(%rbx), %rax
cmpq %rax, %r15
jge 0x7874
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x4c82
movq %rax, 0x78(%rbx)
movq 0xf0(%rbx), %rcx
movq 0xf8(%rbx), %rdx
movsd (%rdx,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movl (%rcx,%r15,4), %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x51c8
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x7858
movsd %xmm0, -0x48(%rbp)
callq 0x3210
movsd -0x48(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
incq %r15
jmp 0x77fd
movslq 0xb8(%rbx), %r12
movslq -0x3c(%rbp), %r13
movq %r12, %r14
subq %r13, %r14
movq %r14, %rax
shlq $0x3, %rax
testl %r14d, %r14d
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x3030
movq %rax, %r15
movq 0x70(%rbx), %rax
leaq (,%r13,4), %rcx
addq 0x58(%rbx), %rcx
xorl %edx, %edx
leaq (%rdx,%r13), %rsi
cmpq %r12, %rsi
jge 0x78cd
movslq (%rcx,%rdx,4), %rsi
movsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%r15,%rdx,8)
incq %rdx
jmp 0x78b0
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x51c8
movsd %xmm0, -0x30(%rbp)
movq %r15, %rdi
callq 0x3210
movsd -0x38(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)