For each structure below, determine the size of the structure, specify what the byte alignment should be (1, 2, 4 or 8) then find a way to calculate addresses to the specified structure element without using a multiply instruction. Include an instruction for each question that reads the structure member specified into register %rax/%eax/%ax/%al.
1. struct S1 {
char c;
int a[7];
struct S1 *next;
} S1_array[50];
Looking for S1_array[i].a[3]. Assume %rdi contains $S1_array and %rsi contains i.
2. struct S2 {
char m1[13];
short m2;
char m3;
float m4;
} S2_array[30];
Looking for S2_array[i].m3. Assume %rdi contains $S2_array and %rsi contains i.
3. struct S3 {
int a;
char b;
int c;
double d;
char e[5];
} S3_array[15];
Looking for S3_array[i].e[j]. Assume %rdi contains $S3_array, %rsi contains i, %rdx contains j
4. struct S4 {
char m1[30];
char m2;
} S4_array[34];
Looking for S4_array[i].m2. Assume %rdi contains $S4_array and %rsi contains i.
5. struct S5 {
char m1;
struct S6 {
char n1;
char n2;
int n3;
} S6_val;
short m2;
} S5_array[120];
Specify struct size and byte alignment value for both S5 and S6. Looking for S5_array[i].S6_val.n3. Assume %rdi contains $S5_array and %rsi contains i.