// File: mateuz[P]MTS-LS1/source/Benchmarks.cpp
// Function: Benchmarks::rotateVector(int, int&)
double* Benchmarks::rotateVector(int i, int &c)
{
  double* z = new double[s[i]];
  // cout<<"s "<<s[i]<<endl;

  // copy values into the new vector
  for (int j = c; j < c+s[i]; ++j)
    {
      // cout<<"j-c "<<j-c<<" p "<<Pvector[j]<<endl;
      z[j-c] = anotherz[Pvector[j]];
    }
  // 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 -0x8(%rbp), %rax
movq %rax, -0x30(%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 %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rdx
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
movq 0xf0(%rdx), %rdx
movslq -0xc(%rbp), %rsi
addl (%rdx,%rsi,4), %ecx
cmpl %ecx, %eax
jge 0x5c30
movq -0x30(%rbp), %rcx
movq 0x70(%rcx), %rax
movq 0x58(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rdx
subl (%rdx), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5bd8
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x19, (%rax,%rcx,4)
jne 0x5c77
movq -0x30(%rbp), %rdi
movq -0x20(%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 -0x30(%rbp), %rax
movq %rcx, 0x78(%rax)
jmp 0x5d25
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x32, (%rax,%rcx,4)
jne 0x5cbb
movq -0x30(%rbp), %rdi
movq -0x20(%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 -0x30(%rbp), %rax
movq %rcx, 0x78(%rax)
jmp 0x5d23
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x64, (%rax,%rcx,4)
jne 0x5cff
movq -0x30(%rbp), %rdi
movq -0x20(%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 -0x30(%rbp), %rax
movq %rcx, 0x78(%rax)
jmp 0x5d21
movq 0x142ca(%rip), %rdi     # 0x19fd0
leaq 0xd438(%rip), %rsi      # 0x13145
callq 0x31d0
movq %rax, %rdi
movq 0x1429c(%rip), %rsi     # 0x19fb8
callq 0x31f0
jmp 0x5d23
jmp 0x5d25
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x5d3c
movq -0x38(%rbp), %rdi
callq 0x3230
movq -0x30(%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)