What are the values of the variables after the following ass

What are the values of the variables after the following assembler program segment is executed? Write a program in Intel assembler to perform the equivalent calculations as shown in C++.

Solution

Answer: 5

deer = 12

bear = 1

panther = 3

Answer 6

_asm {

push    rbp
        mov     rbp, rsp
        mov     eax, DWORD PTR [rbp-4]
        cdq
        idiv    DWORD PTR [rbp-8]
        add     DWORD PTR [rbp-12], eax
        mov     eax, DWORD PTR [rbp-12]
        cmp     eax, DWORD PTR [rbp-8]
        jl      .L2
        mov     eax, DWORD PTR [rbp-4]
        mov     DWORD PTR [rbp-8], eax
        jmp     .L3
.L2:
        add     DWORD PTR [rbp-4], 1
.L3:
        mov     eax, 0
        pop     rbp
        ret

}

 What are the values of the variables after the following assembler program segment is executed? Write a program in Intel assembler to perform the equivalent ca

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site