Learn English – What does the word “only” mean in this sentence

meaning-in-context

I recently met a quiz question and I am not sure what it means.
The question is as follows (no context):

We only need to save the stack pointer for a non-leaf procedure.

Just for reference, the "non-leaf procedure" means procedures that call other procedures.

Does it mean:

  1. The only thing we need to save in a non-leaf procedure is the stack pointer.
  2. The stack pointer needs to be saved only when it's in a non-leaf procedure.

Although common sense tells me 2 is more likely to be the intention of the question setter, I am not sure what this sentence really mean in terms of English syntax. I am not a native English speaker.

Best Answer

The second interpretation is the correct one.

The stack pointer needs to be saved for non-leaf procedures; for procedures that don't call other procedures, the stack pointer doesn't need to be saved.