Giving the following assembly code I know that .data grows towards higher addresses so after running the code the memory looks something like:
-
-
-
-
-
-
-
- (var3 here and up)
-
-
-
- (var2 here and up)
-
-
-
- (var1 here and up)
So when they ask what will be saved in register rsp at the end why the blue option is the correct one?
Here is how I tried to solve it:
- In first line we are trying to save the value of var3 in the register, the value of var3 is the value of var2 which is -1, in the second line we add 6 to it so in total we get 5.
Please Note, In previous question I was told that label or variable with no $ before it means its value in memory (data) where adding $ means its address in memory.