Page 1 of 1

In the C function that follows, we have omitted the body of the switch statement. In the C code, the case labels did not

Posted: Sat May 14, 2022 4:52 pm
by answerhappygod
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 1
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 1 (37.13 KiB) Viewed 41 times
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 2
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 2 (33.34 KiB) Viewed 41 times
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 3
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 3 (24.47 KiB) Viewed 41 times
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 4
In The C Function That Follows We Have Omitted The Body Of The Switch Statement In The C Code The Case Labels Did Not 4 (23.71 KiB) Viewed 41 times
In the C function that follows, we have omitted the body of the switch statement. In the C code, the case labels did not span a contiguous range, and some cases had multiple labels. void switch(short x, short \*dest) { short val 0; switch (x) { Body of switch statement omit } \*dest = val; } In compiling the function, gcc generates the assembly code that follows for the initial part of the procedure, with variable x in %rdi: ; void switch(short x, short *dest) ; x in %rdi switch: addq $2, %rdi cmpq $8, %rdi

void switch(short x, short \*dest) { short val = 0; switch (x) { Body of switch statement omit } \*dest = val; } In compiling the function, gcc generates the assembly code that follows for the initial part of the procedure, with variable x in %rdi: ; void switch(short x, short *dest) ; x in %rdi switch: addq $2, %rdi cmpq $8%rdi ja .L2 jmp *.L4(, %rdi, 8) Based on this information, answer the following questions:

Question 13 Not yet answered Points out of 2.00 P Flag question What is the maximum case label in the above code? For example, in the following code, the maximum case label is 7. void switcher(long a, long b, long c, { long val; switch(a) { case 5: c = b^15; /* Fall through */ case 0: val = c + 112; break; case 2: case 7: val = (C + b) << 2; break;

^ = maximum case label is 7. void switcher(long a, long b, long c, { long val; switch(a) { case 5: C = b ^ 15; /* Fall through */ case 0: val = c + 112; break; case 2: case 7: val = (c + b) << 2; break; case 4: val break; default: val = b; } *dest = val; } = a; Answer: