Question

Convert the following C code into ARM int foo(int a, int b) { int result =...

Convert the following C code into ARM

int foo(int a, int b)
{
int result = 0;
int i;
for (i = 20; i <= 30; i++) {
if (i == 24) result += 20; else if (i == 27) result = result * 2; else result = result + a + 3*b; }

return result;
}

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Convert the following C code into ARM int foo(int a, int b) { int result =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Given the following Java code: class C { public int foo(C p) { return 1; }...

    Given the following Java code: class C { public int foo(C p) { return 1; } } class D extends C { public int foo(C p) { return 2; } public int foo(D p) { return 3; } } C p = new C(); C q = new D(); D r = new D(); int i = p.foo(r); int j = q.foo(q); int k = q.foo(r); (Remember that in Java every object is accessed through a pointer and that methods...

  • Consider the following code: 1. float foo (int a, int b, int c, int d, float...

    Consider the following code: 1. float foo (int a, int b, int c, int d, float e) { 2. float e; 3. if (a == 0) { 4. return 0; 5. } 6. int x = 0; 7. if ((a==b) || ((c == d) && bug(a) )) { 8. x=1; 9. } 10. e = 1/x; 11. return e; 12. } Function bug(a) should return a value of true when passed a value of a=1. Build: • a test suite...

  • (d) (20 points) Convert the following C code to ARM assembly. And indicate the HEX values of the ...

    (d) (20 points) Convert the following C code to ARM assembly. And indicate the HEX values of the Stack and Data sections in the table below. Note: you do not necessary have to fill in each blank space in the table. Address Value ーC Code int Arr [ ]= {2, 13, 5); int main (void) 0xFFFFFFFC StackOxFFFFFFF8 int Sum; Sum-Ar[0]+A+2*Arr[2] return 0 OxFFFFFFF4 0XFFFFFFFO | 0x0001000C Data Ox00010008 0x00010004 000010000 5 point (d) (20 points) Convert the following C code...

  • public class F2{ public static int foo(ArrayList<Integer> a) { int sum = 0; for(int i =...

    public class F2{ public static int foo(ArrayList<Integer> a) { int sum = 0; for(int i = 0; i <a.size(); i++){ if(i % 3 == 1) sum += a.get(i); else if(i % 3 == 2) sum -= a.get(i); else sum++; } return sum; } } What do the following method calls return? 1. foo(new ArrayList<>(Arrays.asList(1,2,3,4))) 2. foo(new ArrayList<>()) 3. foo(new ArrayList<>(Arrays.asList(1,2,-3,4325,-2))) 4. foo(new ArrayList<>(Arrays.asList(0,0,0)))

  • Q5 (25pts) Consider the code: int foo(int N){ if (N <= 3) return 2; int res1 = 3*foo(N-4); int...

    Q5 (25pts) Consider the code: int foo(int N){ if (N <= 3) return 2; int res1 = 3*foo(N-4); int res2 = foo(N-2); return res1-res2; } a) (6 points) Write the recurrence formula for the time complexity of this function (including the base cases) for N>=0. You do NOT need to solve it. b) (5 points) Draw the tree that shows the function calls performed in order to compute foo(8) (the root will be foo(8) and it will have a child...

  • Given the following C Code segment convert it to ARM assembly. Assume the following register assignment...

    Given the following C Code segment convert it to ARM assembly. Assume the following register assignment have been made before your section of code begins. C Variable Register assignment r1 y r2 r3 r10 j r11 int x=0, y=0, z=0; int main() { for (int i = 0; i<10; i++) for (int j 0; j < 20; j++) if (i* j > 100) X++; if (i j >= 15) y++; + فہه Z = X + y; }

  • Convert the following program into MIPS Instructions: int a = 0; int b = 10; int...

    Convert the following program into MIPS Instructions: int a = 0; int b = 10; int c = 100; result = isSorted(a, b, c); if (!result) isSorted(c, b, a); int isSorted(int a, int b, int c) {if (a < b && b < c) return 1; else return 0;}

  • Convert the following code in to ARM assembly language. Triple Max // Return max of three...

    Convert the following code in to ARM assembly language. Triple Max // Return max of three variables int max(int a, int b, int c) { // Fill in your own code for this function } int main() { // Use registers for local variables int x = 10; int y = 5; int z = 20; int max = max(x, y, z); printf("max = %d\n", max); return 0; }

  • Convert the below C code to basic MIPS. The result of this code should be a^b...

    Convert the below C code to basic MIPS. The result of this code should be a^b of the two numbers that you input. For example if you input the numbers 3 and 5 you should get a result of 3^5=6 #include int main(void) { printf("Insert two numbers\n"); int a,b,c; scanf("%d",&a); scanf("%d",&b); c=a^b; printf("%d^%d=%d\n",a,b,c); return 0; }

  • Consider the following piece of code int adjust = 0; int foo(int factor, function qux) {...

    Consider the following piece of code int adjust = 0; int foo(int factor, function qux) { int offset = bar(factor) + adjust adjust = (qux (offset) + adjust) / 2; return offset; } Which of the names (symbols) are bound at run-time? factor, qux, and offset foo, factor, and qux All the symbols. adjust, factor and offset

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT