Question

In: Computer Science

#define count int8_t arrayInt8[COUNT] = {111, 52, 16, 100, 90}; arrayInt8[2] = 0; arrayInt8[3] = -1;...

#define count

int8_t arrayInt8[COUNT] = {111, 52, 16, 100, 90};

arrayInt8[2] = 0;

arrayInt8[3] = -1;

arrayInt8[4] = -120;

printf("Question 6, countNegative: Correct answer = 2\n");

printf("Question 6, countNegative: Student answer = %u\n\n", countNegative(arrayInt8, COUNT));

I need the arm assembly code for this.

Solutions

Expert Solution

ARM PROGRAM :-

.LC1:

        .ascii  "Question 6, countNegative: Correct answer = 2\000"

.LC2:

        .ascii  "Question 6, countNegative: Student answer = %u\012\012"

        .ascii  "\000"

.LC0:

        .byte   111

        .byte   52

        .byte   16

        .byte   100

        .byte   90

main:

        push    {fp, lr}

        add     fp, sp, #4

        sub     sp, sp, #8

        ldr     r2, .L2

        sub     r3, fp, #12

        ldm     r2, {r0, r1}

        str     r0, [r3]

        add     r3, r3, #4

        strb    r1, [r3]

        mov     r3, #0

        strb    r3, [fp, #-10]

        mvn     r3, #0

        strb    r3, [fp, #-9]

        mvn     r3, #119

        strb    r3, [fp, #-8]

        ldr     r0, .L2+4

        bl      puts

        sub     r3, fp, #12

        mov     r1, #5

        mov     r0, r3

        bl      countNegative

        mov     r3, r0

        mov     r1, r3

        ldr     r0, .L2+8

        bl      printf

        nop

        sub     sp, fp, #4

        pop     {fp, lr}

        bx      lr

.L2:

        .word   .LC0

        .word   .LC1

        .word   .LC2

Respective C program :-

#include <stdint.h>

#define COUNT 5

void main()

{

int8_t arrayInt8[COUNT] = {111, 52, 16, 100, 90};

arrayInt8[2] = 0;

arrayInt8[3] = -1;

arrayInt8[4] = -120;

printf("Question 6, countNegative: Correct answer = 2\n");

printf("Question 6, countNegative: Student answer = %u\n\n", countNegative(arrayInt8, COUNT));

}


Related Solutions

Given: Butter Guns MC 0 100 1 90 2 75 3 55 4 30 5 0...
Given: Butter Guns MC 0 100 1 90 2 75 3 55 4 30 5 0 Complete the marginal cost column (MC). Identify the opportunity cost increasing butter production from 1 to 2 units on the graph. Graphically illustrate the Keynesian versus classical position of the economy and their respective opportunity costs (two graphs). Explain the policy implications of these two alternative assumptions of the economy (Per lesson notes).
Consider the given matrix. 3    0    0 0    2    0 16   ...
Consider the given matrix. 3    0    0 0    2    0 16    0    1 Find the eigenvalues. (Enter your answers as a comma-separated list.) λ = 1,2,3 Find the eigenvectors. (Enter your answers in order of the corresponding eigenvalues, from smallest eigenvalue to largest.)
Let S = {-3, -2, -1, 0, 1, 2, 3}. Define a relation R on S...
Let S = {-3, -2, -1, 0, 1, 2, 3}. Define a relation R on S by: xRy if and only if x = y + 4n for some integer n. a) Prove that R is an equivalence relation. b) Find all the distinct equivalence classes of R.
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6 1 5 6 8 2 4 6 7 3 4 5 9 10 5 8 9 4 7 9 6 7 8 6 How can I detect when 'cin' starts reading from a new line. The amount of numbers in each row is unknown. I need them in type 'int' to use the data.
0. 0. 0. 0.0. 0. 0. 0. 0. 1. 1. 1. 1. 1. 1. 2. 2. 2. 3. 4.
0. 0. 0. 0.0. 0. 0. 0. 0.   1. 1. 1. 1. 1. 1. 2. 2. 2. 3.   4. A.)MEAN – B.)MEDIAN - C.)MODE - D.)STANDARD DEVIATION – E.)5 NUMBER SUMMARY – F.)BOX AND WHISKERS PLOT – G.) OUTLIERS-
0. 0. 0. 0.0. 0. 0. 0. 0. 1. 1. 1. 1. 1. 1. 2. 2. 2. 3. 4.
0. 0. 0. 0.0. 0. 0. 0. 0.   1. 1. 1. 1. 1. 1. 2. 2. 2. 3.   4. A.)5 NUMBER SUMMARY – B.)BOX AND WHISKERS PLOT – C.) OUTLIERS-
(define (count-leaves t) (cond ((null? t) 0) ((not (pair? t)) 1) (else (+ (count-leaves (car t))...
(define (count-leaves t) (cond ((null? t) 0) ((not (pair? t)) 1) (else (+ (count-leaves (car t)) (count-leaves (cdr t)))))) Trace this function with the example: For example, (count-leaves '((4 5 6) (1 2) () (3) )) returns 6
Matrix: Ax b [2 1 0 0 0 | 100] [1 1 -1 0 -1 |...
Matrix: Ax b [2 1 0 0 0 | 100] [1 1 -1 0 -1 | 0] [-1 0 1 0 1 | 50] [0 -1 0 1 1 | 120] [0 1 1 -1 1 | 0] Problem 5 Compute the solution to the original system of equations by transforming y into x, i.e., compute x = inv(U)y. Solution: %code I have not Idea how to do this. Please HELP!
?" + 3?′ + 2? = ????, ?(0) = 0, ?′(0) = 2 1) Please solve...
?" + 3?′ + 2? = ????, ?(0) = 0, ?′(0) = 2 1) Please solve using an annihilator 2) Please solve using the Method of Variation of Parameters Thank you.
A= 1 2 4 0 1 -2 -1 0 1 2 0 3 8 1 4...
A= 1 2 4 0 1 -2 -1 0 1 2 0 3 8 1 4 . Let W denote the row space for A. (a) Find an orthonormal basis for W and for W⊥. (b) Compute projW⊥(1 1 1 1 1 ).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT