Quote (saulius @ Nov 25 2021 06:04am)
Yeah these look like the intel's assembly syntax specifically.
What makes you say that? If anything it looks more like ARM to me with the numbered registers instead of the 2/3 letter acronyms (eax, rbp, ..) used on x86. But of course it's probably neither and just pseudocode written by the prof.
This question also left me puzzled at first and looking for missing instructions but actually I think the solution is pretty simple:
Code
Initial state with 3 as example value:
MEM1 MEM2 REG1 REG2
3 0 0 0
SUB REG1, MEM1 (Reg1 = Reg1 - Mem1 = 0 - 3 = -3)
MEM1 MEM2 REG1 REG2
3 0 -3 0
MOV MEM2, REG1 (Put contents of REG1 into MEM2)
MEM1 MEM2 REG1 REG2
3 -3 -3 0
SUB REG2, MEM2 (REG2 = REG2 - MEM2 = 0 - (-3) = 3)
MEM1 MEM2 REG1 REG2
3 -3 -3 3
MOV MEM2, REG2 (Put contents of REG2 into MEM2)
MEM1 MEM2 REG1 REG2
3 3 -3 3
MEM1 copied to MEM2.