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

HELLLPPPP :D Implement the following C program in MASM. Be sure to use proper sp

ID: 3798803 • Letter: H

Question

HELLLPPPP :D

Implement the following C program in MASM. Be sure to use proper spacing on all output. If necessary, first key in the C program and then implement the MASM program to insure the MASM program works identically to the C program:

#include <stdio.h>
int main(){
int num1, num2;
printf(" %s","Enter a value for num1: ");
scanf("%d",&num1);
printf(" %s","Enter a value for num2: ");
scanf("%d",&num2);
printf(" %s ","num1 num2");
printf("%s%d%s%d "," ",num1," ",num2);
return 0;
}

Pl

Explanation / Answer

.LC0:
        .string "Enter a value for num1: "
.LC1:
        .string " %s"
.LC2:
        .string "%d"
.LC3:
        .string "Enter a value for num2: "
.LC4:
        .string "num1 num2"
.LC5:
        .string " %s "
.LC6:
        .string " "
.LC7:
        .string "%s%d%s%d "
main:
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     esi, OFFSET FLAT:.LC0
        mov     edi, OFFSET FLAT:.LC1
        mov     eax, 0
        call    printf
        lea     rax, [rbp-4]
        mov     rsi, rax
        mov     edi, OFFSET FLAT:.LC2
        mov     eax, 0
        call    scanf
        mov     esi, OFFSET FLAT:.LC3
        mov     edi, OFFSET FLAT:.LC1
        mov     eax, 0
        call    printf
        lea     rax, [rbp-8]
        mov     rsi, rax
        mov     edi, OFFSET FLAT:.LC2
        mov     eax, 0
        call    scanf
        mov     esi, OFFSET FLAT:.LC4
        mov     edi, OFFSET FLAT:.LC5
        mov     eax, 0
        call    printf
        mov     edx, DWORD PTR [rbp-8]
        mov     eax, DWORD PTR [rbp-4]
        mov     r8d, edx
        mov     ecx, OFFSET FLAT:.LC6
        mov     edx, eax
        mov     esi, OFFSET FLAT:.LC6
        mov     edi, OFFSET FLAT:.LC7
        mov     eax, 0
        call    printf
        mov     eax, 0
        leave
        ret