// File: mateuz[P]MTS-LS1/source/Benchmarks.cpp
// Function: Benchmarks::rotateVectorConform(int, int&)
double* Benchmarks::rotateVectorConform(int i, int &c)
{
  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)] = 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 -0x30(%rbp), %rdx
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl -0xc(%rbp), %ecx
imull 0x40(%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rsi
movl -0x24(%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 0x5f11
movq -0x30(%rbp), %rdi
movq 0x70(%rdi), %rax
movq 0x58(%rdi), %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
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 -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5ea5
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x19, (%rax,%rcx,4)
jne 0x5f58
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 0x6006
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x32, (%rax,%rcx,4)
jne 0x5f9c
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 0x6004
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x64, (%rax,%rcx,4)
jne 0x5fe0
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 0x6002
movq 0x13fe9(%rip), %rdi     # 0x19fd0
leaq 0xd157(%rip), %rsi      # 0x13145
callq 0x31d0
movq %rax, %rdi
movq 0x13fbb(%rip), %rsi     # 0x19fb8
callq 0x31f0
jmp 0x6004
jmp 0x6006
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x601d
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)