// File: mateuz[P]MTS-LS1/source/Benchmarks.cpp
// Function: Benchmarks::rotateVectorConflict(int, int&, double*)
double* Benchmarks::rotateVectorConflict(int i, int &c, double* x)
{
  double* z = new double[s[i]];
  // printf("i=%d\tc=%d\tl=%d\tu=%d\n", i, c, c - (i)*overlap, c +s[i] - (i)*overlap);
  
  // copy values into the new vector
  for (int j = c - i*overlap; j < c +s[i] - i*overlap; ++j)
    {
      // cout<<"j-c "<<j-c<<" p "<<Pvector[j]<<endl;
      z[j-(c - i*overlap)] = x[Pvector[j]] - OvectorVec[i][j-(c - i*overlap)];  
    }

  // cout<<"copy done"<<endl;
  if (s[i]==25)
    {
      anotherz1 = multiply( z, r25, s[i]);
    }
  else if (s[i] == 50)
    {    
      anotherz1 = multiply( z, r50, s[i]);
    }
  else if (s[i] == 100) 
    {
      anotherz1 = multiply( z, r100, s[i]);
    }
  else
    {
      cout<< "size of rotation matrix out of range" <<endl;
    }
  delete []z;
  c = c + s[i];
  return anotherz1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq -0x38(%rbp), %rdx
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl -0xc(%rbp), %ecx
imull 0x40(%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
movq 0xf0(%rsi), %rdx
movslq -0xc(%rbp), %rdi
addl (%rdx,%rdi,4), %ecx
movl -0xc(%rbp), %edx
imull 0x40(%rsi), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x6150
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x58(%rdi), %rcx
movslq -0x2c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x50(%rdi), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rdx
movl (%rdx), %edx
movl -0xc(%rbp), %esi
imull 0x40(%rdi), %esi
subl %esi, %edx
subl %edx, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rdx
movl (%rdx), %edx
movl -0xc(%rbp), %esi
imull 0x40(%rdi), %esi
subl %esi, %edx
subl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x60b9
movq -0x38(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x19, (%rax,%rcx,4)
jne 0x6197
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq 0xd8(%rdi), %rdx
movq 0xf0(%rdi), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
callq 0x5d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x78(%rax)
jmp 0x6245
movq -0x38(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x32, (%rax,%rcx,4)
jne 0x61db
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq 0xe0(%rdi), %rdx
movq 0xf0(%rdi), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
callq 0x5d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x78(%rax)
jmp 0x6243
movq -0x38(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x64, (%rax,%rcx,4)
jne 0x621f
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq 0xe8(%rdi), %rdx
movq 0xf0(%rdi), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
callq 0x5d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x78(%rax)
jmp 0x6241
movq 0x13daa(%rip), %rdi     # 0x19fd0
leaq 0xcf18(%rip), %rsi      # 0x13145
callq 0x31d0
movq %rax, %rdi
movq 0x13d7c(%rip), %rsi     # 0x19fb8
callq 0x31f0
jmp 0x6243
jmp 0x6245
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x625c
movq -0x40(%rbp), %rdi
callq 0x3230
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %edx
movq 0xf0(%rax), %rcx
movslq -0xc(%rbp), %rsi
addl (%rcx,%rsi,4), %edx
movq -0x18(%rbp), %rcx
movl %edx, (%rcx)
movq 0x78(%rax), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)