Please write an assembly language for:
int a = 15;
int b =5;
if ((a>=5 && a<=15) || (b>=2 && b<=14)){
a =a+4;
b = b-2;
}
else{
a = a-2;
b=b-5;
}
assembly Language equivalent for the c code is given below , its is compiled using x86-64 gcc 9.1 version
Answer:
main:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], 15
mov DWORD PTR [rbp-8], 5
cmp DWORD PTR [rbp-4], 4
jle .L2
cmp DWORD PTR [rbp-4], 15
jle .L3
.L2:
cmp DWORD PTR [rbp-8], 1
jle .L4
cmp DWORD PTR [rbp-8], 14
jg .L4
.L3:
add DWORD PTR [rbp-4], 4
sub DWORD PTR [rbp-8], 2
jmp .L5
.L4:
sub DWORD PTR [rbp-4], 2
sub DWORD PTR [rbp-8], 5
.L5:
mov eax, 0
pop rbp
ret
Please write an assembly language for: int a = 15; int b =5; if ((a>=5 &&...
please write this in "MARIE assembly language" #include <iostream> using namespace std; int DivideByTwo(int, int); // Data section int Data[] = { 0x0102, 0x0105, 0x0106, 0x0108, 0x011A, 0x0120, 0x0225, 0x0230, 0x0231, 0x0238, 0x0339, 0x0350, 0x0459, 0x055F, 0x066A, 0x0790, 0x08AB, 0x09AF, 0x0AB9, 0x0BBD, 0x0CC1, 0x0DCA, 0x0EFE, 0x0FFE }; int main() { int* BAddr = &Data[0]; int* EAddr = &Data[23]; int Count = 24; // the number of Data int Ffff = 0xffff; // value for "not found" int num; // input...
This code needs to be written in Assembly language using Keil uvision 5. Please use Keil Assembler. Or ARM assembly. Thanks. int main(void) { // initializing int R0 = 5; int R1 = 10; // for loop addition with CMP while(RO <=| 10) R$++; // for loop subtraction without CMP#10 while(R1 > 0) R1--; // if else statement if (RO > 0) R0 = 10; R1 = 10; else | R0 = 20; R1 = 30; // must using branching...
In MIPS assembly, write an assembly language version of the following C code segment: int A[100], B[100]; for (i=1; i < 100; i++) { A[i] = A[i-1] + B[i]; }
avr assembly please 3) Write an assembly program that is algorithmically equivalent to the following C++ code. Treat the variable y as a short int (16 bits) 1 int y; 2 for (int x = 2; x <= 20; x = x + 2) { 3 ¡f (x < 18) { 4 5 у 24 6 else f 7 8 9 3) Write an assembly program that is algorithmically equivalent to the following C++ code. Treat the variable y as...
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; }
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; }
Assembly Language Given the following psuedocode, write the appropriate prolog in assembly for the method mysub usin frame-based linkage. main) 9) int a; a = mysub( 6 ); print( a ); int mysub( int arg) int b,c; b= arg*2; c=b+7; return c
Write a full assembly language program that calls a subroutine to help implement the following algorithm: short int ary[15]; //array of 15 elements of short int type ary[0] = 1; ary[1] = 1; for(int i=2; i<5; i++) { ary[i] = ary[i-1]+ ary[i-2]; }
2) Write a MIPS assembly language version of the following C code segment: int A[75], B[75]; for (i = 1; i < 73; i ++) { C[i] = (A[i + 1] + A[i]) * (B[i + 2] - A[i-1]); } Arrays A, B and C start at memory location A000hex, B000hex and C000hex respectively. Try to reduce the total number of instructions and the number of expensive instructions such as multiplies. WRITE A SIMPLE CODE WORKING FOR MARS 4.5
Write code by Assembly language Microprocessor - 8086 Example An sbit signed int array of size 1024 elements is starting at slooh, Write apiece of code to sort the array asending order ?