The sentence is expressing a hypothetical situation in the past, the correct answer is had had, as it is the past perfect form of the verb "to have" that is used for the third conditional sentence. The third conditional sentence is used to talk about a hypothetical past situation and its result in the past.
Conditional sentence
A conditional sentence describes one situation as depending on another. It pairs a condition clause (usually starting with if) with a consequence clause: If it rains, we'll stay in. The condition can refer to general truths, real future possibilities, hypothetical present situations, or unreal past situations — and each type uses a specific tense pattern.
English teaching groups these into zero, first, second, third, and mixed conditionals. Mastering them lets you talk about plans, regrets, hypotheticals, and warnings — territory you can't reach with simple present and past tenses alone.