2. a) (10 points) What C code line most likely created this assembly code? Assum
ID: 3756296 • Letter: 2
Question
2. a) (10 points) What C code line most likely created this assembly code? Assume A, B, C and D variables in assembly arex, y, z and w in C, respectively. b) (5 points) What is the result in A at the end of execution of this program? Assembly Program AREA e, CODE EXPORT main ENTRY main PROC LDR r2, B LDR r3, Ir21 LDR r2,-C LDR r5, [r2) ADD r3, r3, r5 LDR r2, D LDR r, [r2) SUB r3, r3, r5 LDR r2,A STR r3, [r2) AREA d, DATA A DCD DOD 5 C DCD 1 D DCD 2 ENDP END (15 points) For the six-bit binary values given below, find the equivalent decimal values when the data is interpreted as unsigned integers or signed integers. 3. 001111, 101011, 110110Explanation / Answer
#include<stdio.h>
#include “CODE”
//A->x,B->y,C->z,D->w
struct {
int n;
unsigned int value : 1*n+1;
}BitField;
int main(){
int *r2,r3,r5;
r2=&y;
r3=*r2;
r2=&z;
r5=*r2;
r3=r3+r5;
r2=&w;
r5=*r2;
struct BitField k=(struct BitField *)malloc(sizeof( struct BitField));
k.n=0;
k.value=A;
printf(“%d”,k.value);
struct BitField k=(struct BitField *)malloc(sizeof( struct BitField));
k.n=5;
k.value=B;
printf(“%d”,k.value);
struct BitField k=(struct BitField *)malloc(sizeof( struct BitField));
k.n=1;
k.value=C;
printf(“%d”,k.value);
struct BitField k=(struct BitField *)malloc(sizeof( struct BitField));
k.n=2;
k.value=D;
printf(“%d”,k.value);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.