title: How to find fixed lengths of multidimensional arrays by assembly code?
body: <p>How do you go about solving the fixed constants of an array if you have 3 dimensions? I can compute that the assembly code gets us the formula 
  ((32k + j)16 + i) in %rax for indexing array2 and
  ((32i + j)16 + k) in %rdx for indexing array1, but how does this help use find the constants M, N and L?</p>
  
  <pre><code>#define M ___________
  #define N ____________
  #define L ____________
  
  int array1[M][N][L];
  int array2[L][N][M];
  
  int copyandsub(int i, int j, int k){
      array1[i][j][k] = array2[k][j][i] - 1;
  }
  </code></pre>
  
  <p>Assembly code generated:</p>
  
  <pre><code>Copandsub:
  movslq %edi, %rdi
  movslq %edx, %rdx
  movslq %esi, %rsi
  movq %rdx, %rax
  salq $5, %rax
  addq %rsi, %rax
  salq $4, %rax
  addq %rdi, %rax
  movl array2(,%rax,4), %eax
  subl $1, %eax
  salq $5, %rdi
  addq %rdi, %rsi
  salq $4, %rsi
  addq %rsi, %rdx
  movl %eax, array1(,%rdx,4)
  ret
  </code></pre>