  We study the cohomological equation $Xu=f$ for smooth locally Hamiltonian
flows on compact surfaces. The main novelty of the proposed approach is that it
is used to study the regularity of the solution $u$ when the flow has saddle
loops, which has not been systematically studied before. Then we need to limit
the flow to its minimum components. We show the existence and (optimal)
regularity of solutions regarding the relations with the associated
cohomological equations for interval exchange transformations (IETs). Our main
theorems state that the regularity of solutions depends not only on the
vanishing of the so-called Forni's distributions (cf.\ \cite{Fo1,Fo3}), but
also on the vanishing of families of new invariant distributions (local
obstructions) reflecting the behavior of $f$ around the saddles. Our main
results provide some key ingredient for the complete solution to the regularity
problem of solutions (in cohomological equations) for a.a.\ locally Hamiltonian
flows (with or without saddle loops) to be shown in \cite{Fr-Ki3}.
  The main contribution of this article is to define the aforementioned new
families of invariant distributions $\mathfrak{d}^k_{\sigma,j}$,
$\mathfrak{C}^k_{\sigma,l}$ and analyze their effect on the regularity of $u$
and on the regularity of the associated cohomological equations for IETs. To
prove this new phenomenon, we further develop local analysis of $f$ near
degenerate singularities inspired by tools from \cite{Fr-Ki} and \cite{Fr-Ul2}.
We develop new tools of handling functions whose higher derivatives have
polynomial singularities over IETs.
