Question
Which c code best fits the assembly
2 of 4 the C code that that most likely created this assembly code CMP R0,#0 BNE here MOV R1,#1 CMP R0,#1 BNE there MOV R1,#0 here a) switch (R0) case(0) R1-1 case (1) R1-0 b) switch (RO) case(0) R1-1 case (1) RO-1 c) switch (R1) case(0) R0=1 case (1) RO-1 d) switch (RO) case(0) R1-1 case(1) RO-0 e) none of the above
0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Which c code best fits the assembly 2 of 4 the C code that that most...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 13) (4 pts) Squaring a number is useful in many other algorithms. This assembly routine calculates...

    13) (4 pts) Squaring a number is useful in many other algorithms. This assembly routine calculates the square of an unsigned integer. How long does this take in clock cycles (worst case). Assume ARM 32 bit instruction set and the integer is in R0 before we begin. AREA L.textl, CODE, READONLY PROC EXPORT square square MOV R1,RO; CMP R1, #0 ANDS R3,RO,R1 BNE skip ADD RO,R1, LSL R3; MOV R2,R2, LSL #1 CMP R2, #0 BNE loop BX LR loop...

  • 2. Write an assembly program that counts the number of bits that are set e set...

    2. Write an assembly program that counts the number of bits that are set e set to a I' in RO, and writes the total to R1 When finished, enter an infinite loop. Add loop MOV R3 , 0b0; AND #0b1. R0, R3; CMP R3 . #0b1; ADDEQRI , #0b1; LSR RO, # 060; BNE add loop infinite loop; b irnfinite loop

  • Write an equivalent C function and explain what it computes. 3. (10 marks) The following is...

    Write an equivalent C function and explain what it computes. 3. (10 marks) The following is the assembly language translation of a C function mystery: r3, [r0, #0] r3, #0 L3 ldrb cmp beq r3, #0 mov L4: r3, r3, #1 r2, [ro, r3] r2, #0 L4 add ldrb cmp bne .L3: ro, r3 lr mov bx Annotate each line of the function with commentss to explain what each line does. Write an equivalent C function and explain what it...

  • Find out what the following assembly code calculates AREA my code, CODE EXPORT main ALIGN ENTRY...

    Find out what the following assembly code calculates AREA my code, CODE EXPORT main ALIGN ENTRY main PROC MOVS MOVS MOVS r0,#0 r1,#15 r2,#0 loop CMP BGT MLA ADDS r2,r1 stop re,r2,r2,ro r2,r2,#1 loop % The final result is saved in register r0 stop B stop ENDP END

  • Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...

    Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...

  • Problem 1 Consider the piece of ARM Cortex MO+ assembly code given below and answer the...

    Problem 1 Consider the piece of ARM Cortex MO+ assembly code given below and answer the following questions: mw 1.AGAIN CMP RO, #10 BLE LESSEQUAL MOVS RO, #0 B DONE LESSEQUAL ADDS RO, RO, R1 B AGAIN 5. DONE 1. Assume RO is initialized with the value 20, what is the value of RO when the code above completes execution? How many times is Instruction 5 executed? Assume RO is initialized with the value o, and R1 with the value...

  • ASSEMBLY CODE NEED ASAP WILL RATE RIGHT AWAY all Verizon 6:48 PM What will r2 contain...

    ASSEMBLY CODE NEED ASAP WILL RATE RIGHT AWAY all Verizon 6:48 PM What will r2 contain after the execution of the following instructions assuming that the instructions are executed independently? given that initially r2=0XFFFFFFFF r1=0xFF00FF00 and r0= 0xF7 1) MVN r2, 0x7E000000 2) EOR r2,rO,r1; 3) ROR r2,ro,#2; 4)MLA r2,r2,r2,rO 5) RRX, r2,r& initial carry flag =1 6) MOV r2,(14<<3) 7)ASR r2,r1,#1 8)LSL r2,r1,#3 9) LAR r2,r1,#3

  • computer systems!! pls answer soon 2) Determine the content of memory location named RESULT after execution of eac...

    computer systems!! pls answer soon 2) Determine the content of memory location named RESULT after execution of each of the following codes: Program B TEXT TEXT LDR R1,-NUM LDR RO, A LDR R2.-N LDR RI.R LDR R2.[R2) MUL RO. RI, RO MOV RO, RO LDR R1. C LOOP: LDR R3, [RII. "4 LDR R2, D MULA RO. R1, R2, RO ADDPL Ra, R0, #1 RO, RESULT STR SUBS R2, R2, #1 S: B S BNE LOOP DATA STR R0,-RESULT A:...

  • Assignment 4: Answer the following questions with reference to the assembly program below. Before the code...

    Assignment 4: Answer the following questions with reference to the assembly program below. Before the code is executed, the initial content of memory and registers is shown in the figure below memory 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 address Use BIG ENDIAN, and 0x2000.0000 0x2000.0001 0x2000.0002 show all steps register 0x2000.0000RO Ox2000.0003 0x2000.0004 0x2000.0005 0xFFFF.FFFF R2 ox2000.0006 0x1234.5678 R3 0x2000.0007 Ox0000.0000 R1 LDRH R1, [R0 , #2]! LDRH R2 , [R0 , #2)! ADD R3, R1, R2 STR...

  • I need help with ARM assembly program : Using the following code as basic : 1...

    I need help with ARM assembly program : Using the following code as basic : 1 ) Write a program code that is able to calculate the following : Result = A + ( B * C ) - D Place the result as the return value so you can print it afterwards in the command prompt. 2) This time, use MLA instruction to reduce the number of instructions in question 1. Place the result as the return value so...

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