Show the contents of %eax immediately after finishing the execution of “.f2”. ==
ID: 3702137 • Letter: S
Question
Show the contents of %eax immediately after finishing the execution of “.f2”.
===
.f1:
pushl %rbp
movl %rsp, %rbp
subl $4, %rsp
movl $0, -4(%rbp)
.L2:
movl -4(%rbp), %rax
cmpl 8(%rbp), %rax
jl .L5
jmp .L3
.L5:
decl 8(%rbp)
movl 12(%rbp), %rdx
leal -4(%rbp), %rax
addl %rdx, (%rax)
jmp .L2
.L3:
movl 8(%rbp), %rax
leave
ret
.f2:
pushl %rbp
movl %rsp, %rbp
pushl $3
pushl $19
call .f1
addl $8, %rsp
leave
ret
===
Sol:
%eax =
_________
please help me to solve this and get the result of (eax)
please show me how to do it with steps
to understand how you solve it
(IN COMPUTER SYSTEM LANGUAGE)
ASSEMBLY in 64 system
Explanation / Answer
In steps 7 and 8, the return value of the function f2 is stored in %eax and the stack frame now goes back to the calling function. Since f2 doesn't return any value, generally the default value of 0 is copied into eax, this could change based on the platform standards.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.