// Array Access

%rdi = z
%rsi = digit
movl (%rdi,%rsi,4), %eax  // z[digit]

mov 0x100(%rbx,%rax,4), %rax // x = b[x][y]

int get_digit(int z[5], int digit)
{
  return z[digit];
}

addl    $1, (%rdi,%rax,4) #   z[i]++ // Increment the array

Multidimensional Arrays vs. MultiLevel Arrays

Multidimensional

A[R][C]
movel(A, I, K) // A = array, I = index, K = Bytes
A +  i * (C * K) // start of each row where C is the elements in row

array[0][1] = ........0000 0001 

array[0][2] = ........0000 0010 

array[0][3] = ........0000 0011

Untitled

Untitled

Finding the Functions

Untitled

Untitled

Multilevel Array

Untitled

int myArr2[3]* // array of pointers to array

// Condsider this Array
int ∗my array [ 4 ] [ 3 ] ;

// Accessing from Above Array
My_array + x*3*8 + y*8

Untitled

Untitled

Untitled