I am trying to match two patterns in a file and insert a line. If the patterns matche then insert a line after the second matching pattern line.

for example,
I have the following content in a file:

//This is my source file

Code:
pin(name1) { 
clock; 
capacitance; 
direction: input; 
//this is where i want to insert a line 
min_pulse; 
} 
pin(name2)
...