Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-FINAL CSC140D- Assembly Language 2. Write an equivalent code in assembly for th

ID: 664633 • Letter: #

Question

-FINAL CSC140D- Assembly Language 2. Write an equivalent code in assembly for the tollowing code fragment shown. (5 marks) if (sum> 0) then sum = sum + 1 end if (Rubric: 5 marks for correct and complete fragment) II. Code Tracing: Give the final output of the following Assembly Language Program: Marks) model small stack 100 code main proc mov dl, 'k mov cx, 5 mov ah, 2 loop1 cmp cx, 1 je end1 int 21h dec cx jmp loop1 end1 mov ah, 4ch int 21h main endp end main (Rubric: 5 marks for correct and complete output)

Explanation / Answer

2)

Assembly Code:

cmpl $0, -4(%rbp)    //if(sum>0)
jle     .L2

addl $1,-4(%rbp)    //sum=sum+1