// 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


Finding the Functions


- When doing this type of problem, when we access the array2(, rdx, 4) → we are looking for the number of columns which can give us an idea of what n is, same thing for m
Multilevel Array

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


