code: func GetPreciseSigOpCount(scriptSig, scriptPubKey []byte, bip16 bool) int {
  	// Don't check error since parseScript returns the parsed-up-to-error
  	// list of pops.
  	pops, _ := parseScript(scriptPubKey)
  
  	// Treat non P2SH transactions as normal.
  	if !(bip16 && isScriptHash(pops)) {
  		return getSigOpCount(pops, true)
  	}
  
  	// The public key script is a pay-to-script-hash, so parse the signature
  	// script to get the final item.  Scripts that fail to fully parse count
  	// as 0 signature operations.
  	sigPops, err := parseScript(scriptSig)
  	if err != nil {
  		return 0
  	}
  
  	// The signature script must only push data to the stack for P2SH to be
  	// a valid pair, so the signature operation count is 0 when that is not
  	// the case.
  	if !isPushOnly(sigPops) || len(sigPops) == 0 {
  		return 0
  	}
  
  	// The P2SH script is the last item the signature script pushes to the
  	// stack.  When the script is empty, there are no signature operations.
  	shScript := sigPops[len(sigPops)-1].data
  	if len(shScript) == 0 {
  		return 0
  	}
  
  	// Parse the P2SH script and don't check the error since parseScript
  	// returns the parsed-up-to-error list of pops and the consensus rules
  	// dictate signature operations are counted up to the first parse
  	// failure.
  	shPops, _ := parseScript(shScript)
  	return getSigOpCount(shPops, true)
  }
docs: // GetPreciseSigOpCount returns the number of signature operations in
  // scriptPubKey.  If bip16 is true then scriptSig may be searched for the
  // Pay-To-Script-Hash script in order to find the precise number of signature
  // operations in the transaction.  If the script fails to parse, then the count
  // up to the point of failure is returned.