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;
}
limit:
.long 5
.LC0:
.string "%d"
main:
push rbp
mov rbp, rsp
sub rsp, 16
lea rax, [rbp-4]
mov rsi, rax
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call __isoc99_scanf
jmp .L2
.L3:
mov eax, DWORD PTR [rbp-4]
add eax, 1
mov DWORD PTR [rbp-4], eax
mov eax, DWORD PTR [rbp-4]
mov esi, eax
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
.L2:
mov eax, DWORD PTR [rbp-4]
mov edx, 5
cmp eax, edx
jl .L3
mov eax, 0
leave
ret
Please do up-vote.
Translate the following C program to Pep/9 assembly language. #include <stdio.h> const int limit = 5;...
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. 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() { ...
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; }
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 !
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; }
Convert this C++ language to PEP/8 assembly language. #include <stdio.h> int main(void) { int num, rem; printf("Enter a number: "); scanf("%d", &num); printf("Roman numerals: "); while(num != 0) { if (num >= 1000) // 1000 - m { printf("m"); num -= 1000; } else if (num >= 900) // 900 - cm { printf("cm"); num -= 900; } else if (num >= 500) // 500 - d { printf("d"); num -= 500; } else if (num >= 400) // 400 - cd { printf("cd"); num -= 400; } else if (num >= 100) // 100 - c { printf("c"); num -= 100; } else if (num >= 90) // 90 - xc { printf("xc"); num -= 90; } else if (num >= 50) // 50 - l { printf("l"); num -= 50; } else if (num >= 40) // 40 - xl { printf("xl"); num -= 40; } else if (num >= 10) // 10 - x { printf("x"); num -= 10; } else if (num >= 9) // 9 - ix { printf("ix"); num -= 9; } else if (num >= 5) // 5 - v { printf("v"); num -= 5; } else if (num >= 4) // 4 - iv { printf("iv"); num -= 4; } else if (num >= 1) // 1 - i { printf("i"); num -= 1; } } return 0;}
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; }
i need flowchart for the following c code #include <stdio.h> int main() { int n, i, sum = 0; printf("Enter an integer: "); scanf("%d",&n); i = 1; while ( i <=n ) { sum += i; ++i; } printf("Sum = %d",sum); return 0; }
6. Consider the following program: #include <stdio.h> main() { int a,b,c,d ; a=0; while (1) { printf("%d\n", a); printf("Input? "); scanf("%d",&c); if (c == 0) break; d=0; for (b=1; b<=c; b++) if (c%b == 0) d++; if (d == 2 11 C == 1) a=a+c; } } What does this program do? Rewrite the code, organizing it using sound principles. Include comments and redo variable names and indentation. Use multiple functions, blocks, and/or preprocessing if you deem it necessary.
MIPS assembly language Covert this code to MIPS: #include <stdio.h> int function (int a) int main)i int x=5 ; int y: y function(x); printf "yd",y); return 0; int function (int a) return 3*a+5; Assumptions: . Place arguments in $a0-$a3 . Place return values in $vO-$v1 Return address saved automatically in $ra . lgnore the stack for this example. (Thus, the function will destroy registers used by calling function