I think this is the recommended one:
-- If I had gone to the supermarket, I would
definitely have bought some ham.
but others are possible:
----
When there are two or more verb auxiliaries, the adverb usually goes after the first:
-- You have
definitely been working too hard.
But other positions are possible, especially when the first part of the verb phrase is a modal auxiliary.
-- She could have
easily been killed.
OR
-- She could
easily have been killed.
[Swan, Practicaly English Usage, p. 25]
---