Write an assembly language program that corresponds to the following C program:
int width;
int length;
int perim;
int main () {
scanf ("%d%d", &width, &length);
perim = (width + length) * 2;
printf ("width = %d\n", width);
printf ("length = %d\n\n", width);
printf ("perim = %d\n", perim);
return 0;
}
.Ltext0:
.LC0:
.string "%d%d"
.LC1:
.string "width = %d\n"
.LC2:
.string "length = %d\n\n"
.LC3:
.string "perim = %d\n"
main:
.LFB0:
push rbp
mov rbp, rsp
mov edx, OFFSET FLAT:length
mov esi, OFFSET FLAT:width
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call scanf
mov edx, DWORD PTR width[rip]
mov eax, DWORD PTR length[rip]
add eax, edx
add eax, eax
mov DWORD PTR perim[rip], eax
mov eax, DWORD PTR width[rip]
mov esi, eax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call printf
mov eax, DWORD PTR width[rip]
mov esi, eax
mov edi, OFFSET FLAT:.LC2
mov eax, 0
call printf
mov eax, DWORD PTR perim[rip]
mov esi, eax
mov edi, OFFSET FLAT:.LC3
mov eax, 0
call printf
mov eax, 0
pop rbp
ret
Write an assembly language program that corresponds to the following C program: int width; int length;...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
Translate the following C program to Pep/9 assembly language. #include <stdio.h> const int limit = 5; int main() { int number; scanf("%d",&number); while (number < limit){ number++; printf("%d",number); } return 0; }
In PEP8 code. assembly pep8 code. 30. Write an assembly language program that corresponds to the following C+ program #include <iostream> using namespace std; int num; int main() cin >> num: num = num/ 16; cout << "num = " << num << endl; return 0; 21 de
Translate the following C program to Pep/9 assembly language. It multiplies two integers using a recursive shift-and-add algorithm. mpr stands for multiplier and mcand stands for multiplicand. A recursive integer multiplication algorithm #include <stdio.h> int times(int mpr, int mcand) { if (mpr == 0) { return 0; } else if (mpr % 2 == 1) { return times(mpr / 2, mcand * 2) + mcand; } else { return times(mpr / 2, mcand * 2); } } int main() { ...
ranslate the following C program to Pep/9 assembly language. Note: Your jump table must have exactly four entries, but your program must have only three case symbols and three cases. #include <stdio.h> int main () { int guess; printf(“Pick a number 0..3: “); scanf(“%d”, &guess); switch (guess) { case 0: case 1: (printf (“Too low”); break; case 2: printf(“Right on”); break; case 3: printf(“Too high” ); } printf(“\n”); return 0; }
Translate the High order language program to assembly language and generate PEP9 assembly language code. #include <stdio.h> int main() { int number; scanf(“%d”,&number ); if (number <0) { number =- number; } printf ("%d", number); return0; }
1.Write an assembly language program that corresponds to the following C++ program: #include <iostream> using namespace std; const int amount = 20000; int num; int sum; int main () { cin >> num; sum = numb + amount; cout << "sum = " ,<< sum << endl; return 0; } 2. Test the program in the previous question twice. The first time, enter a value for num to make the sum within the allowed range for the Pep/8 computer. The...
Hello guys ! Could you let me know about this ?? Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n") } else { printf("Odd\n"); } return 0; } Thank you !
I need the programming to be in language C. I am using a program called Zybook Prompt: Write a statement that outputs variable numObjects. End with a newline. Given: #include <stdio.h> int main(void) { int numObjects; scanf("%d", &numObjects); return 0; } What I did so far. I am not sure if its right tho? #include <stdio.h> int main(void) { int numObjects; scanf("%d", &numObjects); printf(" num Objects is "); printf("%d\n", userAge); return 0; }
MIPS assembly language Implement the following code in MIPS int array [ ] {2, 3, 4, 5, 6); int main) int num, position; scanf("%d",&num) ; position search(array, printf("The position is: num, 5); %d\n",positio int search(int array, int num, int size int position =-1; for(int i-0;i<size; i++) if(array [i]=num) { position-i; break; return position; Register map $s1: position $a0: array address $a1: num . $a2: size . $VO: return value